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

Function test_dense_i32_large

arrow-array/src/array/union_array.rs:1136–1169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1134 #[test]
1135 #[cfg_attr(miri, ignore)]
1136 fn test_dense_i32_large() {
1137 let mut builder = UnionBuilder::new_dense();
1138
1139 let expected_type_ids = vec![0_i8; 1024];
1140 let expected_offsets: Vec<_> = (0..1024).collect();
1141 let expected_array_values: Vec<_> = (1..=1024).collect();
1142
1143 expected_array_values
1144 .iter()
1145 .for_each(|v| builder.append::<Int32Type>("a", *v).unwrap());
1146
1147 let union = builder.build().unwrap();
1148
1149 // Check type ids
1150 assert_eq!(*union.type_ids(), expected_type_ids);
1151 for (i, id) in expected_type_ids.iter().enumerate() {
1152 assert_eq!(id, &union.type_id(i));
1153 }
1154
1155 // Check offsets
1156 assert_eq!(*union.offsets().unwrap(), expected_offsets);
1157 for (i, id) in expected_offsets.iter().enumerate() {
1158 assert_eq!(union.value_offset(i), *id as usize);
1159 }
1160
1161 for (i, expected_value) in expected_array_values.iter().enumerate() {
1162 assert!(!union.is_null(i));
1163 let slot = union.value(i);
1164 let slot = slot.as_primitive::<Int32Type>();
1165 assert_eq!(slot.len(), 1);
1166 let value = slot.value(0);
1167 assert_eq!(expected_value, &value);
1168 }
1169 }
1170
1171 #[test]
1172 fn test_dense_mixed() {

Callers

nothing calls this directly

Calls 4

collectMethod · 0.80
iterMethod · 0.45
buildMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected