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

   ### Is your feature request related to a problem or challenge?
   
   To create a table with fixed size list, we can only do it by casting
   ```
   statement ok
   CREATE TABLE fixed_size_arrays
   AS VALUES
     (arrow_cast(make_array(make_array(NULL, 2),make_array(3, NULL)), 
'FixedSizeList(2, List(Int64))'), arrow_cast(make_array(1.1, 2.2, 3.3), 
'FixedSizeList(3, Float64)'), arrow_cast(make_array('L', 'o', 'r', 'e', 'm'), 
'FixedSizeList(5, Utf8)')),
     (arrow_cast(make_array(make_array(3, 4),make_array(5, 6)), 
'FixedSizeList(2, List(Int64))'), arrow_cast(make_array(NULL, 5.5, 6.6), 
'FixedSizeList(3, Float64)'), arrow_cast(make_array('i', 'p', NULL, 'u', 'm'), 
'FixedSizeList(5, Utf8)')),
     (arrow_cast(make_array(make_array(5, 6),make_array(7, 8)), 
'FixedSizeList(2, List(Int64))'), arrow_cast(make_array(7.7, 8.8, 9.9), 
'FixedSizeList(3, Float64)'), arrow_cast(make_array('d', NULL, 'l', 'o', 'r'), 
'FixedSizeList(5, Utf8)')),
     (arrow_cast(make_array(make_array(7, NULL),make_array(9, 10)), 
'FixedSizeList(2, List(Int64))'), arrow_cast(make_array(10.1, NULL, 12.2), 
'FixedSizeList(3, Float64)'), arrow_cast(make_array('s', 'i', 't', 'a', 'b'), 
'FixedSizeList(5, Utf8)')),
     (NULL, arrow_cast(make_array(13.3, 14.4, 15.5), 'FixedSizeList(3, 
Float64)'), arrow_cast(make_array('a', 'm', 'e', 't', 'x'), 'FixedSizeList(5, 
Utf8)')),
     (arrow_cast(make_array(make_array(11, 12),make_array(13, 14)), 
'FixedSizeList(2, List(Int64))'), NULL, 
arrow_cast(make_array(',','a','b','c','d'), 'FixedSizeList(5, Utf8)')),
     (arrow_cast(make_array(make_array(15, 16),make_array(NULL, 18)), 
'FixedSizeList(2, List(Int64))'), arrow_cast(make_array(16.6, 17.7, 18.8), 
'FixedSizeList(3, Float64)'), NULL)
   ;
   ```
   
   In DuckDB, they has syntax like `<type name> [<length>]`, which I think is 
quite nice
   ```
   CREATE TABLE array_table (id INTEGER, arr INTEGER[3]);
   INSERT INTO array_table VALUES (10, [1, 2, 3]), (20, [4, 5, 6]);
   ```
   
   We need to fix the parser first
   ```
   query error DataFusion error: SQL error: ParserError\("Expected \], found: 
3"\)
   create table t1 (a int[3]) as values ([1, 2, 3]), ([4, 5, 6]);
   ```
   
   ### Describe the solution you'd like
   
   Expect result
   ```
   query
   create table t1 (a int[3]) as values ([1, 2, 3]), ([4, 5, 6]);
   ----
   [1,2,3]
   [4,5,6]
   
   with type FixedSizeList(i64)
   ```
   
   ### Describe alternatives you've considered
   
   _No response_
   
   ### 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