Presto Unnest Array Inside Array

拥有回忆 提交于 2021-01-29 09:44:51

问题


I have following query running on Big query and it's working fine:

select 
item_detail.location.zone, 
count(*)
FROM table t
CROSS JOIN UNNEST(items) as item_detail
group by 1;

But when i running the same query in Presto it's giving me an error it's because my items structure is like this Arrays of Arrays so i modified my query like this:

SELECT location.zone
FROM table 
CROSS JOIN UNNEST(items) as t(item,  quantity,location);

But it's throwing me this error:

Presto error: Unhandled type for Block:

array(row("item" row("departmentNumber" bigint,"itemNumber" bigint,"shelfCapacity" row("qty" double,"precision" bigint)),



 "quantity" row("qty" double,"precision" bigint),



 "location" row("zone" varchar,"aisle" bigint)))

As you can see for item is having an array shelfCapacity inside it, how to unnest this type of array where you have array inside array

来源:https://stackoverflow.com/questions/62084520/presto-unnest-array-inside-array

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!