alamb commented on code in PR #10839:
URL: https://github.com/apache/datafusion/pull/10839#discussion_r1634016011


##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -3346,6 +3347,30 @@ trim_array(array, n)
   Can be a constant, column, or function, and any combination of array 
operators.
 - **n**: Element to trim the array.
 
+### `unnest`
+
+Transforms an array into rows.
+
+#### Arguments
+
+- **array**: Array expression to unnest.
+  Can be a constant, column, or function, and any combination of array 
operators.
+
+#### Example
+
+```
+> select unnest(make_array(1, 2, 3, 4, 5));
++------------------------------------------------------------------+
+| unnest(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) |
++------------------------------------------------------------------+
+| 1                                                                |
+| 2                                                                |
+| 3                                                                |
+| 4                                                                |
+| 5                                                                |
++------------------------------------------------------------------+
+```
+

Review Comment:
   > Yeah, sure. This should be in Struct Functions right?
   
   I think that would make sense.
   
   
   FWIW here is the example:
   
   ```sql
   DataFusion CLI v39.0.0
   > select unnest(range(0, 10));
   +-----------------------------------+
   | unnest(range(Int64(0),Int64(10))) |
   +-----------------------------------+
   | 0                                 |
   | 1                                 |
   | 2                                 |
   | 3                                 |
   | 4                                 |
   | 5                                 |
   | 6                                 |
   | 7                                 |
   | 8                                 |
   | 9                                 |
   +-----------------------------------+
   10 row(s) fetched.
   Elapsed 0.054 seconds.
   ```
   



##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -3346,6 +3347,30 @@ trim_array(array, n)
   Can be a constant, column, or function, and any combination of array 
operators.
 - **n**: Element to trim the array.
 
+### `unnest`
+
+Transforms an array into rows.
+
+#### Arguments
+
+- **array**: Array expression to unnest.
+  Can be a constant, column, or function, and any combination of array 
operators.
+
+#### Example
+
+```
+> select unnest(make_array(1, 2, 3, 4, 5));
++------------------------------------------------------------------+
+| unnest(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) |
++------------------------------------------------------------------+
+| 1                                                                |
+| 2                                                                |
+| 3                                                                |
+| 4                                                                |
+| 5                                                                |
++------------------------------------------------------------------+
+```
+

Review Comment:
   > Yeah, sure. This should be in Struct Functions right?
   
   I think that would make sense.
   
   
   FWIW here is an example:
   
   ```sql
   DataFusion CLI v39.0.0
   > select unnest(range(0, 10));
   +-----------------------------------+
   | unnest(range(Int64(0),Int64(10))) |
   +-----------------------------------+
   | 0                                 |
   | 1                                 |
   | 2                                 |
   | 3                                 |
   | 4                                 |
   | 5                                 |
   | 6                                 |
   | 7                                 |
   | 8                                 |
   | 9                                 |
   +-----------------------------------+
   10 row(s) fetched.
   Elapsed 0.054 seconds.
   ```
   



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to