Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
Description
A query of the following shape can have its customer join removed entirely on the basis of the key containment between customer & store_sales.
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;
This query after join removal can be encoded in as
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;
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).
Attachments
Issue Links
- is duplicated by
-
HIVE-17040 Join elimination in the presence of FK relationship
- Closed