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

ASF GitHub Bot updated CALCITE-7833:
------------------------------------
    Labels: pull-request-available  (was: )

> MULTI_JOIN_OPTIMIZE_BUSHY may turn an outer join into an inner join.
> --------------------------------------------------------------------
>
>                 Key: CALCITE-7833
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7833
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: DongShengHe
>            Priority: Minor
>              Labels: pull-request-available
>
> This issue CALCITE-5289 was not fully resolved by [PR 
> 3763|https://github.com/apache/calcite/pull/3763].
> The rule uses outerJoinFactors to detect outer joins, but that field does not 
> reliably indicate whether a join is outer.
> Reproduction cases:
> 1. The {{MultiJoin}} records this through {{{}isFullOuterJoin=true{}}}, while 
> {{outerJoinFactors}} is null for both inputs. The guard skips its checks, and 
> the Bushy rule rebuilds the join as {{{}INNER{}}}.
> {code:sql}
> select * from emp full join dept on emp.deptno = dept.deptno 
> {code}
> The query is incorrectly transformed into the following plan:
> {code:java}
>   LogicalJoin(condition=[=($9, $0)], joinType=[inner])
>     LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
>     LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {code}
>  
> 2.   A LEFT JOIN B ON TRUE 
>  The {{ON TRUE}}  condition references no factors, so {{outerJoinFactors}} 
> for {{B}} is empty. The guard treats it as safe to optimize, and the Bushy 
> rule rebuilds the join as {{INNER}}.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to