mapleFU commented on code in PR #43782:
URL: https://github.com/apache/arrow/pull/43782#discussion_r1946021721


##########
cpp/src/arrow/compute/kernels/scalar_cast_test.cc:
##########
@@ -2974,18 +2975,20 @@ TEST(Cast, StructToDifferentNullabilityStruct) {
     const auto dest2_non_nullable = arrow::struct_(fields_dest2_non_nullable);
     const auto options2_non_nullable = CastOptions::Safe(dest2_non_nullable);
     EXPECT_RAISES_WITH_MESSAGE_THAT(
-        TypeError,
-        ::testing::HasSubstr("cannot cast nullable field to non-nullable 
field"),
+        Invalid,
+        ::testing::HasSubstr(
+            "field 'a' of type int64 has nulls. Can't cast to field 'a' of 
non-nullable type int64"),
         Cast(src_nullable, options2_non_nullable));
 
-    std::vector<std::shared_ptr<Field>> fields_dest3_non_nullable = {
+    std::shared_ptr<Array> c_dest_no_nulls;
+    c_dest_no_nulls = ArrayFromJSON(int64(), "[9, 11, 44]");

Review Comment:
   Can we add a test for sub slices? Like: `[null, 9, 11, 14]`, the 
`slice(0,2)` would cast failed, and `[11, 14]` would success?



-- 
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]

Reply via email to