Presto查询无法将数据插入Hive

时间:2018-05-02 11:47:26

标签: hadoop hive hiveql presto

我正在尝试将数据插入配置单元。为此,我使用的是Presto。

这是我的问题:

insert into card_transactions_part_buck partition(tran_year,tran_month,tran_day)
select tran_id,
tran_uid,
tran_date,
tran_category,
tran_category_id,
tran_type,
tran_type_id,
tran_ingress_ip_address,
tran_ingress_api_name,
tran_ingress_api_id,
platform,
platform_id,
card_type,
card_type_id,
amount,re_amount,
fxrate,
currency,
currency_id,
term_provider,
term_provider_id,
term_merchant,
term_merchant_id,
term_spendcode,
term_spendcode_id,
term_ip_address,
term_country,
term_country_id,
term_countrycode,
term_stateregion,
term_stateregion_id,
term_city,term_city_id,
term_postcode,
cust_first_name,
cust_last_name,
cust_email,
cust_ip_address,
cust_city,
cust_city_id,
cust_postcost,
cust_country,
cust_country_id,
cust_address,
SUBSTR(tran_date,0,4) as tran_year,
SUBSTR(tran_date,6,2) as tran_month,
SUBSTR(tran_date,9,2) as tran_day
from card_transactions;

我遇到以下异常:

Query 20180502_113622_00037_xt6fw failed: line 1:41: extraneous input 'partition' expecting {'.', '(', 'SELECT', 'TABLE', 'VALUES', 'WITH'}

当我在Hive shell中运行相同的查询时,它的工作完全正常。

1 个答案:

答案 0 :(得分:1)

您不需要partition(tran_year,tran_month,tran_day)

insert into card_transactions_part_buck 
select 
tran_id,
tran_uid,
tran_date,
tran_category,
tran_category_id,
tran_type,
tran_type_id,
tran_ingress_ip_address,
tran_ingress_api_name,
tran_ingress_api_id,
platform,
platform_id,
card_type,
card_type_id,
amount,re_amount,
fxrate,
currency,
currency_id,
term_provider,
term_provider_id,
term_merchant,
term_merchant_id,
term_spendcode,
term_spendcode_id,
term_ip_address,
term_country,
term_country_id,
term_countrycode,
term_stateregion,
term_stateregion_id,
term_city,term_city_id,
term_postcode,
cust_first_name,
cust_last_name,
cust_email,
cust_ip_address,
cust_city,
cust_city_id,
cust_postcost,
cust_country,
cust_country_id,
cust_address,
SUBSTR(tran_date,0,4) as tran_year,
SUBSTR(tran_date,6,2) as tran_month,
SUBSTR(tran_date,9,2) as tran_day
from card_transactions;