028.hive-sort_arry实现字段横向比较,并取出最大值


hive-sort_arry实现字段横向比较,并取出最大值

先把多字段组成数组,再数组排序,取出最后一个即为最大值
sort_array(array(nvl(is_receive_recharge,
0),nvl(is_receive_coupon,0),nvl(is_receive_points,0),nvl(mess_tag,0)))[3]

相关