jorisvandenbossche commented on code in PR #14495:
URL: https://github.com/apache/arrow/pull/14495#discussion_r1016802548


##########
cpp/src/arrow/compute/kernels/scalar_nested_test.cc:
##########
@@ -141,16 +148,25 @@ TEST(TestScalarNested, StructField) {
                 &extract0);
     CheckScalar("struct_field", {arr}, ArrayFromJSON(int64(), "[10, 11, 12, 
null]"),
                 &extract20);
+
+    CheckScalar("struct_field", {arr}, ArrayFromJSON(int32(), "[1, null, 3, 
null]"),
+                &extract0_field_ref_path);
+    CheckScalar("struct_field", {arr}, ArrayFromJSON(int32(), "[1, null, 3, 
null]"),
+                &extract0_field_ref_name);
+    CheckScalar("struct_field", {arr}, ArrayFromJSON(int64(), "[10, 11, 12, 
null]"),
+                &extract20_field_ref_nest);
+
     EXPECT_RAISES_WITH_MESSAGE_THAT(Invalid,
                                     ::testing::HasSubstr("out-of-bounds field 
reference"),
                                     CallFunction("struct_field", {arr}, 
&invalid1));
     EXPECT_RAISES_WITH_MESSAGE_THAT(Invalid,
-                                    ::testing::HasSubstr("out-of-bounds field 
reference"),
+                                    ::testing::HasSubstr("No match for 
FieldRef"),

Review Comment:
   My comment wasn't really about only checking a substring. But that the 
former error message (which included "out-of-bounds field reference") seems 
more informative as "No match for FieldRef.FieldPath(2 4) in ...")
   
   So my question is not to update the HasSubtr test line here, but rather: is 
it possible / would it be worth to try to update `FieldRef::FindOne` (where the 
error comes from now, I think) to also give such a more informative error 
message (so we don't loose this more informative error message)
   
   (this might not necessarily be a straightforward fix, didn't check how 
`FindOne` currently does error checking, so even if we would like to update 
this, it could also be for a follow-up JIRA)



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