0
create external table transaction_usa_canada
(
tran_id int,
acct_id int,
tran_date string,
amount double,
description string,
branch_code string,
product string,
tran_state string,
tran_city string,
speendby string,
tran_zip int,
source_table string
)
row format delimited
stored as textfile
location '/user/DSNew18/Bank_DS18/tran_usa_canada';




INSERT INTO TABLE myproject.transaction_usa_canada 
SELECT tran_id, acct_id, tran_date, amount, description, branch_code,'', tran_state, tran_city, speendby, tran_zip, 'usa' AS source_table FROM transaction_usanew18
UNION ALL
SELECT tran_id, acct_id, tran_date, amount, description, branch_code,'', tran_state, tran_city, speendby, tran_zip, 'canada' AS source_table FROM transaction_canadanew18;

上記は、他の2つの外部テーブルを組み合わせてハイブの外部テーブルに挿入するクエリです。すべてが正常に動作します。問題は、テーブルに格納されるデータがコンマで区切られていないことです。コンマ区切り形式でデータを取得するには、どのような変更を加える必要がありますか。

4

2 に答える 2