hive从cdh3机器中的两个oracle表插入/追加数据

daolsyd0  于 2021-06-02  发布在  Hadoop
关注(0)|答案(1)|浏览(319)

我将数据从oracle表加载到hdfs,然后加载到外部配置单元表。在添加了addition列(“source”)之后,最终将数据移动到配置单元内部表中。
oracle table usa\u transaction=>hdfs=>外部配置单元表=>添加列[中间表“temp”]=>配置单元内部表
已将数据[美国事务]加载到配置单元内部table:-

from temp INSERT OVERWRITE TABLE ds_transaction PARTITION(source)

select tran_id,
acct_id ,
tran_date,
amount ,
description ,
branch_code ,
product,
tran_state ,
tran_city ,
tran_zip ,
spendby,source DISTRIBUTE BY source;

以上查询工作正常。
现在,我对加拿大事务表执行了相同的过程
尝试使用以下查询将数据加载到最终配置单元表时:-

from temp INSERT  TABLE ds_transaction PARTITION(source)

select tran_id,
acct_id ,
tran_date,
amount ,
description ,
branch_code ,
product,
tran_state ,
tran_city ,
tran_zip ,
spendby,source DISTRIBUTE BY source;

获取错误:-“输入不匹配”到“insert子句中需要覆盖”
注意:如果在第二次查询中使用覆盖,则[美国交易]的现有数据将丢失。
请建议我。

c0vxltue

c0vxltue1#

把你的陈述改成包含“into”。这将附加数据而不是覆盖它。

from temp INSERT INTO TABLE ds_transaction PARTITION(source)

select tran_id, acct_id , tran_date, amount , description , branch_code , product, tran_state , tran_city , tran_zip , spendby,source DISTRIBUTE BY source;

相关问题