Details

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

      Description

      NPE occurs in a natural join.

      default> create table t(a int);
      default> insert overwrite into t select 1;
      default> create table s(a int);
      default> insert overwrite into s select 1;
      default> select * from t natural join s;
      

      The main reason is joinQual is null.

         public RESULT visitJoin(CONTEXT ctx, Stack<Expr> stack, Join expr) throws PlanningException {
           stack.push(expr);
      -    visit(ctx, stack, expr.getQual());
      +    if (expr.getQual() != null) {
      +      visit(ctx, stack, expr.getQual());
      +    }
      
      -    join.joinQual = (Expr) joinQual.clone();
      +    if (joinQual != null) {
      +      join.joinQual = (Expr) joinQual.clone();
      +    }
      

      After fix, we need to get the following result.

      default> select * from t natural join s;
      Progress: 100%, response time: 0.293 sec
      a,  a
      -------------------------------
      1,  1
      (1 rows, 0.293 sec, 4 B selected)
      

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user dongjoon-hyun opened a pull request:

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

        TAJO-1574: Fix NPE on natural join

        Please see the description in https://issues.apache.org/jira/browse/TAJO-1574 .

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

        $ git pull https://github.com/dongjoon-hyun/tajo TAJO-1574

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

        https://github.com/apache/tajo/pull/548.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 #548


        commit 86ac01d5d946bb540085f269eadb1860c73f033c
        Author: Dongjoon Hyun <dongjoon@apache.org>
        Date: 2015-04-20T22:38:04Z

        TAJO-1574: Fix NPE on natural join


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user dongjoon-hyun opened a pull request: https://github.com/apache/tajo/pull/548 TAJO-1574 : Fix NPE on natural join Please see the description in https://issues.apache.org/jira/browse/TAJO-1574 . You can merge this pull request into a Git repository by running: $ git pull https://github.com/dongjoon-hyun/tajo TAJO-1574 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/548.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 #548 commit 86ac01d5d946bb540085f269eadb1860c73f033c Author: Dongjoon Hyun <dongjoon@apache.org> Date: 2015-04-20T22:38:04Z TAJO-1574 : Fix NPE on natural join
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-94586549

        Great. Would you please add test cases?

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-94586549 Great. Would you please add test cases?
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user dongjoon-hyun commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-94587626

        Sure. The changed codes are in `tajo-algebra` and `tajo-plan`. I will add a testcase to cover both cases in somewhere.

        Show
        githubbot ASF GitHub Bot added a comment - Github user dongjoon-hyun commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-94587626 Sure. The changed codes are in `tajo-algebra` and `tajo-plan`. I will add a testcase to cover both cases in somewhere.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-94588021

        Well, it's good, but we need to verify query results in most cases, especially when the bug is related to query execution.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-94588021 Well, it's good, but we need to verify query results in most cases, especially when the bug is related to query execution.
        Hide
        tajoqa Tajo QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12726694/TAJO-1574.Hyun.150421.0.patch.txt
        against master revision release-0.9.0-rc0-270-g2a5d912.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. The applied patch does not increase the total number of javadoc warnings.

        +1 checkstyle. The patch generated 0 code style errors.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        +1 core tests. The patch passed unit tests in tajo-algebra tajo-plan.

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/753//testReport/
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/753//console

        This message is automatically generated.

        Show
        tajoqa Tajo QA added a comment - -1 overall. Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12726694/TAJO-1574.Hyun.150421.0.patch.txt against master revision release-0.9.0-rc0-270-g2a5d912. +1 @author. The patch does not contain any @author tags. -1 tests included. The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 javadoc. The applied patch does not increase the total number of javadoc warnings. +1 checkstyle. The patch generated 0 code style errors. +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed unit tests in tajo-algebra tajo-plan. Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/753//testReport/ Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/753//console This message is automatically generated.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user dongjoon-hyun commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-94592648

        Oh, I see what you mean.

        Show
        githubbot ASF GitHub Bot added a comment - Github user dongjoon-hyun commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-94592648 Oh, I see what you mean.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user dongjoon-hyun commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-94776623

        Hi, @jihoonson . I finished adding a testcase.

        Show
        githubbot ASF GitHub Bot added a comment - Github user dongjoon-hyun commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-94776623 Hi, @jihoonson . I finished adding a testcase.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on a diff in the pull request:

        https://github.com/apache/tajo/pull/548#discussion_r29145724

        — Diff: tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java —
        @@ -1191,4 +1192,16 @@ public final void testJoinWithOrPredicates() throws Exception

        { assertResultSet(res); cleanupQuery(res); }

        +
        + @Test
        + public final void testNaturalJoin() throws Exception {
        + ResultSet res = null;
        + try

        { + res = executeQuery(); + }

        catch (Exception e) {
        — End diff –

        This catch block is redundant because the testNaturalJoin method throws Exception. I'll remove it before commit.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on a diff in the pull request: https://github.com/apache/tajo/pull/548#discussion_r29145724 — Diff: tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java — @@ -1191,4 +1192,16 @@ public final void testJoinWithOrPredicates() throws Exception { assertResultSet(res); cleanupQuery(res); } + + @Test + public final void testNaturalJoin() throws Exception { + ResultSet res = null; + try { + res = executeQuery(); + } catch (Exception e) { — End diff – This catch block is redundant because the testNaturalJoin method throws Exception. I'll remove it before commit.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/548#issuecomment-96653220

        +1 LGTM.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/548#issuecomment-96653220 +1 LGTM.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

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

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/548
        Hide
        jihoonson Jihoon Son added a comment -

        Committed to master and 0.10.1 branches.
        Thanks for your contribution.

        Show
        jihoonson Jihoon Son added a comment - Committed to master and 0.10.1 branches. Thanks for your contribution.
        Hide
        hudson Hudson added a comment -

        ABORTED: Integrated in Tajo-master-CODEGEN-build #328 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/328/)
        TAJO-1574: Fix NPE on natural join. (jihoonson: rev 1971d85fce473da5cec407adecf89117253eca45)

        • tajo-plan/src/main/java/org/apache/tajo/plan/algebra/BaseAlgebraVisitor.java
        • tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
        • CHANGES
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
        • tajo-core/src/test/resources/queries/TestJoinQuery/testNaturalJoin.sql
        • tajo-core/src/test/resources/results/TestJoinQuery/testNaturalJoin.result
        Show
        hudson Hudson added a comment - ABORTED: Integrated in Tajo-master-CODEGEN-build #328 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/328/ ) TAJO-1574 : Fix NPE on natural join. (jihoonson: rev 1971d85fce473da5cec407adecf89117253eca45) tajo-plan/src/main/java/org/apache/tajo/plan/algebra/BaseAlgebraVisitor.java tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java CHANGES tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java tajo-core/src/test/resources/queries/TestJoinQuery/testNaturalJoin.sql tajo-core/src/test/resources/results/TestJoinQuery/testNaturalJoin.result
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #689 (See https://builds.apache.org/job/Tajo-master-build/689/)
        TAJO-1574: Fix NPE on natural join. (jihoonson: rev 1971d85fce473da5cec407adecf89117253eca45)

        • CHANGES
        • tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java
        • tajo-core/src/test/resources/queries/TestJoinQuery/testNaturalJoin.sql
        • tajo-core/src/test/resources/results/TestJoinQuery/testNaturalJoin.result
        • tajo-plan/src/main/java/org/apache/tajo/plan/algebra/BaseAlgebraVisitor.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #689 (See https://builds.apache.org/job/Tajo-master-build/689/ ) TAJO-1574 : Fix NPE on natural join. (jihoonson: rev 1971d85fce473da5cec407adecf89117253eca45) CHANGES tajo-algebra/src/main/java/org/apache/tajo/algebra/Join.java tajo-core/src/test/resources/queries/TestJoinQuery/testNaturalJoin.sql tajo-core/src/test/resources/results/TestJoinQuery/testNaturalJoin.result tajo-plan/src/main/java/org/apache/tajo/plan/algebra/BaseAlgebraVisitor.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestJoinQuery.java

          People

          • Assignee:
            dongjoon Dongjoon Hyun
            Reporter:
            dongjoon Dongjoon Hyun
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development