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

Julian Hyde commented on CALCITE-5294:
--------------------------------------

[~kkasa], I reviewed your changes, and they look good. In my 
[julianhyde/5294-prune-join|https://github.com/julianhyde/calcite/tree/5294-prune-join]
 branch I added a further commit that makes the logic more concise. Please let 
me know what you think of my changes. If you approve I will squash and merge to 
main.

> Improve PruneEmptyRules join instances to remove join if generates null and 
> one branch is empty
> -----------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-5294
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5294
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Krisztian Kasa
>            Assignee: Krisztian Kasa
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.33.0
>
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> If a {{Join}} generates null on the right and the right branch of the join 
> known never produces any rows the join can be replaced with the left branch 
> and a project on top of it which contains the expressions come from the left 
> branch and null constants from the right branch. Example:
> {code:java}
> select * from emp e
> left outer join (select * from dept where false) as d on e.deptno = d.deptno
> {code}
> {code:java}
> select 
>   e.*, 
>   cast(null as <dept_col0_type>) as <dept_col0_name>
>   ... 
>   cast(null as <dept_coln_type>) as <dept_coln_name> 
> from emp
> {code}



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

Reply via email to