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

Vineet Garg commented on CALCITE-3824:
--------------------------------------

That sounds ok to me, we can keep the pull request closed.

> JoinProjectTransposeRule should skip Projects containing windowing expression
> -----------------------------------------------------------------------------
>
>                 Key: CALCITE-3824
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3824
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> This rule could push windowing expressions within join condition which 
> doesn't make sense.
> For example
> {code:sql}
> select * from dept a 
>      join (select rank() over (order by name) as r, 1 + 1 from dept) as b 
>              on a.name = b.r
> {code}
> Above query produces following plan after the rule
> {code}
> LogicalProject(DEPTNO=[$0], NAME=[$1], R=[$3], EXPR$1=[$4])
>   LogicalProject(DEPTNO=[$0], NAME=[$1], NAME0=[CAST($1):BIGINT NOT NULL], 
> R=[RANK() OVER (ORDER BY $3 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT 
> ROW)], EXPR$1=[+(1, 1)])
>     LogicalJoin(condition=[=(CAST($1):BIGINT NOT NULL, RANK() OVER (ORDER BY 
> $3 RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW))], joinType=[inner])
>       LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
>       LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to