llama90 commented on code in PR #39353:
URL: https://github.com/apache/arrow/pull/39353#discussion_r1438901160


##########
cpp/src/arrow/scalar_test.cc:
##########
@@ -1087,11 +1088,28 @@ void CheckListCast(const ScalarType& scalar, const 
std::shared_ptr<DataType>& to
                       *checked_cast<const 
BaseListScalar&>(*cast_scalar).value);
 }
 
-void CheckInvalidListCast(const Scalar& scalar, const 
std::shared_ptr<DataType>& to_type,
-                          const std::string& expected_message) {
-  EXPECT_RAISES_WITH_CODE_AND_MESSAGE_THAT(StatusCode::Invalid,
-                                           
::testing::HasSubstr(expected_message),
-                                           scalar.CastTo(to_type));
+std::tuple<StatusCode, std::string> GetExpectedError(
+    const std::shared_ptr<DataType>& type,
+    const std::shared_ptr<DataType>& invalidCastType) {
+  if (type->id() == Type::FIXED_SIZE_LIST) {
+    return std::make_tuple(
+        StatusCode::TypeError,
+        "Size of FixedSizeList is not the same. input list: " + 
type->ToString() +
+            " output list: " + invalidCastType->ToString());
+  } else {
+    return std::make_tuple(
+        StatusCode::Invalid,
+        "ListType can only be casted to FixedSizeListType if the lists are all 
the "
+        "expected size.");
+  }
+}

Review Comment:
   You are right. I changed.



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