I have below Hive query and its not giving me "equals" as output. Why?
hive> select case when (NULL=NULL) then "equals" else "not equals" end as value; OK not equals
@Gnanasekaran G Use the following ( <=>) operator instead of (=) operator
SELECT CASE WHEN (NULL<=>NULL) THEN "equals" ELSE "not equals" end AS value;
(NULL=NULL) is neither true nor false it will evaluate to NULL/UNKNOWN. (reference https://www.simple-talk.com/sql/learn-sql-server/sql-and-the-snare-of-three-valued-logic/)
As pointed by @Murali Ramasami above you should use <=> operator if you would like null=null evaluate to true.