Gopal V created HIVE-20749:
------------------------------

             Summary: Constraints: Null scan optimizer does not remove entire 
TableScan
                 Key: HIVE-20749
                 URL: https://issues.apache.org/jira/browse/HIVE-20749
             Project: Hive
          Issue Type: Bug
          Components: CBO, Logical Optimizer
            Reporter: Gopal V


With PK constraints on store table, the following query fails to remove the 
entire join (and cut the query short).

{code}
 explain select count(1) from store_sales, store where ss_store_sk = s_store_sk 
and s_store_sk is null and ss_sold_date_sk between 2450816 and 2450816+365;
{code}

Calcite generates the following optimized query, but the NullScan optimizer 
does not kick in for the query.

{code}
SELECT COUNT(*) AS `$f0`
FROM (SELECT *
FROM (SELECT 0 AS `DUMMY`
FROM `tpcds_bin_partitioned_orc_10000`.`store_sales`) AS `t`
WHERE FALSE) AS `t0`,
(SELECT *
FROM (SELECT 0 AS `DUMMY`
FROM `tpcds_bin_partitioned_orc_10000`.`store`) AS `t1`
WHERE FALSE) AS `t2`
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to