MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_run_array

Function test_run_array

arrow-array/src/array/run_array.rs:898–920  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

896 }
897 #[test]
898 fn test_run_array() {
899 // Construct a value array
900 let value_data =
901 PrimitiveArray::<Int8Type>::from_iter_values([10_i8, 11, 12, 13, 14, 15, 16, 17]);
902
903 // Construct a run_ends array:
904 let run_ends_values = [4_i16, 6, 7, 9, 13, 18, 20, 22];
905 let run_ends_data =
906 PrimitiveArray::<Int16Type>::from_iter_values(run_ends_values.iter().copied());
907
908 // Construct a run ends encoded array from the above two
909 let ree_array = RunArray::<Int16Type>::try_new(&run_ends_data, &value_data).unwrap();
910
911 assert_eq!(ree_array.len(), 22);
912 assert_eq!(ree_array.null_count(), 0);
913
914 let values = ree_array.values();
915 assert_eq!(value_data.into_data(), values.to_data());
916 assert_eq!(&DataType::Int8, values.data_type());
917
918 let run_ends = ree_array.run_ends();
919 assert_eq!(run_ends.values(), &run_ends_values);
920 }
921
922 #[test]
923 fn test_run_array_empty() {

Callers

nothing calls this directly

Calls 4

try_newFunction · 0.85
run_endsMethod · 0.80
iterMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected