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

INSERT INTO without FROM throws ClassCastException.

    Details

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

      Description

      The following query throws ClassCastException in the TajoMaster.

      default> create table temp_table (id int, name text)  using csv with ('csvfile.delimiter'='|');
      default> insert overwrite into temp_table select 123::int4 as id, 'abc' as name;
      ERROR: org.apache.tajo.engine.planner.logical.EvalExprNode cannot be cast to org.apache.tajo.engine.planner.logical.ProjectionNode
      

      TajoMaster's log

      java.lang.ClassCastException: org.apache.tajo.engine.planner.logical.EvalExprNode cannot be cast to org.apache.tajo.engine.planner.logical.ProjectionNode
              at org.apache.tajo.engine.planner.LogicalPlanner.buildProjectedInsert(LogicalPlanner.java:1237)
              at org.apache.tajo.engine.planner.LogicalPlanner.buildInsertIntoTablePlan(LogicalPlanner.java:1224)
              at org.apache.tajo.engine.planner.LogicalPlanner.visitInsert(LogicalPlanner.java:1140)
              at org.apache.tajo.engine.planner.LogicalPlanner.visitInsert(LogicalPlanner.java:58)
              at org.apache.tajo.engine.planner.BaseAlgebraVisitor.visit(BaseAlgebraVisitor.java:123)
              at org.apache.tajo.engine.planner.LogicalPlanner.createPlan(LogicalPlanner.java:121)
              at org.apache.tajo.engine.planner.LogicalPlanner.createPlan(LogicalPlanner.java:108)
              at org.apache.tajo.master.GlobalEngine.createLogicalPlan(GlobalEngine.java:341)
              at org.apache.tajo.master.GlobalEngine.executeQuery(GlobalEngine.java:144)
              at org.apache.tajo.master.TajoMasterClientService$TajoMasterClientProtocolServiceHandler.submitQuery(TajoMasterClientService.java:260)
              at org.apache.tajo.ipc.TajoMasterClientProtocol$TajoMasterClientProtocolService$2.callBlockingMethod(TajoMasterClientProtocol.java:495)
              at org.apache.tajo.rpc.BlockingRpcServer$ServerHandler.messageReceived(BlockingRpcServer.java:103)
              at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
              at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
              at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
              at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
              at org.jboss.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:70)
      
      1. TAJO-803.patch
        28 kB
        Hyoungjun Kim
      2. TAJO-803_2.patch
        29 kB
        Hyunsik Choi

        Activity

        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/12642698/TAJO-803.patch
        against master revision 08bcc2d.

        +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 187 new Findbugs (version 1.3.9) 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-client tajo-core.

        Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/411//testReport/
        Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/411//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html
        Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/411//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/12642698/TAJO-803.patch against master revision 08bcc2d. +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 187 new Findbugs (version 1.3.9) 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-client tajo-core. Test results: https://builds.apache.org/job/PreCommit-TAJO-Build/411//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-TAJO-Build/411//artifact/incubator-tajo/patchprocess/newPatchFindbugsWarningstajo-core.html Console output: https://builds.apache.org/job/PreCommit-TAJO-Build/411//console This message is automatically generated.
        Hide
        hjkim Hyoungjun Kim added a comment -

        Please review this patch. I create a review request.
        https://reviews.apache.org/r/20909/

        Show
        hjkim Hyoungjun Kim added a comment - Please review this patch. I create a review request. https://reviews.apache.org/r/20909/
        Hide
        hyunsik Hyunsik Choi added a comment -

        +1

        The patch looks nice to me. The patch omits one case where the schema of target table and the schema of expressions are different to each other.

        Example:

        create table TEST (col1 int4, col2 float4, col3 text);
        insert overwrite into TEST  (col1, col3) select 1::INT4, 'test';
        

        This needs only trivial change. So, I've fixed slightly LogicalPlanner::buildProjectedInsert() as follows:

        if (child instanceof Projectable) {
              Projectable projectionNode = (Projectable) insertNode.getChild();
        
              // Modifying projected columns by adding NULL constants
              // It is because that table appender does not support target columns to be written.
              List<Target> targets = TUtil.newList();
        

        Also, I've added one more unit test case for reproducing the case I mentioned.

        Thank you for your contribution. I'll commit the patch shortly.

        Show
        hyunsik Hyunsik Choi added a comment - +1 The patch looks nice to me. The patch omits one case where the schema of target table and the schema of expressions are different to each other. Example: create table TEST (col1 int4, col2 float4, col3 text); insert overwrite into TEST (col1, col3) select 1::INT4, 'test'; This needs only trivial change. So, I've fixed slightly LogicalPlanner::buildProjectedInsert() as follows: if (child instanceof Projectable) { Projectable projectionNode = (Projectable) insertNode.getChild(); // Modifying projected columns by adding NULL constants // It is because that table appender does not support target columns to be written. List<Target> targets = TUtil.newList(); Also, I've added one more unit test case for reproducing the case I mentioned. Thank you for your contribution. I'll commit the patch shortly.
        Hide
        hyunsik Hyunsik Choi added a comment -

        committed it to master branch. Thanks!

        Show
        hyunsik Hyunsik Choi added a comment - committed it to master branch. Thanks!
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #218 (See https://builds.apache.org/job/Tajo-master-build/218/)
        TAJO-803: INSERT INTO without FROM throws ClassCastException. (Hyoungjun Kim via hyunsik) (hyunsik: rev 8e8004698f4bd891a415fcc62add59998ced2ae3)

        • tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/StoreTableExec.java
        • tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java
        • tajo-core/src/main/java/org/apache/tajo/worker/TaskAttemptContext.java
        • tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java
        • CHANGES
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/EvalExprExec.java
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java
        • tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java
        • tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java
        • tajo-core/src/main/java/org/apache/tajo/master/querymaster/Query.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #218 (See https://builds.apache.org/job/Tajo-master-build/218/ ) TAJO-803 : INSERT INTO without FROM throws ClassCastException. (Hyoungjun Kim via hyunsik) (hyunsik: rev 8e8004698f4bd891a415fcc62add59998ced2ae3) tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/StoreTableExec.java tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestInsertQuery.java tajo-core/src/main/java/org/apache/tajo/worker/TaskAttemptContext.java tajo-core/src/main/java/org/apache/tajo/master/querymaster/QueryMasterTask.java CHANGES tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/EvalExprExec.java tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalPlanner.java tajo-client/src/main/java/org/apache/tajo/client/TajoClient.java tajo-core/src/main/java/org/apache/tajo/master/GlobalEngine.java tajo-core/src/main/java/org/apache/tajo/master/querymaster/Query.java

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development