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

Logical PPD: Push filter clauses through PTF(Windowing) into TS

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1, 2.0.0
    • 2.1.0
    • CBO, Logical Optimizer

    Description

      Simplified repro case of HCC #8880, with the slow query showing the push-down miss.

      And the manually rewritten query to indicate the expected one.

      Part of the problem could be the window range not being split apart for PPD, but the FIL is not pushed down even if the rownum filter is removed.

      create temporary table positions (regionid string, id bigint, deviceid string, ts string);
      
      insert into positions values('1d6a0be1-6366-4692-9597-ebd5cd0f01d1', 1422792010, '6c5d1a30-2331-448b-a726-a380d6b3a432', '2016-01-01'),
      ('1d6a0be1-6366-4692-9597-ebd5cd0f01d1', 1422792010, '6c5d1a30-2331-448b-a726-a380d6b3a432', '2016-01-01'),
      ('1d6a0be1-6366-4692-9597-ebd5cd0f01d1', 1422792010, '6c5d1a30-2331-448b-a726-a380d6b3a432', '2016-01-02'),
      ('1d6a0be1-6366-4692-9597-ebd5cd0f01d1', 1422792010, '6c5d1a30-2331-448b-a726-a380d6b3a432', '2016-01-02');
      
      
      -- slow query
      explain
      WITH t1 AS 
      ( 
               SELECT   *, 
                        Row_number() over ( PARTITION BY regionid, id, deviceid ORDER BY ts DESC) AS rownos
               FROM     positions ), 
      latestposition as ( 
             SELECT * 
             FROM   t1 
             WHERE  rownos = 1) 
      SELECT * 
      FROM   latestposition 
      WHERE  regionid='1d6a0be1-6366-4692-9597-ebd5cd0f01d1' 
      AND    id=1422792010 
      AND    deviceid='6c5d1a30-2331-448b-a726-a380d6b3a432';
      
      -- fast query
      explain
      WITH t1 AS 
      ( 
               SELECT   *, 
                        Row_number() over ( PARTITION BY regionid, id, deviceid ORDER BY ts DESC) AS rownos
               FROM     positions 
               WHERE  regionid='1d6a0be1-6366-4692-9597-ebd5cd0f01d1' 
               AND    id=1422792010 
               AND    deviceid='6c5d1a30-2331-448b-a726-a380d6b3a432'
      ),latestposition as ( 
             SELECT * 
             FROM   t1 
             WHERE  rownos = 1) 
      SELECT * 
      FROM   latestposition 
      ;
      

      Attachments

        1. HIVE-12808.05.patch
          278 kB
          Laljo John Pullokkaran
        2. HIVE-12808.04.patch
          292 kB
          Laljo John Pullokkaran
        3. HIVE-12808.03.patch
          285 kB
          Laljo John Pullokkaran
        4. HIVE-12808.02.patch
          258 kB
          Laljo John Pullokkaran
        5. HIVE-12808.01.patch
          24 kB
          Laljo John Pullokkaran

        Issue Links

          Activity

            People

              jpullokkaran Laljo John Pullokkaran
              gopalv Gopal Vijayaraghavan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: