[ 
https://issues.apache.org/jira/browse/CALCITE-3824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez resolved CALCITE-3824.
----------------------------------------------
    Fix Version/s: 1.23.0
       Resolution: Fixed

Fixed in 
https://github.com/apache/calcite/commit/50cd53845e13f870f245bf9b77bb996b6b8d825c.

> 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
>             Fix For: 1.23.0
>
>          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