Is there a Hive equivalent of SQL "not like"

CMaury picture CMaury · Apr 11, 2011 · Viewed 60.4k times · Source

While Hive supports positive like queries: ex.

select * from table_name where column_name like 'root~%';

Hive Does not support negative like queries: ex.

select * from table_name where column_name not like 'root~%';

Does anyone know an equivalent solution that Hive does support?

Answer

HAL9000 picture HAL9000 · Apr 14, 2011

Try this:

Where Not (Col_Name like '%whatever%')

also works with rlike:

Where Not (Col_Name rlike '.*whatever.*')