Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-934

Multiple DISTINCT returns null grouping key value.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.9.0
    • Component/s: None
    • Labels:
      None

      Description

      default> select count * from table1;
      col1, col2, col3
      -------------------------
      a, b-1, null
      a, b-2, null
      a, b-2, null
      a, b-3, null
      a, b-3, null
      a, b-3, null
      
      default> select col1,
      count(distinct col2) as cnt1,
      count(distinct case when col3 is not null then col2 else null end) as cnt2
      from table1
      group by col1;
      
      col1,cnt1,cnt2
      -------------------------------
      a,  2,  1
      null,  1,  1
      

      This query should return the below result.

      col1,cnt1,cnt2
      -------------------------------
      a, 3, 1
      

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user babokim opened a pull request:

        https://github.com/apache/tajo/pull/63

        TAJO-934: Multiple DISTINCT returns null grouping key value.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/babokim/tajo TAJO-934

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tajo/pull/63.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #63


        commit 542fe82ed4ed1dc2764833ca81c0dc334b1e2c1c
        Author: 김형준 <babokim@babokim-mbp.server.gruter.com>
        Date: 2014-07-10T11:52:23Z

        TAJO-934: Multiple DISTINCT returns null grouping key value.

        commit ff1a5c7c503b569348bcd9b3fba5a196ead517ed
        Author: 김형준 <babokim@babokim-mbp.server.gruter.com>
        Date: 2014-07-10T11:55:52Z

        TAJO-934: Multiple DISTINCT returns null grouping key value.
        Remove debug comments


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user babokim opened a pull request: https://github.com/apache/tajo/pull/63 TAJO-934 : Multiple DISTINCT returns null grouping key value. You can merge this pull request into a Git repository by running: $ git pull https://github.com/babokim/tajo TAJO-934 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/63.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #63 commit 542fe82ed4ed1dc2764833ca81c0dc334b1e2c1c Author: 김형준 <babokim@babokim-mbp.server.gruter.com> Date: 2014-07-10T11:52:23Z TAJO-934 : Multiple DISTINCT returns null grouping key value. commit ff1a5c7c503b569348bcd9b3fba5a196ead517ed Author: 김형준 <babokim@babokim-mbp.server.gruter.com> Date: 2014-07-10T11:55:52Z TAJO-934 : Multiple DISTINCT returns null grouping key value. Remove debug comments
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user hyunsik commented on the pull request:

        https://github.com/apache/tajo/pull/63#issuecomment-48693318

        +1

        LGTM! I've changed some comments.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on the pull request: https://github.com/apache/tajo/pull/63#issuecomment-48693318 +1 LGTM! I've changed some comments.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user babokim commented on the pull request:

        https://github.com/apache/tajo/pull/63#issuecomment-48693574

        hyunsik please wait a while. I find another bug about multiple distinct.
        The following query is recognized as a general group by query not a distinct group by query.
        select count(distinct col1) + count(distinct col2) from table1

        I'll fix this bug in this patch.

        Show
        githubbot ASF GitHub Bot added a comment - Github user babokim commented on the pull request: https://github.com/apache/tajo/pull/63#issuecomment-48693574 hyunsik please wait a while. I find another bug about multiple distinct. The following query is recognized as a general group by query not a distinct group by query. select count(distinct col1) + count(distinct col2) from table1 I'll fix this bug in this patch.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user hyunsik commented on the pull request:

        https://github.com/apache/tajo/pull/63#issuecomment-48700667

        +1

        The travis test result is failed due to 'No output' in the last 10 minutes. But, I manually verified 'mvn clean install'. The latest bug fix also looks nice.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on the pull request: https://github.com/apache/tajo/pull/63#issuecomment-48700667 +1 The travis test result is failed due to 'No output' in the last 10 minutes. But, I manually verified 'mvn clean install'. The latest bug fix also looks nice.
        Hide
        hyunsik Hyunsik Choi added a comment -

        committed.

        Show
        hyunsik Hyunsik Choi added a comment - committed.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/63

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/63
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-build #288 (See https://builds.apache.org/job/Tajo-master-build/288/)
        TAJO-934: Multiple DISTINCT returns null grouping key value. (Hyoungjun Kim via hyunsik) (hyunsik: rev 95292d29d96963c769ce2fd17a3350375145683e)

        • CHANGES
        • tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/DistinctGroupbyHashAggregationExec.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-build #288 (See https://builds.apache.org/job/Tajo-master-build/288/ ) TAJO-934 : Multiple DISTINCT returns null grouping key value. (Hyoungjun Kim via hyunsik) (hyunsik: rev 95292d29d96963c769ce2fd17a3350375145683e) CHANGES tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestGroupByQuery.java tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/DistinctGroupbyHashAggregationExec.java

          People

          • Assignee:
            hjkim Hyoungjun Kim
            Reporter:
            hjkim Hyoungjun Kim
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development