Krisztian Kasa created CALCITE-5294:
---------------------------------------
Summary: 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
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)