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

Function test_sparse_union_is_null

arrow-arith/src/boolean.rs:946–965  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

944
945 #[test]
946 fn test_sparse_union_is_null() {
947 // union of [{A=1}, {A=}, {B=3.2}, {B=}, {C="a"}, {C=}]
948 let int_array = Int32Array::from(vec![Some(1), None, None, None, None, None]);
949 let float_array = Float64Array::from(vec![None, None, Some(3.2), None, None, None]);
950 let str_array = StringArray::from(vec![None, None, None, None, Some("a"), None]);
951 let type_ids = [0, 0, 1, 1, 2, 2].into_iter().collect::<ScalarBuffer<i8>>();
952
953 let children = vec![
954 Arc::new(int_array) as Arc<dyn Array>,
955 Arc::new(float_array),
956 Arc::new(str_array),
957 ];
958
959 let array = UnionArray::try_new(union_fields(), type_ids, None, children).unwrap();
960
961 let result = is_null(&array).unwrap();
962
963 let expected = &BooleanArray::from(vec![false, true, false, true, false, true]);
964 assert_eq!(expected, &result);
965 }
966
967 fn union_fields() -> UnionFields {
968 [

Callers

nothing calls this directly

Calls 4

try_newFunction · 0.85
is_nullFunction · 0.85
union_fieldsFunction · 0.70
into_iterMethod · 0.45

Tested by

no test coverage detected