jonahgao opened a new pull request, #9342:
URL: https://github.com/apache/arrow-datafusion/pull/9342

   ## Which issue does this PR close?
   Found in 
https://github.com/apache/arrow-datafusion/discussions/9315#discussioncomment-8562638
   
   `unnest(make_array(1,2))` is supported, but `unnest(range(1,3))` is not 
supported.
   
   ```sh
   DataFusion CLI v36.0.0
   ❯ select unnest(make_array(1,2));
   +-------------------------------+
   | make_array(Int64(1),Int64(2)) |
   +-------------------------------+
   | 1                             |
   | 2                             |
   +-------------------------------+
   2 rows in set. Query took 0.008 seconds.
   
   ❯ select unnest(range(1,3));
   Error during planning: unnest() can only be applied to array and structs and 
null
   ```
   These are all supported in DuckDB.
   ## Rationale for this change
   If I understand correctly, `unnest` should support any expression with a 
return type of Array, not just the `make_array` function and column expressions.
   
   ## What changes are included in this PR?
   The `unnest` function can accept any array expression, which is ensured by 
checking the return type of the argument.
   Previously, it only supported the `make_array` function and column 
expressions.
   
   ## Are these changes tested?
   
   Yes.  New tests and existing tests.
   
   ## Are there any user-facing changes?
   No
   


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