mihaibudiu commented on code in PR #3840:
URL: https://github.com/apache/calcite/pull/3840#discussion_r1663157636


##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -2272,8 +2272,14 @@ && sameTypeOrNarrowsNullability(e.getType(), 
intExpr.getType())) {
           (RexLiteral) e.getOperands().get(1))
           : rexBuilder.makeCast(e.getType(), operand, safe, safe);
       executor.reduce(rexBuilder, ImmutableList.of(simplifiedExpr), 
reducedValues);
-      return requireNonNull(
-          Iterables.getOnlyElement(reducedValues));
+      RexNode reducedRexNode = 
requireNonNull(Iterables.getOnlyElement(reducedValues));
+      if (reducedRexNode instanceof RexCall) {

Review Comment:
   it looks to me dangerous to not check the call type here. It looks like you 
assume it's always a Cast.
   Maybe at least assert that.



-- 
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]

Reply via email to