You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/13 19:40:00 UTC

[jira] [Created] (IMPALA-7846) Analyzer expression error checks done in wrong order

Paul Rogers created IMPALA-7846:
-----------------------------------

             Summary: Analyzer expression error checks done in wrong order
                 Key: IMPALA-7846
                 URL: https://issues.apache.org/jira/browse/IMPALA-7846
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


The analyzer does thorough checks of expressions in various clauses of a query to exclude those expressions types which are not supported in that context. In general, when there is more than one check, we should do the most specific first to give the user the most specific error message possible. For example, consider the [check for WHERE clause expressions|https://github.com/apache/impala/blob/master/fe/src/main/java/org/apache/impala/analysis/SelectStmt.java#L316]:

{code:java}
        whereClause_.checkReturnsBool("WHERE clause", false);
        Expr e = whereClause_.findFirstOf(AnalyticExpr.class);
        if (e != null) {
          throw new AnalysisException(
              "WHERE clause must not contain analytic expressions: " + e.toSql());
        }
{code}

In the above, we first check that the expression is Boolean. Later we check for analytic expressions. As a result, a {{WHERE}} clause with just an analytic expression gets the Boolean error. For example:

{code:sql}
...
WHERE count(id) OVER (PARTITION BY id)
{code}

Though a minor point, the general rule should be to do the most specific checks first, so that the above gets an error about analytic functions rather than that the expression is not Boolean.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org