Anthrino commented on code in PR #3677:
URL: https://github.com/apache/calcite/pull/3677#discussion_r1498181295
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -2267,16 +2267,21 @@ && sameTypeOrNarrowsNullability(e.getType(),
intExpr.getType())) {
break;
}
final List<RexNode> reducedValues = new ArrayList<>();
- final RexNode simplifiedExpr =
- rexBuilder.makeCast(e.getType(), operand, safe, safe);
+ final RexNode simplifiedExpr = e.operands.size() > 1
+ ? rexBuilder.makeCast(e.getType(), operand, safe, safe,
+ (RexLiteral) e.getOperands().get(1))
+ : rexBuilder.makeCast(e.getType(), operand, safe, safe);
executor.reduce(rexBuilder, ImmutableList.of(simplifiedExpr),
reducedValues);
return requireNonNull(
Iterables.getOnlyElement(reducedValues));
default:
if (operand == e.getOperands().get(0)) {
return e;
} else {
- return rexBuilder.makeCast(e.getType(), operand, safe, safe);
+ return e.operands.size() > 1
Review Comment:
It can be upto 2 with this implementation, will change to equality check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]