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

Support distinct in presence of Group By

    XMLWordPrintableJSON

    Details

      Description

      create table e011_01 (c1 int, c2 smallint);
      insert into e011_01 values (1, 1), (2, 2);
      

      These queries should work:

      select distinct c1, count(*) from e011_01 group by c1;
      select distinct c1, avg(c2) from e011_01 group by c1;
      

      Currently, you get :
      FAILED: SemanticException 1:52 SELECT DISTINCT and GROUP BY can not be in the same query. Error encountered near token 'c1'

        Attachments

        1. HIVE-16924.01.patch
          60 kB
          Remus Rusanu
        2. HIVE-16924.02.patch
          60 kB
          Julian Hyde
        3. HIVE-16924.03.patch
          241 kB
          Julian Hyde
        4. HIVE-16924.04.patch
          242 kB
          Julian Hyde
        5. HIVE-16924.05.patch
          243 kB
          Julian Hyde
        6. HIVE-16924.06.patch
          74 kB
          Julian Hyde
        7. HIVE-16924.07.patch
          106 kB
          Miklos Gergely
        8. HIVE-16924.08.patch
          107 kB
          Miklos Gergely
        9. HIVE-16924.09.patch
          165 kB
          Miklos Gergely
        10. HIVE-16924.10.patch
          165 kB
          Miklos Gergely
        11. HIVE-16924.11.patch
          118 kB
          Miklos Gergely
        12. HIVE-16924.12.patch
          118 kB
          Miklos Gergely
        13. HIVE-16924.13.patch
          118 kB
          Miklos Gergely
        14. HIVE-16924.14.patch
          118 kB
          Miklos Gergely
        15. HIVE-16924.15.patch
          134 kB
          Miklos Gergely
        16. HIVE-16924.16.patch
          133 kB
          Miklos Gergely
        17. HIVE-16924.17.patch
          133 kB
          Miklos Gergely
        18. HIVE-16924.18.patch
          133 kB
          Miklos Gergely
        19. HIVE-16924.19.patch
          133 kB
          Miklos Gergely
        20. HIVE-16924.20.patch
          133 kB
          Miklos Gergely
        21. HIVE-16924.21.patch
          133 kB
          Miklos Gergely
        22. HIVE-16924.22.patch
          132 kB
          Miklos Gergely
        23. HIVE-16924.23.patch
          132 kB
          Miklos Gergely
        24. HIVE-16924.24.patch
          132 kB
          Miklos Gergely
        25. HIVE-16924.25.patch
          132 kB
          Miklos Gergely
        26. HIVE-16924.26.patch
          132 kB
          Miklos Gergely
        27. HIVE-16924.27.patch
          134 kB
          Miklos Gergely

          Issue Links

            Activity

              People

              • Assignee:
                mgergely Miklos Gergely
                Reporter:
                cartershanklin Carter Shanklin
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 20m
                  4h 20m