Zoltán Borók-Nagy created IMPALA-6840:

             Summary: Applying De Morgan's laws can invalidate query statement
                 Key: IMPALA-6840
                 URL: https://issues.apache.org/jira/browse/IMPALA-6840
             Project: IMPALA
          Issue Type: Improvement
            Reporter: Zoltán Borók-Nagy

Given the following query:
FROM functional.alltypes
WHERE NOT (id < 10 AND
           (int_col IN (SELECT int_col
                        FROM functional.alltypestiny)) AND
           (string_col = (SELECT max(string_col)
                          FROM functional.alltypestiny))){noformat}
We get the following error message:
ERROR: AnalysisException: Subqueries in OR predicates are not supported: id >= 
10 OR int_col NOT IN (SELECT int_col FROM functional.alltypestiny) OR 
string_col != (SELECT max(string_col) FROM functional.alltypestiny){noformat}
Which is strange, because we only have AND predicates in our statement.

When Impala rewrites the query it applies De Morgan's laws, so it pushes the 
NOT predicate into the conditions and turns the AND predicates to ORs. And 
that's invalidates our query statement, because subqueries in OR predicates are 
not allowed.


This message was sent by Atlassian JIRA

Reply via email to