[英]aws athena convert array<array<string>> to table
我有一個 s3 存儲桶,其中包含很多包含以下內容的文件:
{time:123456, state:{{1,2,3,4},{4,5,6,7}...}
在我使用 Athena 讀取它之后,結果是具有 2 個列的數據集:第一個是 time int
,第二個是array<array<string>>
,是否可以使用 athena sql 將此表轉換為:
select time, col1,col2,col3,col4
from table
當 col1...4 是數組中列的名稱時?
使用CROSS JOIN UNNEST 取消嵌套上層數組:
select a.time,
state_array[1] as col1,
state_array[2] as col2,
state_array[3] as col3,
state_array[4] as col4
from my_table a
CROSS JOIN UNNEST(state) as t(state_array)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.