In this article, we’ll look at how to use the built-in functions ISFALSE, ISTRUE, ISNOTFALSE, and ISNOTTRUE to generate true or false conditional statements in Apache Impala. Conditional functions are built-in operators for constructing boolean expressions, which are expressions that return true or false when evaluated. Such functions are beneficial for analyzing data to determine trends.
ISFALSE:
Returns TRUE if the expression is FALSE. Returns FALSE if the expression is TRUE or NULL. It is similar to ISNOTTRUE(), except it returns the opposite value for a NULL argument.
Example:
SELECT ISFALSE(1=2);
Returns: TRUE
ISTRUE:
Returns TRUE if the expression is TRUE. Returns FALSE if the expression is FALSE or NULL. Similar to ISNOTFALSE(), except it returns the opposite value for a NULL argument.
Example:
SELECT ISTRUE(1=2);
Retruns: FALSE
ISNOTFALSE:
Tests if a Boolean expression is not FALSE (that is, either TRUE or NULL). Returns TRUE if so. If the argument is NULL, returns TRUE. It is similar to ISTRUE(), except it returns the opposite value for a NULL argument.
Example:
SELECT ISNOTFALSE(1=2);
Retruns: FALSE
ISNOTTRUE:
Tests if a Boolean expression is not TRUE (that is, either FALSE or NULL). Returns TRUE if so. If the argument is NULL, returns TRUE. Similar to ISFALSE(), except it returns the opposite value for a NULL argument.
Example:
SELECT ISNOTTRUE(1=2);
Returns: TRUE
Please go through the “Assignments” provided in this blog for real-time scenarios.
I hope you found this post to be informative. Please provide feedback/suggestions to help us improve the blog.
2 comments