[
https://issues.apache.org/jira/browse/CALCITE-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
chunwei updated CALCITE-1294:
-----------------------------
Description:
function gatherConstraint in class ReduceExpressionRule throw
NullPointerException when both left RexNode and right RexNode are NULL
RexLiteral.
private static <C extends RexNode> void gatherConstraint(Class<C> clazz,
RexNode left, RexNode right, Map<RexNode, C> map, Set<RexNode> excludeSet,
RexBuilder rexBuilder) {
......
else {
if (existedValue instanceof RexLiteral
&& constant instanceof RexLiteral
&& !((RexLiteral) existedValue).getValue()
.equals(((RexLiteral) constant).getValue())) {
// we found conflicting values, e.g. left = 10 and left = 20
map.remove(left);
excludeSet.add(left);
}
},
}
when existedValue and constant are NULL RexLiteral, getValue() returns null and
null.equals(null) will throw NullPointerException.
was:
function gatherConstraint in class ReduceExpressionRule throw
NullPointerException when both left RexNode and right RexNode are NULL
RexLiteral.
```java
private static <C extends RexNode> void gatherConstraint(Class<C> clazz,
RexNode left, RexNode right, Map<RexNode, C> map, Set<RexNode> excludeSet,
RexBuilder rexBuilder) {
......
else {
if (existedValue instanceof RexLiteral
&& constant instanceof RexLiteral
&& !((RexLiteral) existedValue).getValue()
.equals(((RexLiteral) constant).getValue())) {
// we found conflicting values, e.g. left = 10 and left = 20
map.remove(left);
excludeSet.add(left);
}
},
}
```
> function gatherConstraint in class ReduceExpressionRule throws
> NullPointerException when both left RexNode and right RexNode are NULL
> RexLiteral
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-1294
> URL: https://issues.apache.org/jira/browse/CALCITE-1294
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: chunwei
> Assignee: Julian Hyde
>
> function gatherConstraint in class ReduceExpressionRule throw
> NullPointerException when both left RexNode and right RexNode are NULL
> RexLiteral.
> private static <C extends RexNode> void gatherConstraint(Class<C> clazz,
> RexNode left, RexNode right, Map<RexNode, C> map, Set<RexNode>
> excludeSet,
> RexBuilder rexBuilder) {
> ......
> else {
> if (existedValue instanceof RexLiteral
> && constant instanceof RexLiteral
> && !((RexLiteral) existedValue).getValue()
> .equals(((RexLiteral) constant).getValue())) {
> // we found conflicting values, e.g. left = 10 and left = 20
> map.remove(left);
> excludeSet.add(left);
> }
> },
> }
> when existedValue and constant are NULL RexLiteral, getValue() returns null
> and null.equals(null) will throw NullPointerException.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)