选择配置单元中column>percentile(column,0.5)所在的行

zd287kbt  于 2021-06-25  发布在  Hive
关注(0)|答案(0)|浏览(178)

我想选择某些列的值(比如a)大于其p50的行。所以我在hive中编写了如下sql:

set hive.mapred.mode=nonstrict;
with temp_table as (
    select percentile(A, 0.5) as p50
    from my_table
)
select 
    my_table.A
    from my_table, temp_table
    where my_table.A > temp_table.p50

但这个过程是悬而未决的。sql是否正确?还是有更好的方法来完成这个任务?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题