Maryann Xue created CALCITE-1628:
------------------------------------

             Summary: Add an alternative match pattern for SemiJoinRule
                 Key: CALCITE-1628
                 URL: https://issues.apache.org/jira/browse/CALCITE-1628
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.11.0
            Reporter: Maryann Xue
            Assignee: Maryann Xue
            Priority: Minor
             Fix For: 1.12.0


SemiJoinRule looks for an INNER or LEFT OUTER Join with its right child as an 
Aggregate. It also tries to match a Project as the parent of the Join so that 
it can abort if any columns from the right child of the Join is referenced. 
There is another situation though, where the right child is an empty Aggregate 
that returns 0 columns and thus we don't need to look for a Project. So an 
alternative match pattern for SemiJoinRule would be just a Join over an 
Aggregate without a Project. For example, the following query can match the 
alternative pattern and fire the rule:
{code}
select e."deptno" from "hr"."emps" as e left join (select count(*) from 
"hr"."depts") on true
{code}
, where after field trimming the inner query will become an empty Aggregate.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to