我有一个 Package 数组,当我用横向视图explode查询时,只想得到相应的值结构。
样本结构:
列名:thearray
WrappedArray([null,theVal,valTags,[123,null,null,null,null,null],false], [null,theVar,varTags,[abc,null,null,null,null,null],false])
架构是
array<struct<id:string,name:string,type:string,value:struct<member0:string,member1:bigint,member2:int,member3:double,member4:float,member5:boolean>,shouldIndex:boolean>>
我的问题:
SELECT DISTINCT theName, allValues
FROM table
LATERAL VIEW EXPLODE(column.name) theTab1 AS theName
LATERAL VIEW EXPLODE(column.value.member0) theTab2 AS allValues
WHERE theName = 'theVal'
我的结果:
___________________________
|**theName**|**allValues**|
___________________________
|theVal | 123 |
___________________________
| theVal | abc |
___________________________
我需要:
___________________________
|**theName**|**allValues**|
___________________________
|theVal | 123 |
___________________________
如何修复我的查询以获得上述结果?
1条答案
按热度按时间eeq64g8w1#
不需要在结构顶部进行额外的爆炸。你应该可以这样做