[
https://issues.apache.org/jira/browse/IMPALA-9693?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17093845#comment-17093845
]
ASF subversion and git services commented on IMPALA-9693:
---------------------------------------------------------
Commit 62080883feffbad4ff945d541981e70207950be9 in impala's branch
refs/heads/master from Aman Sinha
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=6208088 ]
IMPALA-9693: Analyze predicate in CNF rule if not previously done
The OrderByElement's expr that is used during the rewrite
phase was not analyzed, which causes an INVALID_TYPE
assert when the CNF rule tries to process the predicate
within the ORDER BY. This patch fixes the problem by
doing an explicit analyze of the compound predicate in
the CNF rule. This is a conservative approach such that
it can detect other such un-analyzed predicates that may
be passed in from any other clauses. An alternate attempt
at trying to replace the OrderByElement's expr with an
analyzed version works for this scenario but causes test
failures in ExprRewriterTest, so instead I have opted for
this approach.
Testing:
- Added tests with compound predicate in the ORDER BY
either in the main query block or within analytic function.
- Ran 'mvn test' for FE.
Change-Id: Iff71871bd69a068f4b5807161cffa7a49d76226d
Reviewed-on: http://gerrit.cloudera.org:8080/15815
Reviewed-by: Quanlong Huang <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Predicate in the ORDER BY clause causes failure with cnf rewrite enabled
> ------------------------------------------------------------------------
>
> Key: IMPALA-9693
> URL: https://issues.apache.org/jira/browse/IMPALA-9693
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 3.4.0
> Reporter: Aman Sinha
> Assignee: Aman Sinha
> Priority: Major
> Fix For: Impala 4.0
>
>
> When enable_cnf_rewrites is set to true, following query which has a
> predicate in the ORDER BY clause encounters failure. This is very similar to
> IMPALA-9620 except the predicate occurs in the ORDER BY.
> {noformat}
> set enable_cnf_rewrites = true;
> select l_quantity, if(l_quantity < 5 or l_quantity > 45, 'invalid', 'valid')
> from lineitem
> order by l_quantity, if(l_quantity < 5 or l_quantity > 45, 'invalid', 'valid')
> limit 5
> ERROR: IllegalStateException: null
> {noformat}
> Stack trace:
> {noformat}
> java.lang.IllegalStateException
> at
> com.google.common.base.Preconditions.checkState(Preconditions.java:492)
> at org.apache.impala.analysis.SlotRef.getIdsHelper(SlotRef.java:229)
> at org.apache.impala.analysis.Expr.getIdsHelper(Expr.java:1286)
> at org.apache.impala.analysis.Expr.getIdsHelper(Expr.java:1286)
> at org.apache.impala.analysis.Expr.getIds(Expr.java:1279)
> at
> org.apache.impala.rewrite.ConvertToCNFRule.convertToCNF(ConvertToCNFRule.java:111)
> at
> org.apache.impala.rewrite.ConvertToCNFRule.apply(ConvertToCNFRule.java:86)
> at
> org.apache.impala.rewrite.ExprRewriter.applyRuleBottomUp(ExprRewriter.java:85)
> at
> org.apache.impala.rewrite.ExprRewriter.applyRuleBottomUp(ExprRewriter.java:83)
> at
> org.apache.impala.rewrite.ExprRewriter.applyRuleRepeatedly(ExprRewriter.java:71)
> at
> org.apache.impala.rewrite.ExprRewriter.rewrite(ExprRewriter.java:55)
> at
> org.apache.impala.analysis.SelectStmt.rewriteCheckOrdinalResult(SelectStmt.java:1043)
> at
> org.apache.impala.analysis.SelectStmt.rewriteExprs(SelectStmt.java:1068)
> at
> org.apache.impala.analysis.AnalysisContext.analyze(AnalysisContext.java:472)
> at
> org.apache.impala.analysis.AnalysisContext.analyzeAndAuthorize(AnalysisContext.java:415)
> at
> org.apache.impala.service.Frontend.doCreateExecRequest(Frontend.java:1530)
> at
> org.apache.impala.service.Frontend.getTExecRequest(Frontend.java:1497)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]