我有一个配置单元表包含 array
和 map
类型的列,我想过滤记录,其中 array/map 列包含超过 N 元素,该怎么做?
DDL:
create table test (id string, v1 array<int>, v2 map<string,string>)
查询:
select * from test where length(v1)>10 or length(v2)>10
最佳答案
select * from test where size(v1)>10 or size(v2)>10
演示
create table test (id string, v1 array<int>, v2 map<string,string>);
insert into test select 1,array(1,2,3,4,5),map('K1','V1','K2','V2','K3','V3');
select size(v1),size(v2)
from test
;
+----+----+
| c0 | c1 |
+----+----+
| 5 | 3 |
+----+----+
关于hadoop - 如何在配置单元中获取复杂数据类型列的长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44036382/