Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-20749

Constraints: Null scan optimizer does not remove entire TableScan

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0
    • None
    • CBO, Logical Optimizer
    • None

    Description

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

       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;
      

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

      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`
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            gopalv Gopal Vijayaraghavan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: