What is an Operators in Hive?
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
There are four types of operators in Hive:
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
Arithmetic Operators in Hive
Operator |
Operand |
Description |
A = B |
all primitive types |
TRUE if expression A is equivalent to expression B otherwise FALSE. |
A != B |
all primitive types |
TRUE if expression A is not equivalent to expression B otherwise FALSE. |
A < B |
all primitive types |
TRUE if expression A is less than expression B otherwise FALSE. |
A <= B |
all primitive types |
TRUE if expression A is less than or equal to expression B otherwise FALSE. |
A > B |
all primitive types |
TRUE if expression A is greater than expression B otherwise FALSE. |
A >= B |
all primitive types |
TRUE if expression A is greater than or equal to expression B otherwise FALSE. |
A IS NULL |
all types |
TRUE if expression A evaluates to NULL otherwise FALSE. |
A IS NOT NULL |
all types |
FALSE if expression A evaluates to NULL otherwise TRUE. |
A LIKE B |
Strings |
TRUE if string pattern A matches to B otherwise FALSE. |
A RLIKE B |
Strings |
NULL if A or B is NULL, TRUE if any substring of A matches the Java regular expression B , otherwise FALSE. |
A REGEXP B |
Strings |
Same as RLIKE. |
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
Result:
Relational Operators in Hive:
Operators |
Operand |
Description |
A + B |
all number types |
Gives the result of adding A and B. |
A - B |
all number types |
Gives the result of subtracting B from A. |
A * B |
all number types |
Gives the result of multiplying A and B. |
A / B |
all number types |
Gives the result of dividing B from A. |
A % B |
all number types |
Gives the reminder resulting from dividing A by B. |
A & B |
all number types |
Gives the result of bitwise AND of A and B. |
A | B |
all number types |
Gives the result of bitwise OR of A and B. |
A ^ B |
all number types |
Gives the result of bitwise XOR of A and B. |
~A |
all number types |
Gives the result of bitwise NOT of A. |
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
Example
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
Output
apache hive related article tags - hive tutorial - hadoop hive - hadoop hive - hiveql - hive hadoop - learnhive - hive sql
Example