如何在hive中获取复杂数据类型列的长度

时间:2017-05-17 23:41:26

标签: hadoop hive apache-spark-sql

我有一个hive表包含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

1 个答案:

答案 0 :(得分:6)

<script>
    var totalItems = $('.item').length;
    var currentIndex = $('div.active').index() + 1;
    $('.num').html(''+currentIndex+'/'+totalItems+'');

    $('.work_carousel').carousel({
        interval: 2000
    });

    $('.work_carousel').on('slide.bs.carousel', function() {
        currentIndex = $('div.active').index() + 1;

         if(currentIndex >= 2){

      $('#work_property').attr("id")="newid";

       }
    });
</script>

演示

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
;