Skip to content
Advertisement

Hive: less than operator error in subquery

I want the latest records from HIVE table using the following query-

this query is throwing a error as

I have tried running with equal operator in place of the less than operator in subquery and it is running fine. I read the HIVE documentation as given in https://cwiki.apache.org/confluence/display/Hive/LanguageManual+SubQueries and couldn’t figure out why it is throwing a error as ‘where’ subquery is supported. What might be the problem here?

Advertisement

Answer

EXISTS works the same as a join actually. Not equality join conditions are not supported in Hive prior Hive 2.2.0 (see HIVE-15211, HIVE-15251)

It seems you are trying to get records having latest timestamp per Rel_Lot,SerialNum,Test_Stage. Your query can be rewritten using dense_rank() or rank() function:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement