You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "felipecrv (via GitHub)" <gi...@apache.org> on 2023/06/27 14:50:00 UTC

[GitHub] [arrow] felipecrv commented on a diff in pull request #36310: GH-36309: [C++] Add ability to cast between scalars of list-like types

felipecrv commented on code in PR #36310:
URL: https://github.com/apache/arrow/pull/36310#discussion_r1243884320


##########
cpp/src/arrow/scalar.cc:
##########
@@ -1127,6 +1127,28 @@ Status CastImpl(const StructScalar& from, StringScalar* to) {
   return Status::OK();
 }
 
+// casts between variable-length and fixed-length list types
+template <typename ToScalar>
+enable_if_t<is_list_like_type<typename ToScalar::TypeClass>::value &&
+                ToScalar::TypeClass::type_id != Type::MAP,
+            Status>
+CastImpl(const BaseListScalar& from, ToScalar* to) {
+  DCHECK(from.type->id() == Type::LIST || from.type->id() == Type::LARGE_LIST ||
+         from.type->id() == Type::FIXED_SIZE_LIST);

Review Comment:
   I will use `is_var_length_list` in the enable-if and expand the test cases.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org