jayzhan211 commented on code in PR #8121:
URL: https://github.com/apache/arrow-datafusion/pull/8121#discussion_r1398199405


##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -1707,7 +1731,20 @@ pub fn flatten(args: &[ArrayRef]) -> Result<ArrayRef> {
 
 /// Array_length SQL function
 pub fn array_length(args: &[ArrayRef]) -> Result<ArrayRef> {
-    let list_array = as_list_array(&args[0])?;
+    match &args[0].data_type() {
+        DataType::List(_) => _array_length_list::<i32>(args),
+        DataType::LargeList(_) => _array_length_list::<i64>(args),
+        _ => Err(DataFusionError::Internal(format!(
+            "array_length does not support type '{:?}'",
+            args[0].data_type()
+        ))),
+    }
+}
+
+/// array_length for List and LargeList
+fn _array_length_list<O: OffsetSizeTrait>(args: &[ArrayRef]) -> 
Result<ArrayRef> {

Review Comment:
   Any other name without _? In rust _xxx usually means unused.



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to