Thomas Tauber-Marshall has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/5631

Change subject: IMPALA-4716: Expr rewrite causes IllegalStateException
......................................................................

IMPALA-4716: Expr rewrite causes IllegalStateException

THe problem here is that the DECODE constructor in CaseExpr uses the
same decodeExpr object when building the BinaryPredicates that compare
the decodeExpr to each 'when' of the DECODE. This results in the
decodeExpr being cast for each BinaryPredicate, potentially making its
type incompatible with an earlier BinaryPredicate when it's cast for
a later BinaryPredicate, and leading to a Precondition check failure
in BinaryPredicate.toThrift.

This wasn't a problem prior to expr rewrites being introduced because
toThift was never called on the original BinaryPredicate objects that
shared the same child, only on exprs that had been cloned and reanalyzed
and so no longer shared the same child object. This is no longer the
case with expr rewrites turned on, as FoldConstantRule calls toThrift
to send the expr to the backend for evaluation.

The solution is to clone the decodeExpr in the DECODE constructor in
CaseExpr for each generated BinaryPredicate.

Testing:
- Added a regression test to RewriteExprRulesTest.

Change-Id: I4de9ed7118c8d18ec3f02ff74c9cca211c716e51
---
M fe/src/main/java/org/apache/impala/analysis/CaseExpr.java
M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
2 files changed, 9 insertions(+), 1 deletion(-)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4de9ed7118c8d18ec3f02ff74c9cca211c716e51
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Thomas Tauber-Marshall <[email protected]>

Reply via email to