Uploaded image for project: 'Tajo (Retired)'
  1. Tajo (Retired)
  2. TAJO-1606

IF NOT EXISTS is not checked for CTAS queries

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Not A Problem
    • None
    • 0.11.0
    • QueryMaster
    • None

    Description

      When there is a table named test, the following query should not be executed.

      default> create table if not exists test (n_nationkey int8, n_name text, n_comment text) partition by column (n_regionkey int8) as select * from nation;
      Progress: 100%, response time: 0.544 sec
      (25 rows, 0.544 sec, 317 B inserted)
      

      However, according to the log, you can find AlreadyExistsTableException generated after executing the query.

      2015-05-15 15:47:13,217 INFO org.apache.tajo.master.exec.QueryExecutor: Query q_1431671196171_0006,create table if not exists test (n_nationkey int8, n_name text, n_comment text) partition by column (n_regionkey int8) as select * from nation, is forwarded to :0
      2015-05-15 15:47:13,217 INFO org.apache.tajo.master.QueryInProgress: Initializing QueryInProgress for QueryID=q_1431671196171_0006
      2015-05-15 15:47:13,219 INFO org.apache.tajo.master.QueryInProgress: Connect to QueryMaster:sonjihoonui-mbp/192.168.33.197:28093
      2015-05-15 15:47:13,221 INFO org.apache.tajo.master.QueryInProgress: Call executeQuery to :sonjihoonui-mbp:28093,q_1431671196171_0006
      2015-05-15 15:47:13,411 INFO org.apache.tajo.master.rm.TajoWorkerResourceManager: Release Resource: 0.5,512
      2015-05-15 15:47:13,686 INFO org.apache.tajo.master.QueryInProgress: Received QueryMaster heartbeat:q_1431671196171_0006,state=QUERY_RUNNING,progress=0.5, queryMaster=sonjihoonui-mbp
      2015-05-15 15:47:13,729 INFO org.apache.tajo.master.rm.TajoWorkerResourceManager: Release Resource: 0.5,512
      2015-05-15 15:47:13,759 ERROR org.apache.tajo.catalog.CatalogServer: relation " test " already exists in default
      org.apache.tajo.catalog.exception.AlreadyExistsTableException: relation " test " already exists in default
      	at org.apache.tajo.catalog.CatalogServer$CatalogProtocolHandler.createTable(CatalogServer.java:599)
      	at org.apache.tajo.catalog.CatalogProtocol$CatalogProtocolService$2.callBlockingMethod(CatalogProtocol.java:731)
      	at org.apache.tajo.rpc.BlockingRpcServer$ServerHandler.channelRead0(BlockingRpcServer.java:100)
      	at org.apache.tajo.rpc.BlockingRpcServer$ServerHandler.channelRead0(BlockingRpcServer.java:61)
      	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
      	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
      	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:182)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
      	at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
      	at org.apache.tajo.rpc.MonitorServerHandler.channelRead(MonitorServerHandler.java:70)
      	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:308)
      	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:294)
      	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
      	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:130)
      	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511)
      	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468)
      	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382)
      	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354)
      	at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
      	at java.lang.Thread.run(Thread.java:745)
      

      Attachments

        Issue Links

          Activity

            People

              hyunsik Hyunsik Choi
              jihoonson Jihoon Son
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: