hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Subramanian, Sanjay (HQP)" <sanjay.subraman...@roberthalf.com>
Subject Finding Max of a column without using any Aggregation functions
Date Wed, 23 Apr 2014 01:27:39 GMT
Hey guys

TABLE=STUDENT
COLUMN=SCORE

U want to find the max value in the column without using any aggregation functions.

Its easy in a RDB context but I was trying to get a solution in Hive (clearly I have some
spare time on my hands - LOL)

select
     nfr.score
from
     student nfr
left outer join
     (select
          a.score as fra,
          b.score as frb
     from
          (select
               '1' as dummy,
               score
          from
               student
          ) a

     join
          (select
               '1' as dummy,
               score
          from
               student
          ) b
     ON
          a.dummy = b.dummy
     where
          a.score < b.score
     ) frab
on
     frab.fra=nfr.score
where
     frab.fra is null

Thanks
Warm Regards

Sanjay


Mime
View raw message