Impala Public Jenkins has submitted this change and it was merged. ( 
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 enter infinite loop.

This patch fixes 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
Reviewed-on: http://gerrit.cloudera.org:8080/20982
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
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(-)

Approvals:
  Impala Public Jenkins: Looks good to me, approved; Verified

--
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: merged
Gerrit-Change-Id: Iaea1b3a35967f92b3e4f3445a378ed58adaa7da5
Gerrit-Change-Number: 20982
Gerrit-PatchSet: 5
Gerrit-Owner: Wenzhe Zhou <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>

Reply via email to