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

"insert into select" with reordered column list does not work.

    Details

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

      Description

      Using "insert into table1 (colums, ...) select " statement, users can fill part of table and tajo already had this feature.
      If columns are given in the same order as table definition, it seems to work well.
      Otherwise, the results are reversed.
      This bug can be reproduced easily as shown below (table1 is same as in http://tajo.apache.org/docs/0.8.0/getting_started/first_query.html).

      create table t1 (id int, name text, score float, type text);
      insert into t1 (type, name) select type, name from table1;
      default> select * from t1;
      id,  name,  score,  type
      -------------------------------
      ,  a,  ,  abc
      ,  b,  ,  def
      

      But, the expected result is as follows.

      default> select * from t1;
      id,  name,  score,  type
      -------------------------------
      ,  abc,  ,  a
      ,  def,  ,  b
      
      1. TAJO-1556_add_test.patch
        10 kB
        Jihoon Son
      2. TAJO-1556.patch
        5 kB
        Yongjin Choi

        Activity

        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #333 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/333/)
        TAJO-1556: "insert into select" with reordered column list does not work. (jihoonson: rev 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746)

        • tajo-core/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql
        • tajo-core/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl
        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
        • tajo-core/src/test/resources/results/TestInsertQuery/testInsertWithDifferentColumnOrder.result
        • tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
        • CHANGES
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
        • tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #333 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/333/ ) TAJO-1556 : "insert into select" with reordered column list does not work. (jihoonson: rev 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746) tajo-core/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql tajo-core/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java tajo-core/src/test/resources/results/TestInsertQuery/testInsertWithDifferentColumnOrder.result tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java CHANGES tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #694 (See https://builds.apache.org/job/Tajo-master-build/694/)
        TAJO-1556: "insert into select" with reordered column list does not work. (jihoonson: rev 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746)

        • CHANGES
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
        • tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java
        • tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java
        • tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java
        • tajo-core/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql
        • tajo-core/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl
        • tajo-core/src/test/resources/results/TestInsertQuery/testInsertWithDifferentColumnOrder.result
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #694 (See https://builds.apache.org/job/Tajo-master-build/694/ ) TAJO-1556 : "insert into select" with reordered column list does not work. (jihoonson: rev 9b3824b5f0c64af42bfcf0a6bb8d3555c22c5746) CHANGES tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/Schema.java tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalPlanner.java tajo-plan/src/main/java/org/apache/tajo/plan/LogicalPlanner.java tajo-core/src/test/resources/queries/TestInsertQuery/testInsertWithDifferentColumnOrder.sql tajo-core/src/test/resources/queries/TestInsertQuery/nation_diff_col_order.ddl tajo-core/src/test/resources/results/TestInsertQuery/testInsertWithDifferentColumnOrder.result
        Hide
        jihoonson Jihoon Son added a comment -

        Committed to master and 0.10.1.
        Thanks Yongjin Choi.

        Show
        jihoonson Jihoon Son added a comment - Committed to master and 0.10.1. Thanks Yongjin Choi .
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

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

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/546
        Hide
        jhkim Jinho Kim added a comment -

        +1

        Show
        jhkim Jinho Kim added a comment - +1
        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/12730726/TAJO-1556_add_test.patch
        against master revision release-0.9.0-rc0-281-gb6b9d46.

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

        +1 tests included. The patch appears to include 5 new or modified test files.

        +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-catalog/tajo-catalog-common tajo-core tajo-plan.

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/770//testReport/
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/770//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/12730726/TAJO-1556_add_test.patch against master revision release-0.9.0-rc0-281-gb6b9d46. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 5 new or modified test files. +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-catalog/tajo-catalog-common tajo-core tajo-plan. Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/770//testReport/ Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/770//console This message is automatically generated.
        Hide
        jihoonson Jihoon Son added a comment -

        Since we scheduled this issue for 0.10.1 but Yongjin Choi looks busy, I've added a new test for query result verification.
        Here is the patch. Please review it.

        Show
        jihoonson Jihoon Son added a comment - Since we scheduled this issue for 0.10.1 but Yongjin Choi looks busy, I've added a new test for query result verification. Here is the patch. Please review it.
        Hide
        hyunsik Hyunsik Choi added a comment - - edited

        Yongjin Choi,

        I think that it would be great if we add it to 0.10.1.

        Show
        hyunsik Hyunsik Choi added a comment - - edited Yongjin Choi , I think that it would be great if we add it to 0.10.1.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user jihoonson commented on the pull request:

        https://github.com/apache/tajo/pull/546#issuecomment-97628217

        Thanks for your work.
        I've looked over your patch. It looks good to me, but will be great if you add a test for query execution in addition to the existing planner test.

        Show
        githubbot ASF GitHub Bot added a comment - Github user jihoonson commented on the pull request: https://github.com/apache/tajo/pull/546#issuecomment-97628217 Thanks for your work. I've looked over your patch. It looks good to me, but will be great if you add a test for query execution in addition to the existing planner test.
        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/12726492/TAJO-1556.patch
        against master revision release-0.9.0-rc0-268-g044fd49.

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

        +1 tests included. The patch appears to include 1 new or modified test files.

        +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 appears to introduce 18 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-catalog/tajo-catalog-common tajo-core tajo-plan.

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/750//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/750//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/750//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/12726492/TAJO-1556.patch against master revision release-0.9.0-rc0-268-g044fd49. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 1 new or modified test files. +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 appears to introduce 18 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-catalog/tajo-catalog-common tajo-core tajo-plan. Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/750//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/750//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/750//console This message is automatically generated.
        Hide
        yongjin.choi Yongjin Choi added a comment -

        There was a bug in buildProjectedInsert().
        The target columns of “insert into” were always referenced in the order of projectionNode's columns.
        I fixed that bug, and add a corresponding test case.

        Show
        yongjin.choi Yongjin Choi added a comment - There was a bug in buildProjectedInsert(). The target columns of “insert into” were always referenced in the order of projectionNode's columns. I fixed that bug, and add a corresponding test case.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user superpiggy opened a pull request:

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

        TAJO-1556: "insert into select" with reordered column list does not work.

        fixed a bug in buildProjectedInsert.

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

        $ git pull https://github.com/superpiggy/tajo TAJO-1556

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

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


        commit 2a69ecd89fa336e6bf1408f1214a820d5090ce65
        Author: Yongjin Choi <superpiggy@gmail.com>
        Date: 2015-04-20T00:06:44Z

        TAJO-1556: fix a bug in buildProjectedInsert


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user superpiggy opened a pull request: https://github.com/apache/tajo/pull/546 TAJO-1556 : "insert into select" with reordered column list does not work. fixed a bug in buildProjectedInsert. You can merge this pull request into a Git repository by running: $ git pull https://github.com/superpiggy/tajo TAJO-1556 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/546.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 #546 commit 2a69ecd89fa336e6bf1408f1214a820d5090ce65 Author: Yongjin Choi <superpiggy@gmail.com> Date: 2015-04-20T00:06:44Z TAJO-1556 : fix a bug in buildProjectedInsert

          People

          • Assignee:
            yongjin.choi Yongjin Choi
            Reporter:
            yongjin.choi Yongjin Choi
          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development