Expands an ARRAY<STRUCT> into a table, with each array element becoming a row and each struct field becoming a column.
Syntax
inline(array<struct<f1:T1, f2:T2[, ...]>>)Parameters
f1:T1 and f2:T2: required. All data types are supported. f1 and f2 are the struct field names, T1 is the data type of f1, and T2 is the data type of f2. The [, ...] notation indicates that additional fields are allowed.
Return value
Returns the expanded data of the struct array.
Examples
The following example uses the t_table table, which has a t_struct field of type STRUCT<user_id:BIGINT, user_name:STRING, married:STRING, weight:DOUBLE>.
Sample data in t_table:
+----------+
| t_struct |
+----------+
| {user_id:10001, user_name:LiLei, married:N, weight:63.5} |
| {user_id:10002, user_name:HanMeiMei, married:Y, weight:43.5} |
+----------+Expand the t_struct column:
SELECT inline(array(t_struct)) FROM t_table;Result:
+------------+-----------+---------+------------+
| user_id | user_name | married | weight |
+------------+-----------+---------+------------+
| 10001 | LiLei | N | 63.5 |
| 10002 | HanMeiMei | Y | 43.5 |
+------------+-----------+---------+------------+Related functions
INLINE is a complex type function. For more information about functions that process ARRAY, MAP, STRUCT, and JSON data, see Complex type functions.