web | Java

Hive分析函数:Ntile

千锋教育

效果:

排序并分桶 ntile(3) over(partition by A order by B) => {1,2,3}->1,{4,5,6}->2,{7,8,9}->3 可用于取前50%数据统计、取中间三分之一统计等需求。