Amazon dynamodb 在雅典娜爆炸一个阵列

Amazon dynamodb 在雅典娜爆炸一个阵列,amazon-dynamodb,amazon-athena,presto,Amazon Dynamodb,Amazon Athena,Presto,我在雅典娜有一个简单的表,它有一个事件数组。我想编写一个简单的select语句,以便数组中的每个事件都成为一行 我试过爆炸,变形,但没有成功。我已经在Spark和Hive中成功地完成了这项工作。但这个雅典娜在骗我。请告知 DROP TABLE bi_data_lake.royalty_v4; CREATE external TABLE bi_data_lake.royalty_v4 ( KAFKA_ID string, KAFKA_TS string, deviceUser s

我在雅典娜有一个简单的表,它有一个事件数组。我想编写一个简单的select语句,以便数组中的每个事件都成为一行

我试过爆炸,变形,但没有成功。我已经在Spark和Hive中成功地完成了这项工作。但这个雅典娜在骗我。请告知

DROP TABLE bi_data_lake.royalty_v4;
CREATE external TABLE bi_data_lake.royalty_v4 (
   KAFKA_ID string,
   KAFKA_TS string,
   deviceUser struct< deviceName:string, devicePlatform:string >,
   consumeReportingEvents array<
                                struct<
                                        consumeEvent: string,
                                        consumeEventAction: string,
                                        entryDateTime: string
                                      >
                               >
   )
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 's3://XXXXXXXXXXX';
不支持 横向视图将ConsumerReportingEvents分解为ConsumerReportingEvent

使用unnset的问题答案

找到了我问题的答案

WITH samples AS (
 select kafka_id, kafka_ts,deviceuser, consumereportingevent, consumereportingeventPos
 from bi_data_lake.royalty_v4 
 cross join unnest(consumereportingevents)  WITH ORDINALITY AS T (consumereportingevent, consumereportingeventPos)
 where kafka_id = 'events-consumption-0-490565' or kafka_id = 'events-consumption-0-490566'
)
SELECT * FROM samples

使用UNNEST展平AWS Athena中的“爆炸”嵌套数组

将数据集作为 选择 “工程”作为一个部门, 数组['Sharon','John','Bob','Sally']作为用户 从数据集中选择部门名称 将不感兴趣的用户交叉连接为tnames
参考资料:

问题的确切含义是什么?文档在本页底部解释了如何做到这一点:您能否发布示例数据以及您希望从查询中获得的一些示例输出?问题的答案是使用UNNEST。更新question@mindatsleep这个问题已经自我回答了
WITH samples AS (
 select kafka_id, kafka_ts,deviceuser, consumereportingevent, consumereportingeventPos
 from bi_data_lake.royalty_v4 
 cross join unnest(consumereportingevents)  WITH ORDINALITY AS T (consumereportingevent, consumereportingeventPos)
 where kafka_id = 'events-consumption-0-490565' or kafka_id = 'events-consumption-0-490566'
)
SELECT * FROM samples