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

Extend column pruner to account for residual filter expression in Join operator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.2.0
    • Logical Optimizer
    • None

    Description

      Introduced by HIVE-15251.

      We need to extend ColumnPruner logic to take into account residual filter expressions in Join operator. Otherwise, query will fail at execution time.

      Issue can be reproduced as follows:

      set hive.strict.checks.cartesian.product=false;
      
      CREATE TABLE test1 (key INT, value INT, col_1 STRING);
      INSERT INTO test1 VALUES (NULL, NULL, 'None'), (98, NULL, 'None'),
          (99, 0, 'Alice'), (99, 2, 'Mat'), (100, 1, 'Bob'), (101, 2, 'Car');
      
      CREATE TABLE test2 (key INT, value INT, col_2 STRING);
      INSERT INTO test2 VALUES (102, 2, 'Del'), (103, 2, 'Ema'),
          (104, 3, 'Fli'), (105, NULL, 'None');
      
      
      -- Complex condition and column projection
      EXPLAIN
      SELECT col_1, col_2
      FROM test1 LEFT OUTER JOIN test2
      ON (test1.value=test2.value
            OR test1.key=test2.key);
      
      SELECT col_1, col_2
      FROM test1 LEFT OUTER JOIN test2
      ON (test1.value=test2.value
            OR test1.key=test2.key);
      

      Attachments

        1. HIVE-15369.patch
          12 kB
          jcamachorodriguez

        Issue Links

          Activity

            People

              jcamacho Jesús Camacho Rodríguez
              jcamacho Jesús Camacho Rodríguez
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: