Julian Hyde created CALCITE-450:
-----------------------------------

             Summary: Drop join tables if lattice implies that it is safe
                 Key: CALCITE-450
                 URL: https://issues.apache.org/jira/browse/CALCITE-450
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


A lattice implies foreign and primary key constraints among the related tables. 
Therefore certain semi-joins can be dropped.

For instance, given a lattice based on

{code:sql}
SELECT 1 FROM sales_fact JOIN customer USING (customer_id)
{code}

the query

{code:sql}
SELECT s.product_id
FROM sales_fact AS s,
   customer AS c
WHERE s.customer_id = c.customer_id
{code}

can be simplified to

{code:sql}
SELECT s.product_id
FROM sales_fact AS s
WHERE s.customer_id IS NOT NULL
{code}

even if no materializations are enabled.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to