Apache Hive Conditional Functions

The conditional functions available in the Apache Hive are as follows. The most of them are also available in Apache Impala. The behavior of the functions in both Apache Hive and Impala would not vary.


Conditional Statements in Apache Hive

The use of conditional statements is very frequent when it comes to data interpretation. Often data manipulation, too, relies on conditional statements. Operators such as equal (=), greater than (>), less than (<) or a combination of any two operators shall produce a TRUE or FALSE value based on whether the comparison between the operands

Continue reading

Checking the Condition Against Column Values – Hive

Similar to relational database systems like SQL Server, Oracle, MySQL, the CASE statement in Apache Hive verifies the conditions against the values of the columns. This is equal to the IF-THEN-ELSE statement where, if one of the conditions is true, it avoids checking the other conditions and returns the value defined in the THEN clause.

Continue reading

Apache Hive – ISNULL vs NVL

Unlike in relational database systems like SQL Server, the ISNULL function works in a different way in Apache Hive. In SQL Server, ISNULL(col1, 0) returns 0 if the col1 value is null. Same implementation will return the below error in Apache Hive. This is because the Apache Hive ISNULL function is a conditional assertion that

Continue reading

Handling NULL in Apache Impala

An significant part is the treatment of NULL values during data processing and reports. Sometimes it ends up with arithmetic overflow errors or null values if not done properly. There are lots of conditional functions in the Apache Impala that manage NULL values. ISNULL NVL IFNULL ZEROIFNULL The above mentioned four functions does almost the

Continue reading

An alternative to ISNULL() and NVL() functions in Hive

The NVL() function enables you to substitute null for a more relevant alternative in the query results. This function accepts two arguments. If the first argument is null, then it returns the second argument. If the first argument is not null, it returns the first one and will ignore the second argument. This function is

Continue reading

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s