我对Talend&Hive还是很陌生,我正在尝试在thiverow节点中使用以下查询在hive中创建表,但我不断收到以下错误消息:
ParseException行3:0无法识别在'With''b''as'中的输入 声明
任何人都能对此表示感谢,在此先感谢您!
代码
"insert into " + context.lakeHiveDb + ".voucher_redemption PARTITION (country)
With b as (
select
branch,
description,
case
when country in ('GB','IE') then 'UK'
when country in ('AT') then 'DE'
else country end as country
from " + context.lakeHiveDb + ".distribution_centre_location
)
SELECT
a.HEBRAN as BRANCH_CODE,
case
when b.branch = '' then a.HEBRAN
else b.description end as BRANCH_CODE_DESCRIPTION,
a.HECUST as ACCOUNT_NUMBER,
a.HEVKOR as ORDER_NUMBER,
a.HEVKIN as INVOICE_NUMBER,
a.HELINE as LINE_NUMBER,
a.HEORD as WEB_ORDER_NUMBER,
a.HESUB as WEB_ORDER_SUB,
split(a.HECATC, '\\-')[0] as EFFORT_CODE,
split(a.HECATC, '\\-')[1] as SKU,
a.HEPRCT as PRICING_TYPE,
a.HEODIS as ORIGINAL_DISCOUNT_VALUE,
a.HECDIS as CURRENT_DISCOUNT_VALUE,
a.HEDITM as DISCOUNT_ITEM_CODE,
a.HEVCDE as CUSTOMER_VOUCHER_CODE,
a.HEDDES as DISCOUNT_DESC,
a.HEORUN as ORIGINAL_UNIT_PRICE,
a.HEOQTY as ORDER_QUANTITY,
a.HEDQTY as DESPATCHED_QUANTITY,
a.HEOOQT as ORIGINAL_ORDER_QTY,
a.HECRDT as ORDER_CREATE_DATE,
a.HEUPPG as UPDATED_BY_PROGRAM,
a.RECORD_TYPE,
a.MODIFIED_DTTM,
CURRENT_TIMESTAMP as processed_dttm,
a.COUNTRY
from " + context.rawHiveDb + ".raw_hyope a
left outer join b
ON (a.HEBRAN = b.branch) AND (a.COUNTRY = b.COUNTRY)
WHERE '" + context.EXTRACT_FROM_DTTM + "' < a.processed_dttm
and a.processed_dttm <= '" + context.EXTRACT_TO_DTTM + "'
"