felipecrv commented on code in PR #35036:
URL: https://github.com/apache/arrow/pull/35036#discussion_r1165660903
##########
cpp/src/arrow/compute/kernels/scalar_validity_test.cc:
##########
@@ -92,6 +92,34 @@ TEST_F(TestBooleanValidityKernels, IsNull) {
"[true, false, false, true]", &nan_is_null_options);
}
+TEST_F(TestBooleanValidityKernels, IsNullUnion) {
+ auto field_i64 = ArrayFromJSON(int64(), "[null, 127, null, null, null]");
+ auto field_str = ArrayFromJSON(utf8(), R"(["abcd", null, null, null, ""])");
+ auto type_ids = ArrayFromJSON(int8(), R"([1, 0, 0, 1, 1])");
+ ASSERT_OK_AND_ASSIGN(auto arr1,
+ SparseUnionArray::Make(*type_ids, {field_i64,
field_str}));
+ auto expected = ArrayFromJSON(boolean(), "[false, false, true, true,
false]");
+ CheckScalarUnary("is_null", arr1, expected);
+
+ auto dense_field_i64 = ArrayFromJSON(int64(), "[127, null]");
+ auto dense_field_str = ArrayFromJSON(utf8(), R"(["abcd", null, ""])");
+ auto value_offsets = ArrayFromJSON(int32(), R"([0, 0, 1, 1, 2])");
+ ASSERT_OK_AND_ASSIGN(auto arr2,
+ DenseUnionArray::Make(*type_ids, *value_offsets,
+ {dense_field_i64,
dense_field_str}));
+ CheckScalarUnary("is_null", arr2, expected);
+}
+
+// TEST_F(TestBooleanValidityKernels, IsNullRunEndEncoded) {
+// auto run_ends = ArrayFromJSON(int32(), R"([2, 3, 5, 7])");
+// auto values = ArrayFromJSON(int64(), R"([1, 2, null, 3])");
+// ASSERT_OK_AND_ASSIGN(auto ree_array, RunEndEncodedArray::Make(7,
run_ends, values));
+// ASSERT_OK(ree_array->ValidateFull());
+// auto expected =
+// ArrayFromJSON(boolean(), "[false, false, false, true, true, false,
false]");
+// CheckScalarUnary("is_null", ree_array, expected);
Review Comment:
Thanks for adding it! I'm gonna use it for something I'm doing as well.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]