Wenzhe Zhou has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/20982


Change subject: IMPALA-12770: Fix infinite loop for nested Case expressions
......................................................................

IMPALA-12770: Fix infinite loop for nested Case expressions

ExprRewriter enter infinite loop when run following query with
nested Case expressions:

select
  case
    case ''
      when 'abc' then t4.string_col
    end
    when 'none' then 'Total'
  end
as fcol from functional.alltypes as t4 limit 1;

The 'case' expr is set as literal NULL expression for outer case
expression since all 'when' expr are false in inner case expression.
This causes function SimplifyConditionalsRule.simplifyCaseExpr() to
be called recusively and exter infinite loop.

This patch fixs the issue by not rewriting a case expression if 'case'
expr is literal NULL expression.

Testing:
 - Manually ran above query successfully.
 - Added new test cases in ExprRewriteRulesTest.testCaseWithExpr.
 - Passed core-tests.

Change-Id: Iaea1b3a35967f92b3e4f3445a378ed58adaa7da5
---
M fe/src/main/java/org/apache/impala/rewrite/SimplifyConditionalsRule.java
M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
2 files changed, 16 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/82/20982/1
--
To view, visit http://gerrit.cloudera.org:8080/20982
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaea1b3a35967f92b3e4f3445a378ed58adaa7da5
Gerrit-Change-Number: 20982
Gerrit-PatchSet: 1
Gerrit-Owner: Wenzhe Zhou <[email protected]>

Reply via email to