[
https://issues.apache.org/jira/browse/CALCITE-2506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633641#comment-16633641
]
pengzhiwei edited comment on CALCITE-2506 at 10/1/18 6:30 AM:
--------------------------------------------------------------
Hi [~julianhyde] and [~vladimirsitnikov],this issue may result in the use of
"operand.digest" in the code show in RexSimplify#simplifyCoalesce:
{code:java}
.......
+581 for (RexNode operand : call.getOperands()) {
+582 operand = simplify.simplify_(operand);
+583 if (digests.add(operand.digest)) { // operand.digest is null here
+584 operands.add(operand);
+585 }
+586 if (!operand.getType().isNullable()) {
+587 break;
+589 }
.....{code}
Because the digest was computed in the RexCall#toString,before call of
RexCall#toString,the "digest" is always "null".
I will make a PR for this later.
was (Author: pzw2018):
Hi [~julianhyde] and [~vladimirsitnikov],this issue may result in the use of
"operand.digest" in the code show in RexSimplify#simplifyCoalesce:
{code:java}
.......
+581 for (RexNode operand : call.getOperands()) {
+582 operand = simplify.simplify_(operand);
+583 if (digests.add(operand.digest)) { // operand.digest is null here
+584 operands.add(operand);
+585 }
+586 if (!operand.getType().isNullable()) {
+587 break;
+589 }
.....{code}
Because the digest was computed in the RexCall#toString,before call of
RexCall#toString,the "digest" is always "null".
> RexSimplify: coalesce(unaryPlus(nullInt), unaryPlus(vInt())) results in
> AssertionError: result mismatch
> -------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-2506
> URL: https://issues.apache.org/jira/browse/CALCITE-2506
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: Vladimir Sitnikov
> Assignee: Julian Hyde
> Priority: Major
> Labels: newbie
>
> {{coalesce(unaryPlus(nullInt), unaryPlus(vInt()))}} results in
> {noformat}java.lang.AssertionError: result mismatch: when applied to
> {?0.int0=-1}, COALESCE(+(null), +(?0.int0)) yielded -1, and +(null) yielded
> NULL
> at org.apache.calcite.rex.RexSimplify.verify(RexSimplify.java:1162)
> at
> org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:175){noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)