Reputation: 33
I accidentally used ==
instead of =
in one of my HQL query, but shockingly it didn't throw any error but was working as it should have been working for =
. My question here is why do we have ==
operator in HQL and what is the exact difference between the two.
Upvotes: 2
Views: 3737
Reputation: 44981
The=
and ==
operators have the same functionality.
They are implemented by the exact same class.
system.registerGenericUDF("=", GenericUDFOPEqual.class);
system.registerGenericUDF("==", GenericUDFOPEqual.class);
+----------+---------------------+----------------------------------------------------------------+
| Operator | Operand types | Description |
+----------+---------------------+----------------------------------------------------------------+
| A = B | All primitive types | TRUE if expression A is equal to expression B otherwise FALSE. |
| A == B | All primitive types | Synonym for the = operator. |
+----------+---------------------+----------------------------------------------------------------+
Upvotes: 10