Hive
  1. Hive
  2. HIVE-3108

SELECT count(DISTINCT col) ... returns 0 if "col" is a partition column

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 0.8.0, 0.9.0
    • Fix Version/s: None
    • Component/s: Query Processor
    • Labels:
    • Environment:

      Mac OSX running Apache distribution of hadoop and hive natively.

      Description

      Suppose "stocks" is a managed OR external table, partitioned by "exchange" and "symbol". "count(DISTINCT x)" returns 0 for either "exchange", "symbol", or both:

      hive> SELECT count(DISTINCT exchange), count(DISTINCT symbol) from stocks;
      0 0

        Issue Links

          Activity

          Hide
          Carl Steinbach added a comment -

          @Arun: Doesn't look like there's a patch here. Not sure why you changed the status to Patch Available.

          Show
          Carl Steinbach added a comment - @Arun: Doesn't look like there's a patch here. Not sure why you changed the status to Patch Available.
          Hide
          Edward Capriolo added a comment -

          I am guessing he things that HIVE-2955 is patch available and is the same issue as this one. If that is that case we should just close this as a duplicate.

          Show
          Edward Capriolo added a comment - I am guessing he things that HIVE-2955 is patch available and is the same issue as this one. If that is that case we should just close this as a duplicate.
          Hide
          Edward Capriolo added a comment -

          Confirmed fixed in trunk.

          [edward@tablitha dist]$ bin/hive
          Logging initialized using configuration in jar:file:/home/edward/hive/trunk/build/dist/lib/hive-common-0.10.0-SNAPSHOT.jar!/hive-log4j.properties
          Hive history file=/tmp/edward/hive_job_log_edward_201206272349_386020253.txt
          hive> create table stocks (x int, y string) partitioned by (exchange string, symbol string);
          OK
          Time taken: 17.382 seconds
          hive> alter table stocks add partition (exchange='nasdaq', symbol='ed');
          OK
          Time taken: 2.022 seconds
          hive> alter table stocks add partition (exchange='nasdaq', symbol='guy');
          OK
          Time taken: 0.219 seconds
          hive> alter table stocks add partition (exchange='jp', symbol='bla');    
          OK
          Time taken: 0.245 seconds
          hive> select count(distinct exchange), count(distinct symbol) from stocks;
          2	3
          Time taken: 5.742 seconds
          
          Show
          Edward Capriolo added a comment - Confirmed fixed in trunk. [edward@tablitha dist]$ bin/hive Logging initialized using configuration in jar:file:/home/edward/hive/trunk/build/dist/lib/hive-common-0.10.0-SNAPSHOT.jar!/hive-log4j.properties Hive history file=/tmp/edward/hive_job_log_edward_201206272349_386020253.txt hive> create table stocks (x int, y string) partitioned by (exchange string, symbol string); OK Time taken: 17.382 seconds hive> alter table stocks add partition (exchange='nasdaq', symbol='ed'); OK Time taken: 2.022 seconds hive> alter table stocks add partition (exchange='nasdaq', symbol='guy'); OK Time taken: 0.219 seconds hive> alter table stocks add partition (exchange='jp', symbol='bla'); OK Time taken: 0.245 seconds hive> select count(distinct exchange), count(distinct symbol) from stocks; 2 3 Time taken: 5.742 seconds

            People

            • Assignee:
              Unassigned
              Reporter:
              Dean Wampler
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development