Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-20342

Create table from CTAS with location fails for managed tables

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Duplicate
    • Affects Version/s: 3.0.0
    • Fix Version/s: None
    • Component/s: Beeline, HiveServer2
    • Labels:
      None

      Description

      When attempting to create table from SELECT with LOCATION  (managed tables)

       

      To reproduce CREATE source table CLASS with some data

      then use the code below to CREATE table TABLE42 from select on CLASS and LOCATION /tmp/test1

       

      CREATE TABLE TABLE42 ROW FORMAT SERDE
      'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' STORED AS RCFILE
      LOCATION '/tmp/test1'
      AS SELECT * FROM
      CLASS;
      

       

      it fails with ERROR:

      ERROR : Job Commit failed with exception 'org.apache.hadoop.hive.ql.metadata.HiveException(The following files were committed but not found: [/tmp/test1/delta_0000001_0000001_0000/000000_0])' 
      org.apache.hadoop.hive.ql.metadata.HiveException: The following files were committed but not found: [/tmp/test1/delta_0000001_0000001_0000/000000_0] 
      at org.apache.hadoop.hive.ql.exec.Utilities.handleMmTableFinalPath(Utilities.java:4329) 
      at org.apache.hadoop.hive.ql.exec.FileSinkOperator.jobCloseOp(FileSinkOperator.java:1393) 
      

       

      If the same is attempted for an EXTERNAL table will work OK

      CREATE EXTERNAL TABLE test3 ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' STORED AS RCFILE LOCATION '/tmp/test2' AS SELECT * FROM test;
      

      if we CREATE table on statement 1, and INSERT from SELECT on statement 2 , will work OK.

      (Step1 CREATE TABLE)

      CREATE TABLE `TABLE42`( 
      `COL1` double, 
      `COL2` varchar(8), 
      `COL3` varchar(1), 
      `COL4` double, 
      `COL5` double) 
      ROW FORMAT SERDE 
      'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe' 
      STORED AS INPUTFORMAT 
      'org.apache.hadoop.hive.ql.io.RCFileInputFormat' 
      OUTPUTFORMAT 
      'org.apache.hadoop.hive.ql.io.RCFileOutputFormat' 
      LOCATION '/tmp/test1';
      
      

      (Step2 INSERT from SELECT)

      INSERT into TABLE42 select * FROM CLASS;
      

      will work as expected.

       

      Thanks

      Pablo

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pidiaquez Pablo Idiaquez
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: