alamb commented on code in PR #6986:
URL: https://github.com/apache/arrow-datafusion/pull/6986#discussion_r1267305845


##########
datafusion/core/tests/sqllogictests/test_files/array.slt:
##########
@@ -55,6 +55,13 @@ AS VALUES
   (make_array(make_array(15, 16),make_array(NULL, 18)), make_array(16.6, 17.7, 
18.8), NULL)
 ;
 
+statement ok
+CREATE TABLE nested_arrays
+AS VALUES
+  (make_array(make_array(1, 2, 3), make_array(2, 9, 1), make_array(7, 8, 9), 
make_array(1, 2, 3), make_array(1, 7, 4), make_array(4, 5, 6)), make_array(7, 
8, 9), 2, make_array([[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]])),

Review Comment:
   I recommend adding NULL values -- both as elements as well as the arrays as 
that is often a corner case that gets overlooked
   
   Perhaps something like 
   
   ```suggestion
     (make_array(make_array(1, 2, 3), NULL, make_array(7, 8, 9), make_array(1, 
2, 3), make_array(1, 7, 4), make_array(4, 5, 6)), make_array(7, 8, 9), 2, 
make_array([[NULL, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]])),
   ```



##########
datafusion/physical-expr/src/array_expressions.rs:
##########
@@ -543,7 +545,18 @@ fn align_array_dimensions(args: Vec<ArrayRef>) -> 
Result<Vec<ArrayRef>> {
                 let mut aligned_array = array.clone();
                 for _ in 0..(max_ndim - ndim) {
                     let data_type = aligned_array.as_ref().data_type().clone();
-                    aligned_array = array_array(&[aligned_array], data_type)?;
+                    let offsets: Vec<i32> =
+                        (0..downcast_arg!(aligned_array, 
ListArray).offsets().len())
+                            .map(|i| i as i32)
+                            .collect();
+                    let field = Arc::new(Field::new("item", data_type, true));
+
+                    aligned_array = Arc::new(ListArray::try_new(

Review Comment:
   The last argument to `try_new` is the `Option<NullBuffer>` right which 
defines which elements are nulls.
   
   Perhaps I don't understand your question



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