將給定的STRUCT數組展開。每個數組元素對應一行,每行每個STRUCT元素對應一列。
命令格式
inline(array<struct<f1:T1, f2:T2[, ...]>>)參數說明
f1:T1、f2:T2:必填。可以為任意類型。f1、f2代表成員變數,T1、T2分別代表成員變數f1、f2的取值。
傳回值說明
返回STRUCT數組展開的資料。
使用樣本
例如表t_table的欄位為t_struct struct<user_id:bigint,user_name:string,married:string,weight:double>,包含資料如下:
+----------+
| t_struct |
+----------+
| {user_id:10001, user_name:LiLei, married:N, weight:63.5} |
| {user_id:10002, user_name:HanMeiMei, married:Y, weight:43.5} |
+----------+命令樣本如下。
--將t_struct列展開。
select inline(array(t_struct)) from t_table;
--返回結果如下。
+------------+-----------+---------+------------+
| user_id | user_name | married | weight |
+------------+-----------+---------+------------+
| 10001 | LiLei | N | 63.5 |
| 10002 | HanMeiMei | Y | 43.5 |
+------------+-----------+---------+------------+相關函數
INLINE函數屬於複雜類型函數,更多對複雜類型資料(例如ARRAY、MAP、STRUCT、JSON資料)的處理函數請參見複雜類型函數。