无法将数据加载到配置单元表中

aurhwmvo  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(395)

将数据加载到配置单元表时,出现以下错误:

"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;
sxissh06

sxissh061#

表中已经存在的数据将被丢弃,因为这到底是什么 OVERWRITE 手段。
如果要追加而不是截断,请使用 INSERT INTO TABLE (或 INSERT INTO 在较新版本中)。
附笔。
您不需要外部查询。

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  
;

相关问题