Apache Tajo - Logical Operators
Logical operators work on Boolean operands and produce Boolean results. Let’s take a few examples to see how logical operators work in Tajo.
Query 1
default> select 3 < 2 and 4 > 1 as logical_and;
Result
The above query will generate the following output −
logical_and ------------------------------- false
The AND operator returns true only if both conditions are true; otherwise it returns false. Here, 4 > 1 condition is false. So, the “AND” operator returns false.
Query 2
default> select 3<2 or 4>1 as logical_or;
Result
The above query will generate the following output −
logical_or ------------------------------- true
Here, the first condition is true and the second condition is false. One condition is satisfied so the result is true.
Query 3
default> select 3 not in (1,2) as logical_not;
Result
The above query will generate the following output −
logical_not ------------------------------- true
3 is not in the given range. Therefore, the result is true.