You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Gopal V (JIRA)" <ji...@apache.org> on 2018/08/07 18:13:00 UTC
[jira] [Created] (HIVE-20333) CBO: Join removal based on PK-FK
declared constraints
Gopal V created HIVE-20333:
------------------------------
Summary: CBO: Join removal based on PK-FK declared constraints
Key: HIVE-20333
URL: https://issues.apache.org/jira/browse/HIVE-20333
Project: Hive
Issue Type: Bug
Reporter: Gopal V
A query of the following shape can have its customer join removed entirely on the basis of the key containment between customer & store_sales.
{code}
select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales from store_sales ,customer where ss_customer_sk = c_customer_sk group by c_customer_sk;
{code}
This query after join removal can be encoded in as
{code}
select ss_customer_sk as c_customer_sk,sum(ss_quantity*ss_sales_price) ssales from store_sales where ss_customer_sk is not null group by ss_customer_sk;
{code}
The rewrite is not applied today and the current PK-FK relationship does not allow for a nullable relationship (i.e a declared Foreign Key can't be NULL).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)