You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Zoltán Borók-Nagy (JIRA)" <ji...@apache.org> on 2018/04/12 14:53:00 UTC

[jira] [Created] (IMPALA-6840) Applying De Morgan's laws can invalidate query statement

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:
{noformat}
SELECT *
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:
{noformat}
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
(v7.6.3#76005)