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

   ### Is your feature request related to a problem or challenge?
   
   These sql are not supported
   ```
   ##recursive unnest(list->list)
   query ?
   select * from unnest(unnest(
       [[1,2,3],[4,5,6]],
   ));
   ----
   1
   2
   3
   4
   5
   6
   
   ##recursive unnest(list->struct_field_access->list)
   query ?
   select * from unnest(unnest(
       [struct([1,2,3]),struct([4,5,6])]
   )['c0']);
   ----
   {c0: [1,2,3]}
   
   ##recursive unnest(list->struct)
   query ?
   select * from unnest(unnest(
       [struct([1,2,3],[4,5,6]),struct([7,8,9],[10,11,12])]
   ));
   ----
   [1,2,3] [4,5,6]
   [7,8,9] [10,11,12]
   ```
   
   If an unnest expr is a descendant of another unnest expr, this error will be 
thrown:
   ```
   This feature is not implemented: Unnest should be rewritten to 
LogicalPlan::Unnest before type coercion
   ```
   
   ### Describe the solution you'd like
   
   1. Support nested unnest expr by solving the above error. 
   2. Can we support a syntax similar duckdb: along with unnest, there is an 
option to specify recursion level
   ```
   D select unnest([[1,2,3],[4,5,6]], max_depth:=2);
   
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
   │ unnest(main.list_value(main.list_value(1, 2, 3), main.list_value(4, 5, 
6)), max_depth := 2) │
   │                                            int32                           
                 │
   
├─────────────────────────────────────────────────────────────────────────────────────────────┤
   │                                                                            
               1 │
   │                                                                            
               2 │
   │                                                                            
               3 │
   │                                                                            
               4 │
   │                                                                            
               5 │
   │                                                                            
               6 │
   
└─────────────────────────────────────────────────────────────────────────────────────────────┘
   ```
   
   ### 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