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


##########
cpp/src/arrow/scalar.cc:
##########
@@ -884,9 +885,24 @@ std::string Scalar::ToString() const {
     return dict_scalar->value.dictionary->ToString() + "[" +
            dict_scalar->value.index->ToString() + "]";
   }
-  auto maybe_repr = CastTo(utf8());
+
+  if (type->id() == Type::LIST || type->id() == Type::LARGE_LIST ||
+      type->id() == Type::LIST_VIEW || type->id() == Type::LARGE_LIST_VIEW ||
+      type->id() == Type::FIXED_SIZE_LIST) {
+    auto list_scalar = checked_cast<const BaseListScalar*>(this);
+    return list_scalar->value->ToString();

Review Comment:
   Yes, more time has passed since we created this PR than we initially thought.
   
   The purpose of this PR is to completely remove the `CastTo` function.
   
   Initially, `CastTo` was being used in the Scalar's `ToString` function, and 
I have added code to replace it with `Cast`.
   
   This change necessitates addressing the following issues:
   
   - `ToString` now outputs a format different from the original, causing unit 
tests to fail (for example, `BaseListScalar` and `RunEndEncodedScalar`).
     - 
https://github.com/apache/arrow/actions/runs/7765982125/job/21181284567?pr=39192
     - Relatedly, tests in `glib` also fail.
       - 
https://github.com/apache/arrow/actions/runs/7765982121/job/21181284546?pr=39192
   - Errors occur due to legacy `CastTo` being bound in Cython.
     - 
https://github.com/apache/arrow/actions/runs/7765982118/job/21181283847?pr=39192
   



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