Details
-
Improvement
-
Status: Open
-
Trivial
-
Resolution: Unresolved
-
Impala 3.0
-
None
-
None
-
ghx-label-9
Description
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:
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()); }
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:
... WHERE count(id) OVER (PARTITION BY id)
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.