无法将数据加载到hive表中

时间:2017-03-30 07:09:43

标签: hadoop hive hadoop2 bigdata

在将数据加载到Hive表时,我遇到了以下错误:

"Loading data to table test.temp1
Moved: 'hdfs://mdckd.kk.hyy.com:8020/apps/hive/warehouse/test.db/temp1/000000_0' to trash at: hdfs://mdckd.kk.hyy.com:8020/user/lams/.Trash/Current
Table test.temp1 stats: [numFiles=1014, numRows=0, totalSize=50113, rawDataSize=0]"

看起来我的数据会变废为止,但我不明白为什么。请帮忙。以下是我的表定义和我正在使用的查询:

      CREATE TABLE `temp1`(
      `col1` int,
      `col2` int,
      `col3` int,
      `col4` int,
      `col5` int,
      `col6` int,
      `col7` int,
      `col8` int,
      `col9` int,
      `col10` int)
      ROW FORMAT SERDE
       'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
       STORED AS INPUTFORMAT
       'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
        OUTPUTFORMAT
       'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
       LOCATION
       'hdfs://mdckd.kk.hyy.com:8020/apps/hive/warehouse/test.db/temp1'
       TBLPROPERTIES (
       'COLUMN_STATS_ACCURATE'='true',
       'numFiles'='548',
       'numRows'='547',
       'rawDataSize'='131280',
       'totalSize'='483505',
       'transient_lastDdlTime'='1490261019')

    INSERT OVERWRITE TABLE temp1 
    select * from
     (
       select * from tab1
       union all
       select * from tab2
       union all
       select * from tab3
       union all
       select * from tab4
       union all
       select * from tab5  
    )p;

1 个答案:

答案 0 :(得分:0)

表格中已有的数据将被废弃,因为这正是OVERWRITE的含义 如果您要追加而不是截断,请使用INSERT INTO TABLE(或更新版本中的INSERT INTO)。

P.S。

您不需要外部查询。

insert into table temp1

            select * from tab1
union all   select * from tab2
union all   select * from tab3
union all   select * from tab4
union all   select * from tab5  
;