darpan-e6 commented on code in PR #4846:
URL: https://github.com/apache/calcite/pull/4846#discussion_r2989908273
##########
core/src/main/java/org/apache/calcite/rel/rules/ValuesReduceRule.java:
##########
@@ -186,9 +186,15 @@ protected void apply(RelOptRuleCall call, @Nullable
LogicalProject project,
final RexNode reducedValue =
reducibleExps.get((row * fieldsPerRow) + i);
++i;
- if (!reducedValue.isAlwaysTrue()) {
- ++changeCount;
- continue;
+ if (reducedValue instanceof RexLiteral
+ || RexUtil.isNullLiteral(reducedValue, true)) {
Review Comment:
The second boolean argument set to true allows us to detect NULL inside
CAST. To se specific, RexNode `CAST(NULL as type)` will have a type RexCall and
`RexUtil.isNullLiteral` returns true for such RexNode. In that case as well,
tuple inside LogicalValues does not qualify and it is safe to drop it.
--
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]