hive hql比较case语句中的值

时间:2018-06-08 14:45:53

标签: hive hiveql

我有一个查询,我试图比较一个case语句中的值,如果它较少保留值,如果它的less少使其为null。我收到了错误

 SemanticException [Error 10128]:  Not yet supported place for UDAF 'max'

select mt.column1,   
min (case
    when mt2.number = 1  then mt.column2 end) as first_column,
max (case
    when mt2.number = 1  then mt.column2 end) as first_column_max,
min (case
    when mt2.number = 2 then mt.column2 end) as second_column,
max (case
    when mt2.number = 2 then mt.column2 end) as second_column_max,
min (case
    when mt2.number = 3 and mt.column2 > max (case
    when mt2.number = 1  then mt.column2 end) and  mt.column2 > 
       max (case
    when mt2.number = 2 then mt.column2 end) then mt.column2 else '' end) as third_column 
from mytable2 mt2

0 个答案:

没有答案