julianhyde commented on a change in pull request #1130: [CALCITE-2865]
FilterProjectTransposeRule generates wrong traitSet when copyFilter/Project is
true
URL: https://github.com/apache/calcite/pull/1130#discussion_r272762831
##########
File path:
core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
##########
@@ -155,8 +158,12 @@ public void onMatch(RelOptRuleCall call) {
final RelBuilder relBuilder = call.builder();
RelNode newFilterRel;
if (copyFilter) {
- newFilterRel = filter.copy(filter.getTraitSet(), project.getInput(),
- simplifyFilterCondition(newCondition, call));
+ final RelNode input = project.getInput();
+ final RelTraitSet traitSet = filter.getTraitSet()
+ .replaceIfs(RelCollationTraitDef.INSTANCE,
Review comment:
As a power-user, you're definitely not in the target audience for the
default instances. It's not at all surprising that you're creating new
instances.
It may not be clear, but the line of code
`relBuilder.withConvention(filter.getConvention())` is creating a new
`RelBuilder` with a factory that creates `LogicalFilter`, `LogicalProject`,
etc. if `filter` is logical, creates `EnumerableFilter`, `EnumerableProject`,
etc. if `filter` is enumerable, creates `JdbcFilter`, `JdbcProject`, etc. if
`filter` is JDBC convention, and so forth. So, it doesn't matter that the
`RelBuilder` starts off logical, because the rule switches to a new one
according to the current convention.
----------------------------------------------------------------
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