I'm converting a SQL Server stored procedure to HiveQL.
How can I convert something like:
SELECT * FROM table1 WHERE id NOT IN (7,6,5,4,2,12)
I'm converting a SQL Server stored procedure to HiveQL.
How can I convert something like:
SELECT * FROM table1 WHERE id NOT IN (7,6,5,4,2,12)
NOT IN is now supported in Hive. See https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF.
Try this:
SELECT * FROM table1 WHERE NOT array_contains(array(7,6,5,4,2,12), id)
According to the documentation it says you can use not in
:
The negated forms can be written as follows:
from DomesticCat cat where cat.name not between 'A' and 'B'
from DomesticCat cat where cat.name not in ( 'Foo', 'Bar', 'Baz' )
Are you getting an error when you try your query in the question?
Please try based on the references as well.