В запросе Presto не удается вставить данные в Hive - PullRequest
0 голосов
/ 02 мая 2018

Я пытаюсь вставить данные в улей. Для этого я использую 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, он работает совершенно нормально.

1 Ответ

0 голосов
/ 02 мая 2018

Вам не нужно 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;
...