@@ -1606,6 +1606,47 @@ trim_array(array, n)
1606
1606
Can be a constant, column, or function, and any combination of array operators.
1607
1607
- ** n** : Element to trim the array.
1608
1608
1609
+ ## Struct Functions
1610
+
1611
+ - [ struct] ( #struct )
1612
+
1613
+ ### ` struct `
1614
+
1615
+ Returns an Arrow struct using the specified input expressions.
1616
+ Fields in the returned struct use the ` cN ` naming convention.
1617
+ For example: ` c0 ` , ` c1 ` , ` c2 ` , etc.
1618
+
1619
+ ```
1620
+ struct(expression1[, ..., expression_n])
1621
+ ```
1622
+
1623
+ For example, this query converts two columns ` a ` and ` b ` to a single column with
1624
+ a struct type of fields ` c0 ` and ` c1 ` :
1625
+
1626
+ ``` sql
1627
+ ❯ select * from t;
1628
+ + -- -+---+
1629
+ | a | b |
1630
+ + -- -+---+
1631
+ | 1 | 2 |
1632
+ | 3 | 4 |
1633
+ + -- -+---+
1634
+
1635
+ ❯ select struct(a, b) from t;
1636
+ + -- ---------------+
1637
+ | struct(t .a ,t .b ) |
1638
+ + -- ---------------+
1639
+ | {c0: 1 , c1: 2 } |
1640
+ | {c0: 3 , c1: 4 } |
1641
+ + -- ---------------+
1642
+ ```
1643
+
1644
+ #### Arguments
1645
+
1646
+ - ** expression_n** : Expression to include in the output struct.
1647
+ Can be a constant, column, or function, and any combination of arithmetic or
1648
+ string operators.
1649
+
1609
1650
## Hashing Functions
1610
1651
1611
1652
- [ digest] ( #digest )
@@ -1708,7 +1749,6 @@ sha512(expression)
1708
1749
1709
1750
- [ arrow_cast] ( #arrow_cast )
1710
1751
- [ arrow_typeof] ( #arrow_typeof )
1711
- - [ struct] ( #struct )
1712
1752
1713
1753
### ` arrow_cast `
1714
1754
@@ -1739,19 +1779,3 @@ arrow_typeof(expression)
1739
1779
- ** expression** : Expression to evaluate.
1740
1780
Can be a constant, column, or function, and any combination of arithmetic or
1741
1781
string operators.
1742
-
1743
- ### ` struct `
1744
-
1745
- Returns an Arrow struct using the specified input expressions.
1746
- Fields in the returned struct use the ` cN ` naming convention.
1747
- For example: ` c0 ` , ` c1 ` , ` c2 ` , etc.
1748
-
1749
- ```
1750
- struct(expression1[, ..., expression_n])
1751
- ```
1752
-
1753
- #### Arguments
1754
-
1755
- - ** expression_n** : Expression to include in the output struct.
1756
- Can be a constant, column, or function, and any combination of arithmetic or
1757
- string operators.
0 commit comments