lidavidm commented on code in PR #13737:
URL: https://github.com/apache/arrow/pull/13737#discussion_r932436063


##########
cpp/src/arrow/scalar.cc:
##########
@@ -1041,6 +1041,24 @@ Status CastImpl(const StructScalar& from, StringScalar* 
to) {
   return Status::OK();
 }
 
+// list based types (list, large list and map (fixed sized list too)) to string
+Status CastImpl(const BaseListScalar& from, StringScalar* to) {
+  std::stringstream ss;
+  ss << from.type->ToString() << "{";
+  for (int64_t i = 0; i < from.value->length(); i++) {
+    if (i > 0) ss << ", ";
+    auto result = from.value->GetScalar(i);
+    if (!result.ok()) {
+      return(result.status());
+    } else {
+      ss << result.ValueOrDie()->ToString();
+    }

Review Comment:
   ```suggestion
       ARROW_ASSIGN_OR_RAISE(auto value, from.value->GetScalar(i));
       ss << value->ToString();
   ```



##########
cpp/src/arrow/scalar.cc:
##########
@@ -1041,6 +1041,24 @@ Status CastImpl(const StructScalar& from, StringScalar* 
to) {
   return Status::OK();
 }
 
+// list based types (list, large list and map (fixed sized list too)) to string
+Status CastImpl(const BaseListScalar& from, StringScalar* to) {
+  std::stringstream ss;
+  ss << from.type->ToString() << "{";

Review Comment:
   kind of a nit, but maybe square brackets are preferable here?



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