[ 
https://issues.apache.org/jira/browse/CALCITE-2964?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16806388#comment-16806388
 ] 

Feng Zhu commented on CALCITE-2964:
-----------------------------------

The *FilterProjectTransposeRule* rule does not create a Project RelNode because 
it is identity.
As a result, the *ValuesReduceRule* rule fails to match. I think it is 
reasonable to create a Project even it is identity
{code:java}
***Before Rule: FilterProjectTransposeRule
LogicalFilter(condition=[>(+($0, $1), 30)])
  LogicalProject(EXPR$0=[$0], EXPR$1=[$1])
    LogicalValues(tuples=[[{ 20, 2 }]])

---After Rule: FilterProjectTransposeRule
LogicalFilter(condition=[>(+($0, $1), 30)])
  LogicalValues(tuples=[[{ 20, 2 }]]){code}

> testEmptyFilterProjectUnion fails when copyPorject is disabled in 
> FilterProjectTransposeRule
> --------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2964
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2964
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Haisheng Yuan
>            Priority: Major
>
> Changing
> {code:java}
> public static final FilterProjectTransposeRule INSTANCE =
>       new FilterProjectTransposeRule(Filter.class, Project.class, true, true,
>           RelFactories.LOGICAL_BUILDER);
> {code}
> to
> {code:java}
> public static final FilterProjectTransposeRule INSTANCE =
>       new FilterProjectTransposeRule(Filter.class, Project.class, true, false,
>           RelFactories.LOGICAL_BUILDER);
> {code}
> will cause testEmptyFilterProjectUnion plan diff:
> {code:java}
> LogicalProject(X=[$0], Y=[$1])
>   LogicalUnion(all=[true])
>     LogicalFilter(condition=[>(+($0, $1), 30)])
>       LogicalValues(tuples=[[{ 10, 1 }, { 30, 3 }]])
>     LogicalFilter(condition=[>(+($0, $1), 30)])
>       LogicalValues(tuples=[[{ 20, 2 }]])
> {code}
> The expected plan is:
> {code:java}
> LogicalProject(X=[$0], Y=[$1])
>   LogicalValues(tuples=[[{ 30, 3 }]])
> {code}
> I am assuming it will generate the same plan no matter copyFilter/copyProject 
> is on or off. Is this wrong assumption?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to