Jesse-Bakker commented on issue #7926:
URL: 
https://github.com/apache/arrow-datafusion/issues/7926#issuecomment-1825642666

   A valuable specialization for table-valued function is being able to use 
them as de-aggregating expressions, if the output is single-column. An example 
of this is, for example, the 
[`unnest`](https://www.postgresql.org/docs/16/functions-array.html#ARRAY-FUNCTIONS-TABLE)
 function in postgres. The first form takes a single argument and returns 
`setof anyelement` and can therefore be used in a select list to deaggregate:
   ```
   # select 1, unnest(ARRAY[1,2,3]);
    ?column? | unnest
   ----------+--------
           1 |      1
           1 |      2
           1 |      3
   ```
   
   The second form takes multiple arrays as arguments and returns records. 
Therefore, this form can only be used in table-factor position
   ```
   select * from unnest(array[1,2], array['a', 'b']);
    unnest | unnest
   --------+--------
         1 | a
         2 | b
   (2 rows)
   ```


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