danny0405 commented on a change in pull request #2246:
URL: https://github.com/apache/calcite/pull/2246#discussion_r528688601



##########
File path: core/src/main/java/org/apache/calcite/rex/RexSimplify.java
##########
@@ -900,13 +902,12 @@ private void validateStrongPolicy(RexNode rexNode) {
     case ANY:
       List<RexNode> operands = ((RexCall) rexNode).getOperands();
       if (rexNode.getType().isNullable()) {
-        assert operands.stream()
-            .map(RexNode::getType)
-            .anyMatch(RelDataType::isNullable);
+        // Ignores the nullability change when all the operands are literals
+        // which come from the simplification.
+        assert 
operands.stream().map(RexNode::getType).anyMatch(RelDataType::isNullable)
+            || operands.stream().allMatch(p -> RexUtil.isLiteral(p, false));

Review comment:
       > rexBuilder.makeCall(e.getType(), e.getOperator(), operands); above 
must be updated to infer the proper type instead of e.getType().
   
   The problem is that it is hard to keep node type equivalence during 
simplification anymore, and the `ReduceExpressionsRule.Config.matchNullability` 
becomes meaningless.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to