Hive
  1. Hive
  2. HIVE-2597

Repeated key in GROUP BY is erroneously displayed when using DISTINCT

    Details

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

      Description

      The following query was simplified for illustration purposes.

      This works correctly:

      select client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid
      

      The intent here is to produce two empty columns in between data.

      The following query does not work:

      select distinct client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid
      
      FAILED: Error in semantic analysis: Line 1:44 Repeated key in GROUP BY ""
      

      The key is not repeated since the aliases were given. Seems like Hive is ignoring the aliases when the "distinct" keyword is specified.

      1. HIVE-2597.3.patch.txt
        15 kB
        Navis
      2. HIVE-2597.4.patch.txt
        44 kB
        Navis
      3. HIVE-2597.D8967.1.patch
        32 kB
        Phabricator
      4. HIVE-2597.D8967.2.patch
        37 kB
        Phabricator

        Issue Links

          Activity

          Alex Rovner created issue -
          Navis made changes -
          Field Original Value New Value
          Status Open [ 1 ] Patch Available [ 10002 ]
          Affects Version/s 0.7.1 [ 12316336 ]
          Assignee Navis [ navis ]
          Phabricator made changes -
          Attachment HIVE-2597.D8967.1.patch [ 12571160 ]
          Namit Jain made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Navis made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Phabricator made changes -
          Attachment HIVE-2597.D8967.2.patch [ 12572679 ]
          Ashutosh Chauhan made changes -
          Status Patch Available [ 10002 ] Open [ 1 ]
          Navis made changes -
          Attachment HIVE-2597.3.patch.txt [ 12651945 ]
          Navis made changes -
          Status Open [ 1 ] Patch Available [ 10002 ]
          Navis made changes -
          Attachment HIVE-2597.4.patch.txt [ 12652100 ]
          Navis made changes -
          Remote Link This issue links to "review board (Web Link)" [ 15542 ]
          Damien Carol made changes -
          Description The following query was simplified for illustration purposes.

          This works correctly:
          select client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid

          The intent here is to produce two empty columns in between data.

          The following query does not work:
          select distinct client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid

          FAILED: Error in semantic analysis: Line 1:44 Repeated key in GROUP BY ""

          The key is not repeated since the aliases were given. Seems like Hive is ignoring the aliases when the "distinct" keyword is specified.
          The following query was simplified for illustration purposes.

          This works correctly:
          {code:sql}
          select client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid
          {code}

          The intent here is to produce two empty columns in between data.

          The following query does not work:
          {code:sql}
          select distinct client_tid, "" as myvalue1, "" as myvalue2 from clients cluster by client_tid
          {code}
          {noformat}
          FAILED: Error in semantic analysis: Line 1:44 Repeated key in GROUP BY ""
          {noformat}
          The key is not repeated since the aliases were given. Seems like Hive is ignoring the aliases when the "distinct" keyword is specified.
          Ashutosh Chauhan made changes -
          Status Patch Available [ 10002 ] Resolved [ 5 ]
          Fix Version/s 0.14.0 [ 12326450 ]
          Resolution Fixed [ 1 ]
          Thejas M Nair made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Navis
              Reporter:
              Alex Rovner
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development