ihuzenko commented on a change in pull request #1610: [CALCITE-3525]
RexSimplify: eliminate redundant rex calls in OR
URL: https://github.com/apache/calcite/pull/1610#discussion_r352494626
##########
File path:
core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
##########
@@ -202,8 +202,9 @@ private RexNode simplifyFilterCondition(RexNode condition,
RelOptRuleCall call)
// 1>null evaluates to unknown and WHERE unknown behaves exactly like
WHERE false
RexSimplify simplifier =
new RexSimplify(xBuilder, RelOptPredicateList.EMPTY, executor);
- return RexUtil.removeNullabilityCast(
+ RexNode simplified = RexUtil.removeNullabilityCast(
xBuilder.getTypeFactory(),
simplifier.simplifyUnknownAsFalse(condition));
+ return simplified.isAlwaysFalse() ? condition : simplified;
Review comment:
Hi @danny0405 , without the check, tree may contain Filter with false
condition, so then implementors (like Elasticsearch or MongoDB adapters) can't
provide implementation for such Filter. The hidden issue was always there, just
became visible now, after such simplification actually happened in tests.
----------------------------------------------------------------
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]
With regards,
Apache Git Services