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

Allow StatsOptimizer to optimize the query for Constant GroupBy keys

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.0
    • Component/s: None
    • Labels:
      None

      Description

      hive> select count('1') from src group by '1';
      

      In the above query, while performing StatsOptimizer optimization we can safely ignore the group by on the constant key '1' since the above query will return the same result as "select count('1') from src".

      Exception:
      If src is empty, according to the SQL standard,

       select count('1') from src group by '1'
      

      and

       select count('1') from src
      

      should produce 1 and 0 rows respectively.

        Attachments

        1. HIVE-12640.1.patch
          5 kB
          Hari Sankar Sivarama Subramaniyan
        2. HIVE-12640.2.patch
          2 kB
          Hari Sankar Sivarama Subramaniyan
        3. HIVE-12640.3.patch
          5 kB
          Hari Sankar Sivarama Subramaniyan
        4. HIVE-12640.4.patch
          9 kB
          Hari Sankar Sivarama Subramaniyan

          Issue Links

            Activity

              People

              • Assignee:
                hsubramaniyan Hari Sankar Sivarama Subramaniyan
                Reporter:
                hsubramaniyan Hari Sankar Sivarama Subramaniyan
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: