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/10/25 03:26:00 UTC

[jira] [Created] (IMPALA-7754) Expressions sometimes not re-analyzed after rewrite

Paul Rogers created IMPALA-7754:
-----------------------------------

             Summary: Expressions sometimes not re-analyzed after rewrite
                 Key: IMPALA-7754
                 URL: https://issues.apache.org/jira/browse/IMPALA-7754
             Project: IMPALA
          Issue Type: Bug
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


The analyzer has a chain of rules which fire in order without (as noted above) repeats. The result of rule A (rewriting conditional functions) is fed into rule B (simplify CASE). Each rule requires that analysis be done so that attributes of expressions can be picked out.

As it turns out, in the current code, this is rather ad-hoc. The {{SimplifyConditionalsRule}} re-analyzes its result as part of the fix for IMPALA-5125, but others do not, leading to optimizations not working. In particular, in a chain of rewrites for {{IS DISTINCT FROM}}, certain rules didn't fire because previous rules left new expressions in an un-analyzed state. This is a bug.

The fix is to analyze the result any time a rule fires, before passing the result to the next rule.Then, in rules that simply refused to run if an expression is to analyzed:

{code:java}
public class SimplifyDistinctFromRule implements ExprRewriteRule {
  public Expr apply(Expr expr, Analyzer analyzer) {
    if (!expr.isAnalyzed()) return expr;
{code}

Replace this with an assertion that analysis must have been done:

{code:java}
public class SimplifyDistinctFromRule implements ExprRewriteRule {
  public Expr apply(Expr expr, Analyzer analyzer) {
    assert expr.isAnalyzed();
{code}

To be safe, the assertion fires only in "debug" mode, not in production.



--
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