Impala may return incorrect results for queries that have the following properties:
- There is an INNER JOIN following a series of OUTER JOINs
- The INNER JOIN has an On-clause with a predicate that references at least two tables that are on the nullable side of the preceding OUTER JOINs
Query to repro and its plan:
For some queries, this problem can be worked around by placing the problematic On-clause predicate in the WHERE clause instead, or changing the preceding OUTER JOINS to INNER JOINS (if the On-clause predicate would discard NULLs).
To fix the example query above: