jkosh44 opened a new issue, #14613:
URL: https://github.com/apache/datafusion/issues/14613

   ### Describe the bug
   
   When using the function `array_prepend` with nested lists an error is 
sometimes returned. Interestingly some nested types work.
   
   The following types DO NOT work:
   
   - `LargeList(FixedSizeList(n, t))`
   - `LargeList(List(t))`
   - `List(LargeList(t))`
   - `FixedSizeList(n, LargeList(t))`
   
   The following type DO work:
   
   - `LargeList(LargeList(t))`
   - `List(List(t))`
   - `List(FixedSizeList(n, t))`
   - `FixedSizeList(n1, FixedSizeList(n2, t))`
   - `FixedSizeList(n, List(t))`
   
   The following other issues may be related:
   
   - https://github.com/apache/datafusion/issues/8249
   - https://github.com/apache/datafusion/issues/8249
   
   ### To Reproduce
   
   Broken:
   ```
   > select array_prepend(arrow_cast(make_array(1), 'FixedSizeList(1, Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'LargeList(FixedSizeList(1, Int64))'));
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i32>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   
   > select array_prepend(arrow_cast(make_array(1), 'List(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'LargeList(List(Int64))'));
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i32>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   
   > select array_prepend(arrow_cast(make_array(1), 'LargeList(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'List(LargeList(Int64))'));
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i64>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   
   > select array_prepend(arrow_cast(make_array(1), 'LargeList(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'FixedSizeList(3, LargeList(Int64))'));
   Internal error: could not cast value to 
arrow_array::array::list_array::GenericListArray<i64>.
   This was likely caused by a bug in DataFusion's code and we would welcome 
that you file an bug report in our issue tracker
   
   ```
   
   Works:
   ```
   > select array_prepend(arrow_cast(make_array(1), 'LargeList(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'LargeList(LargeList(Int64))'));
   
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 
array_prepend(arrow_cast(make_array(Int64(1)),Utf8("LargeList(Int64)")),arrow_cast(make_array(make_array(Int64(2)),make_array(Int64(3)),make_array(Int64(4))),Utf8("LargeList(LargeList(Int64))")))
 |
   
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | [[1], [2], [3], [4]]                                                       
                                                                                
                                         |
   
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.005 seconds.
   
   > select array_prepend(arrow_cast(make_array(1), 'List(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'List(List(Int64))'));
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 
array_prepend(arrow_cast(make_array(Int64(1)),Utf8("List(Int64)")),arrow_cast(make_array(make_array(Int64(2)),make_array(Int64(3)),make_array(Int64(4))),Utf8("List(List(Int64))")))
 |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | [[1], [2], [3], [4]]                                                       
                                                                                
                          |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.004 seconds.
   
   > select array_prepend(arrow_cast(make_array(1), 'FixedSizeList(1, Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'List(FixedSizeList(1, Int64))'));
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | array_prepend(arrow_cast(make_array(Int64(1)),Utf8("FixedSizeList(1, 
Int64)")),arrow_cast(make_array(make_array(Int64(2)),make_array(Int64(3)),make_array(Int64(4))),Utf8("List(FixedSizeList(1,
 Int64))"))) |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | [[1], [2], [3], [4]]                                                       
                                                                                
                                                  |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.005 seconds.
   
   > select array_prepend(arrow_cast(make_array(1), 'FixedSizeList(1, Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'FixedSizeList(3, FixedSizeList(1, Int64))'));
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | array_prepend(arrow_cast(make_array(Int64(1)),Utf8("FixedSizeList(1, 
Int64)")),arrow_cast(make_array(make_array(Int64(2)),make_array(Int64(3)),make_array(Int64(4))),Utf8("FixedSizeList(3,
 FixedSizeList(1, Int64))"))) |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | [[1], [2], [3], [4]]                                                       
                                                                                
                                                              |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.004 seconds.
   
   > select array_prepend(arrow_cast(make_array(1), 'List(Int64)'), 
arrow_cast(make_array(make_array(2), make_array(3), make_array(4)), 
'FixedSizeList(3, List(Int64))'));
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 
array_prepend(arrow_cast(make_array(Int64(1)),Utf8("List(Int64)")),arrow_cast(make_array(make_array(Int64(2)),make_array(Int64(3)),make_array(Int64(4))),Utf8("FixedSizeList(3,
 List(Int64))"))) |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | [[1], [2], [3], [4]]                                                       
                                                                                
                                      |
   
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   1 row(s) fetched. 
   Elapsed 0.004 seconds.
   
   
   ```
   
   ### Expected behavior
   
   The expected behavior is that the function always returns `[[1], [2], [3], 
[4]]`.
   
   ### Additional context
   
   _No response_


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to