gpt4 book ai didi

hadoop - 如何在配置单元中获取复杂数据类型列的长度

转载 作者:可可西里 更新时间:2023-11-01 14:25:30 25 4
gpt4 key购买 nike

我有一个配置单元表包含 arraymap 类型的列,我想过滤记录,其中 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com