0
我有2個配置單元表。配置單元從1個表插入覆蓋到另一個不同列數
源表有以下欄目:
correspondence_id | decimal(22,0) | |
| template_id | decimal(18,0) | |
| language_cd | varchar(6) | |
| delivery_channel_cd | varchar(20) | |
| job_id | decimal(18,0) | |
| correspondence_content | string | |
| create_user_id | varchar(40) | |
| create_ts | timestamp | |
| last_updt_user_id | varchar(40) | |
| last_updt_ts | timestamp | |
| data_src_id | decimal(18,0) | |
| src_app_resource_cd | varchar(50)
目的有以下欄目:
correspondence_id | decimal(22,0) | |
| template_id | decimal(18,0) | |
| template_cd | varchar(20) | |
| template_type_cd | varchar(40) | |
| category_cd | varchar(20) | |
| language_cd | varchar(6) | |
| delivery_channel_cd | varchar(20) | |
| job_id | decimal(18,0) | |
| correspondence_content | string | |
| create_user_id | varchar(40) | |
| create_ts | timestamp | |
| last_updt_user_id | varchar(40) | |
| last_updt_ts | timestamp | |
| data_src_id | decimal(18,0) | |
| src_app_resource_cd | varchar(50) | |
| part_create_year_num | int | |
| part_create_month_num | int | |
| | NULL | NULL |
| # Partition Information | NULL | NULL |
| # col_name | data_type | comment |
| | NULL | NULL |
| part_create_year_num | int | |
| part_create_month_num | int
進出口使用下面的查詢來傳輸數據:
FROM source_table cc insert overwrite table
destination_table partition
(part_create_year_num=2016, part_create_month_num=9)
select cc.correspondence_id, cc.template_id, cc.language_cd, cc.delivery_channel_cd, cc.job_id,
cc.correspondence_content, cc.create_user_id, cc.create_ts, cc.last_updt_user_id, cc.last_updt_ts,
cc.data_src_id, cc.src_app_resource_cd
但是當我運行此查詢我收到以下錯誤
rror: Error while compiling statement: FAILED: SemanticException [Error 10044]: Line 1:79 Cannot insert into target table because column number/types are different '9': Table insclause-0 has 15 columns, but query has 12 columns. (state=42000,code=10044)
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10044]: Line 1:79 Cannot insert into target table because column number/types are different '9': Table insclause-0 has 15 columns, but query has 12 columns.
明顯的來源和目的地表是不同的,但我如何使這個查詢工作,我試着把佔位符值,但是也沒有工作。
嘗試把空像選擇cc.correspondence_id,cc.template_id查詢相匹配的DEST表列號,「」,「」,從source_tables「0」 –