bkietz commented on code in PR #39192:
URL: https://github.com/apache/arrow/pull/39192#discussion_r1478495963
##########
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:
ToString shouldn't be extended here. I think that adding options would
decrease the C++ API's usability; we rely on ToString being a simple string
representation in unit testing and error messages.
Please add special cases as necessary to preserve the existing behavior for
Scalar::ToString; I think it'd be worthwhile in a follow-up to remove those
special cases but that'd be a breaking change and should be guarded accordingly.
--
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]