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

[GitHub] [arrow-rs] jayzhan211 commented on a diff in pull request #4484: Support nested list casting

jayzhan211 commented on code in PR #4484:
URL: https://github.com/apache/arrow-rs/pull/4484#discussion_r1257571959


##########
arrow-schema/src/datatype.rs:
##########
@@ -407,6 +407,19 @@ impl DataType {
         }
     }
 
+    /// Returns the number of dimensions if the data type is nested (List, FixedSizeList, LargeList).
+    /// Otherwise, returns 0.
+    pub fn get_list_ndims(&self) -> u8 {

Review Comment:
   One use case is for 
   https://github.com/apache/arrow-datafusion/blob/1eb6656a4942155f3f504564477e2aac8d59bf3c/datafusion/expr/src/type_coercion/binary.rs#L707-L708
   
   We can compare the ndims for the list and we can know which type to be casted to. For example, if we have 1D list arry as lhs, 2D list array as rhs, we return 2D list array data type. lhs is then be casted to 2D. In this case we need some function to know the higher dimensions list array. 



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