问题描述: 通过Hive-exec解析HQL语句时,出现解析异常。
发现问题在解析set hive.vectorized.execution.enabled=false; 网上也没有搜索到解决方案。
并且该语句在HUE上执行是正常的。求大神指导
package hql;
import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.parser.SQLParserUtils;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import org.apache.hadoop.hive.ql.parse.ParseException;
import org.apache.hadoop.hive.ql.parse.ParseUtils;
import org.springframework.util.Assert;
import java.util.List;
public class Parser {
public static void main(String[] args) throws ParseException {
String hql = "-- 目 标 表:[std.sp_ft_fmbn_write_off_detail_a] [核销明细]n" +
"-- 源 表 名:n" +
"-- [dv.sat_wangdai_pluton_zeus_acct_write_off_bill_4_l] n" +
"-- [dv.sat_wangdai_pluton_zeus_acct_write_off_bill_detail_4_l]n" +
"-- [dv.sat_wangdai_pluton_adam_acct_write_off_bill_4_l]n" +
"-- [dv.sat_wangdai_pluton_adam_acct_write_off_bill_detail_4_l]n" +
"-- [dv.sat_ft_pluton_zeus_acct_loan_bill]n" +
"-- [dv.sat_ft_pluton_zeus_pf_category_product]n" +
"-- [dv.sat_ft_pluton_zeus_acct_ious]n" +
"-- [dv.sat_ft_pluton_zeus_acct_five_classification]n" +
"-- [dv.sat_wangdai_pluton_zeus_pf_category_business]n" +
"-- 源表码值:n" +
"-- 加载策略: [03] (注,00:其他 01:覆盖,02:更新,03:追加,04:拉链)n" +
"-- 运行周期: [1] (注, 1:天,2:星期,3:旬,4:月,5:季,6:半年,7:年,00:其他)n" +
"-- 脚本功能: 核销明细n" +
"-- 创建时间: 2018-09-17n" +
"-- 文 件 名: sp_ft_fmbn_write_off_detail_a.hqln" +
"-- 作 者: " +
"-- 修改记录:n" +
"n" +
"n" +
"n" +
"INSERT INTO pdm.job_log_detail (data_date,tab_title,tab_name,job_step,job_time,job_info)n" +
"SELECT '2020-09-24','std','sp_ft_fmbn_write_off_detail_a','00',current_timestamp(),'start' ;n" +
"n" +
"--清空数据n" +
"TRUNCATE TABLE std.sp_ft_fmbn_write_off_detail_a ;n" +
"n" +
"n" +
"--创建临时表 std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_4_ln" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_4_l;n" +
"n" +
"n" +
"CREATE TEMPORARY table std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_4_l asn" +
"SELECT t.*n" +
" FROMn" +
" (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_wangdai_pluton_zeus_acct_write_off_bill_4_l_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_wangdai_pluton_zeus_acct_write_off_bill_4_l as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" AND t.sat_del_flag='0'n" +
";n" +
"n" +
"--创建临时表 std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_detail_4_ln" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_detail_4_l;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_pluton_zeus_acct_write_off_bill_detail_4_l asn" +
"SELECT t.write_off_bill_id,n" +
" sum(case when t.write_off_subject='PRI' then t.write_off_subject_amt else 0 end) pri_writeoff_amt,--本金n" +
"t sum(case when t.write_off_subject='INT' then t.write_off_subject_amt else 0 end) int_writeoff_amt,--利息n" +
"t sum(case when t.write_off_subject='PIN' then t.write_off_subject_amt else 0 end) pin_writeoff_amt--罚息n" +
" FROMn" +
" (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_wangdai_pluton_zeus_acct_write_off_bill_detail_4_l_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_wangdai_pluton_zeus_acct_write_off_bill_detail_4_l as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" AND t.sat_del_flag='0'n" +
" GROUP BY t.write_off_bill_idtn" +
";n" +
"n" +
"n" +
"--创建临时表 std.temp_ft_write_off_pluton_adam_acct_write_off_bill_4_ln" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_pluton_adam_acct_write_off_bill_4_l;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_pluton_adam_acct_write_off_bill_4_l asn" +
"SELECT t.*n" +
" FROMn" +
" (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_wangdai_pluton_adam_acct_write_off_bill_4_l_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_wangdai_pluton_adam_acct_write_off_bill_4_l as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" AND t.sat_del_flag='0'n" +
";n" +
"n" +
"--创建临时表 std.temp_ft_write_off_pluton_adam_acct_write_off_bill_detail_4_ln" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_pluton_adam_acct_write_off_bill_detail_4_l;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_pluton_adam_acct_write_off_bill_detail_4_l asn" +
"SELECT t.write_off_bill_id,n" +
" sum(case when t.write_off_subject='PRI' then t.write_off_subject_amt else 0 end) pri_writeoff_amt,--本金n" +
"t sum(case when t.write_off_subject='INT' then t.write_off_subject_amt else 0 end) int_writeoff_amt,--利息n" +
"t sum(case when t.write_off_subject='PIN' then t.write_off_subject_amt else 0 end) pin_writeoff_amt--罚息n" +
" FROMn" +
" (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_wangdai_pluton_adam_acct_write_off_bill_detail_4_l_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_wangdai_pluton_adam_acct_write_off_bill_detail_4_l as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" AND t.sat_del_flag='0'n" +
" GROUP BY t.write_off_bill_idtn" +
";n" +
"n" +
"--创建临时表 std.temp_ft_write_off_acct_acct_loan_billn" +
" DROP TABLE IF EXISTS std.temp_ft_write_off_acct_acct_loan_bill;n" +
" CREATE TEMPORARY table std.temp_ft_write_off_acct_acct_loan_bill asn" +
" SELECT t.*n" +
" FROM (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_ft_pluton_zeus_acct_loan_bill_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_ft_pluton_zeus_acct_loan_bill as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" ;n" +
" n" +
"--创建临时表 std.temp_ft_write_off_pf_category_productn" +
" DROP TABLE IF EXISTS std.temp_ft_write_off_pf_category_product;n" +
" CREATE TEMPORARY table std.temp_ft_write_off_pf_category_product asn" +
" SELECT t.*n" +
" FROM (SELECT t01.* ,row_number() over(partition by t01.hub_ft_pluton_zeus_pf_category_product_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_ft_pluton_zeus_pf_category_product as t01n" +
" WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
" ; n" +
" n" +
"--创建临时表 std.temp_ft_write_off_acct_iousn" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_acct_ious;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_acct_ious asn" +
"SELECT t.*n" +
" FROM (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_ft_pluton_zeus_acct_ious_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_ft_pluton_zeus_acct_ious as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
"; n" +
"n" +
"--创建临时表 std.temp_ft_write_off_acct_five_classificationn" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_acct_five_classification;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_acct_five_classification asn" +
"SELECT t.*n" +
" FROM (n" +
" SELECT t01.*n" +
" ,row_number() over(partition by t01.hub_ft_pluton_zeus_acct_five_classification_key order by sat_load_dts desc) as rownn" +
" FROM dv.sat_ft_pluton_zeus_acct_five_classification as t01 WHERE sat_load_dts<='2020-09-24'n" +
" ) as tn" +
" WHERE t.rown=1n" +
";n" +
"n" +
"--创建临时表 std.temp_ft_write_off_pf_category_businessn" +
"DROP TABLE IF EXISTS std.temp_ft_write_off_pf_category_business;n" +
"CREATE TEMPORARY table std.temp_ft_write_off_pf_category_business asn" +
"SELECT t.*n" +
"FROM (select t01.* ,row_number() over(partition by t01.hub_wangdai_pluton_zeus_pf_category_business_key order by sat_load_dts desc) as rownn" +
"tt FROM dv.sat_wangdai_pluton_zeus_pf_category_business as t01n" +
"tt WHERE sat_load_dts<='2020-09-24'n" +
"t ) as tn" +
"WHERE t.rown=1n" +
";n" +
"n" +
"set hive.vectorized.execution.enabled=false;n" +
"n" +
"INSERT INTO std.sp_ft_fmbn_write_off_detail_an" +
"(n" +
" load_timen" +
" ,sp_load_dtsn" +
" ,busi_date --业务日期n" +
"t,serail_no --核销明细流水号n" +
"t,loanwriteoffid --贷款核销申请号n" +
"t,loan_id --借据号n" +
"t,mxkmbh --明细科目编号n" +
"t,mxkmmc --明细科目名称n" +
"t,five_class --五级分类n" +
"t,amt_all --全额核销贷款金额n" +
"t,amt_part --差额核销贷款金额n" +
"t,write_off_date --核销日期n" +
"t,write_off_time --核销时间n" +
"t,plan_date --还款计划状态n" +
"t,out_flg --非应计标识n" +
"t,write_off_amt --核销金额n" +
"t,write_off_prin_amt --本金核销金额n" +
"t,write_off_int_amt --利息核销金额n" +
"t,write_off_pnlt_amt --罚息核销金额n" +
"t,write_off_cmpd_amt --复利核销金额n" +
"t,write_off_fee_amt --费用核销金额n" +
"t,owner_write_off_amt --额n" +
"t,owner_write_off_prin_amt --金n" +
"t,owner_write_off_int_amt --息n" +
"t,owner_write_off_pnlt_amt --息n" +
"t,owner_write_off_cmpd_amt --n" +
"t,owner_write_off_fee_amt --n" +
"t,fund_write_off_amt --额n" +
"t,fund_write_off_prin_amt --本金n" +
"t,fund_write_off_int_amt --利息n" +
"t,fund_write_off_pnlt_amt --息n" +
"t,fund_write_off_cmpd_amt --利n" +
"t,fund_write_off_fee_amt --用n" +
"