HiveQL中where后面的and 和or 处理

部署运行你感兴趣的模型镜像

昨天我在尝试写一个很简单的HiveQL:语句如下

select <!subdate(date,0)!>,a.ver,a.vid,a.wid,a.type,count(*) from (select stat_date,ver,get_json_object(json,"$.vid") as vid,get_json_object(json,"$.wid") as wid,get_json_object(json,"$.type") as type from iphonevv_<!subdate(date,0)!> where  stat_date=<!subdate(date,0)!> and ver >= '3.5.0' and get_json_object(json,"$.type")=4 or  get_json_object(json,"$.type")=5 or  get_json_object(json,"$.type")=6 )a  group by a.stat_date,a.ver,a.vid,a.wid,a.type

我的想法是:stat_date=<!subdate(date,0)!> and ver >= '3.5.0',后面的都是or就行,但是结果并不是这样,出现了很多ver不是大于等于3.5.0的,我纠结了很久,都不知道是哪儿出了问题,为什么ver >= '3.5.0' 不起作用呢?今天查了下才发现,原来是where后面的and和or的问题导致。

结果后来我修改为:

select <!subdate(date,0)!>,a.ver,a.vid,a.wid,a.type,count(*) from (select stat_date,ver,get_json_object(json,"$.vid") as vid,get_json_object(json,"$.wid") as wid,get_json_object(json,"$.type") as type from iphonevv_<!subdate(date,0)!> where  stat_date=<!subdate(date,0)!> and ver >= '3.5.0' and (get_json_object(json,"$.type")=4 or  get_json_object(json,"$.type")=5 or  get_json_object(json,"$.type")=6 ))a  group by a.stat_date,a.ver,a.vid,a.wid,a.type

将or的条件放在()之内,问题就解决了。

where 后面如果有and,or的条件,则or自动会把左右的查询条件分开,即先执行and,再执行or。原因就是:and的执行优先级最高!

关系型运算符优先级高到低为:not and or

问题的解决办法是:

用()来改变执行顺序!!!!


您可能感兴趣的与本文相关的镜像

ComfyUI

ComfyUI

AI应用
ComfyUI

ComfyUI是一款易于上手的工作流设计工具,具有以下特点:基于工作流节点设计,可视化工作流搭建,快速切换工作流,对显存占用小,速度快,支持多种插件,如ADetailer、Controlnet和AnimateDIFF等

org.apache.kyuubi.KyuubiSQLException: Error operating ExecuteStatement: org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'AS' expecting {<EOF>, ';'}(line 411, pos 28) == SQL == CREATE TABLE orca01_dr_data.ads_rpt_fsm_sfm_kpi_funnel_dmo_t_1218 stored as parquet as with dealership_full as ( select distinct dealer_id ,region_code ,dealer_short_name ,dealer_short_name_en ,region_bmw_sale ,region_mini_sale ,region_moto_sale ,region_bmw_sale_en ,region_mini_sale_en ,region_moto_sale_en ,small_region_bmw_sale_en ,small_region_mini_sale_en ,small_region_moto_sale_en ,dealer_investor_name_en ,organization_id ,investor_id from cdl.cdl_dim_com_dmx_dealership_full_t where pday='20251124' ), emp_delear as ( select distinct emp.company_id ,emp.id ,emp.emp_name ,dealer.dealer_id ,dealer.organization_id ,dealer.region_bmw_sale_en ,dealer.region_mini_sale_en ,dealer.region_moto_sale_en ,dealer.small_region_bmw_sale_en ,dealer.small_region_mini_sale_en ,dealer.small_region_moto_sale_en ,dealer.investor_id from dwc.dwc_dim_com_dmo2_t_employee_full_t as emp left join dealership_full as dealer on emp.company_id=dealer.organization_id where emp.pday='20251124' ) ,funnel_base as ( select month_id ,brand_code ,series_code ,eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,leads_vol ,leads_vol_lm ,leads_vol_ly ,leads_vol_mom ,leads_vol_yoy ,leads_oppty_conv_rate ,leads_oppty_conv_rate_mom ,leads_oppty_conv_rate_yoy ,oppty_vol ,oppty_vol_lm ,oppty_vol_ly ,oppty_vol_mom ,oppty_vol_yoy ,'' as oppty_vol_others ,oppty_sr_conv_rate ,oppty_sr_conv_rate_mom ,oppty_sr_conv_rate_yoy ,sr_vol ,sr_vol_lm ,sr_vol_ly ,sr_vol_mom ,sr_vol_yoy ,sr_td_conv_rate ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4)) as sr_order_conv_rate ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4))-cast(case when sr_vol_lm=0 then null else order_vol_lm/sr_vol_lm end as decimal(32,4)) as sr_order_conv_rate_mom ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4))-cast(case when sr_vol_ly=0 then null else order_vol_ly/sr_vol_ly end as decimal(32,4)) as sr_order_conv_rate_yoy ,first_sr_vol ,re_sr_vol ,td_vol ,td_vol_lm ,td_vol_ly ,td_vol_mom ,td_vol_yoy ,order_vol ,order_vol_lm ,order_vol_ly ,order_vol_mom ,order_vol_yoy ,order_handover_conv_rate ,order_handover_conv_rate-order_handover_conv_rate_lm as order_handover_conv_rate_mom ,order_handover_conv_rate-order_handover_conv_rate_ly as order_handover_conv_rate_yoy ,canceled_order_vol ,handovered_order_vol ,handover_tbd_vol ,order_intake_vol ,order_cancel_vol ,order_cancel_rate ,order_cancel_rate_mom ,order_cancel_rate_yoy ,order_vol_with_td ,order_vol_without_td ,handover_vol ,handover_vol_lm ,handover_vol_ly ,handover_vol_mom ,handover_vol_yoy ,handover_intake_vol ,handover_cancel_vol ,cast(round(delivery_days/cus_handover_intake_vol,0) as int) as avg_delivery_days ,case when brand_code='BMW' and month_id<'202212' then cast(null as int) when brand_code='MINI' and month_id<'202304' then cast(null as int) else cast(round(delivery_days/cus_handover_intake_vol,0) - round(delivery_days_lm/cus_handover_intake_vol_lm,0) as int) end as avg_delivery_days_mom ,case when month_id<'202401' then cast(null as int) else cast(round(delivery_days/cus_handover_intake_vol,0) - round(delivery_days_ly/cus_handover_intake_vol_ly,0) as int) end as avg_delivery_days_yoy ,case when data_agg_type='YTDM' then case when month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp('20251123','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 day',from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')) else 1 end when data_agg_type='YTD' then case when substr(month_id,1,4)=substr('20251123',1,4) and month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp('20251123','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 day',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) else datediff(from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 month',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) end end as pass_day ,case when data_agg_type='YTDM' then case when month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd')) + interval '1 month'+ interval '1 day',from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')) else 1 end when data_agg_type='YTD' then datediff(from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd')) + interval '1 year'+ interval '1 day',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) end as actual_day from dws.dws_fact_sal_ncs_fsm_ops_funnel_kpi_t where pday='20251123' and dim_geo_type in ('Emp','Agent') and same_eseries_flag=0 and source_type<>'Other' and ! ( (coalesce(brand_code,'')='BMW' AND coalesce(source_type,'') IN ('Retail','NSC','BDC') ) ) ) ,tgt_base as ( select month_id ,dim_type ,dim_value ,brand_code ,series_code ,eseries_code ,data_agg_type ,leads_channel ,cast(leads_tgt as int) as leads_vol_tgt ,cast(oppty_tgt as int) as oppty_vol_tgt ,cast(sr_tgt as int) as sr_vol_tgt ,cast(order_tgt as int) as order_vol_tgt ,cast(handover_tgt as int) as handover_vol_tgt from dws.dws_fact_sal_ncs_fsm_tgt_mon_t where pmonth='{$pmonth}' and leads_channel='All' and dim_type in ('Emp','Agent') ) ,leads_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,leads_timely_follow_up_rate ,leads_timely_follow_up_rate_mom ,leads_timely_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_leads_followup_his_t where pday='20251123' and leads_star_level='All' and dim_geo_type in ('Emp','Agent') ) ,oppty_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,oppty_timely_follow_up_rate ,oppty_timely_follow_up_rate_mom ,oppty_timely_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_oppty_followup_his_t where pday='20251123' and oppty_priority_level='All' and dim_geo_type in ('Emp','Agent') ) ,td_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,td_follow_up_rate ,td_follow_up_rate_mom ,td_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_td_followup_t where pday='20251123' and dim_geo_type in ('Emp','Agent') ) ,sr_purpose_base as ( select month_id ,leads_brand_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,sr_record_vol_first ,sr_record_vol_re ,sr_record_vol_order ,sr_record_vol_invalid from (select month_id,leads_brand_code,dim_geo_type,dim_geo_code,dim_geo_name_cn,dim_geo_name_en,data_agg_type,sr_purpose,sr_vol from dws.dws_fact_sal_ncs_fsm_showroom_purpose_analysis_t where pday='20251123')t pivot (max(sr_vol) for sr_purpose in ('1' as sr_record_vol_first,'2' as sr_record_vol_re,'3' as sr_record_vol_order,'4' as sr_record_vol_invalid)) ) ,tgt_achv as ( select month_id ,brand_code ,series_code ,eseries_code ,leads_achv_rate_ref_floor as leads_achv_rate_ref_floor ,oppty_achv_rate_ref_floor as oppty_achv_rate_ref_floor ,sr_achv_rate_ref_floor as sr_achv_rate_ref_floor ,order_achv_rate_ref_floor as order_achv_rate_ref_floor ,handover_achv_rate_ref_floor as handover_achv_rate_ref_floor ,leads_achv_rate_ref_ceiling as leads_achv_rate_ref_ceiling ,oppty_achv_rate_ref_ceiling as oppty_achv_rate_ref_ceiling ,sr_achv_rate_ref_ceiling as sr_achv_rate_ref_ceiling ,order_achv_rate_ref_ceiling as order_achv_rate_ref_ceiling ,handover_achv_rate_ref_ceiling as handover_achv_rate_ref_ceiling from (select month_id,brand_code,series_code,eseries_code,kpi,achv_rate_ref_floor,achv_rate_ref_ceiling from upload.dwc_fact_sal_ncs_fsm_kpi_tgt_achv_mn_t)t pivot (max(achv_rate_ref_floor) as achv_rate_ref_floor,max(achv_rate_ref_ceiling) as achv_rate_ref_ceiling for kpi in ('Leads' as leads,'Oppty' as oppty,'Showroom' as sr,'Order' as order,'Handover' as handover)) ) select t1.month_id ,t1.brand_code ,t1.series_code ,t1.eseries_code ,coalesce(dim1.dealer_id,dim2.dealer_id) as dealer_id ,coalesce(dim1.organization_id,dim2.organization_id) as organization_id ,case when t1.brand_code='BMW' then coalesce(dim1.region_bmw_sale_en,dim2.region_bmw_sale_en) when t1.brand_code='MINI' then coalesce(dim1.region_mini_sale_en,dim2.region_mini_sale_en) when t1.brand_code='MOTO' then coalesce(dim1.region_moto_sale_en,dim2.region_moto_sale_en) end as region_en ,case when t1.brand_code='BMW' then coalesce(dim1.small_region_bmw_sale_en,dim2.small_region_bmw_sale_en) when t1.brand_code='MINI' then coalesce(dim1.small_region_mini_sale_en,dim2.small_region_mini_sale_en) when t1.brand_code='MOTO' then coalesce(dim1.small_region_moto_sale_en,dim2.small_region_moto_sale_en) end as small_region_en ,coalesce(dim1.investor_id,dim2.investor_id) as investor_id ,t1.dim_geo_type ,t1.dim_geo_code ,t1.dim_geo_name_cn ,t1.dim_geo_name_en ,t1.data_agg_type ,t1.source_type ,t1.leads_vol ,t1.leads_vol_mom ,t1.leads_vol_yoy ,t2.leads_vol_tgt ,cast(case when t2.leads_vol_tgt=0 then null else (t1.leads_vol/t1.pass_day) / (t2.leads_vol_tgt/t1.actual_day) end as decimal(32,4)) as leads_achv_rate ,tgt_achv.leads_achv_rate_ref_floor ,tgt_achv.leads_achv_rate_ref_ceiling ,t1.leads_oppty_conv_rate ,t1.leads_oppty_conv_rate_mom ,t1.leads_oppty_conv_rate_yoy ,t3.leads_timely_follow_up_rate ,t3.leads_timely_follow_up_rate_mom ,t3.leads_timely_follow_up_rate_yoy ,t1.oppty_vol ,t1.oppty_vol_mom ,t1.oppty_vol_yoy ,tt.oppty_vol_others ,t2.oppty_vol_tgt ,cast(case when t2.oppty_vol_tgt=0 then null else (t1.oppty_vol/t1.pass_day) / (t2.oppty_vol_tgt/t1.actual_day) end as decimal(32,4)) as oppty_achv_rate ,tgt_achv.oppty_achv_rate_ref_floor ,tgt_achv.oppty_achv_rate_ref_ceiling ,t4.oppty_timely_follow_up_rate ,t4.oppty_timely_follow_up_rate_mom ,t4.oppty_timely_follow_up_rate_yoy ,t1.oppty_sr_conv_rate ,t1.oppty_sr_conv_rate_mom ,t1.oppty_sr_conv_rate_yoy ,t1.sr_vol ,t1.sr_vol_mom ,t1.sr_vol_yoy ,t2.sr_vol_tgt ,cast(case when t2.sr_vol_tgt=0 then null else (t1.sr_vol/t1.pass_day) / (t2.sr_vol_tgt/t1.actual_day) end as decimal(32,4)) as sr_achv_rate ,tgt_achv.sr_achv_rate_ref_floor ,tgt_achv.sr_achv_rate_ref_ceiling ,t1.sr_td_conv_rate ,t1.sr_order_conv_rate ,t1.sr_order_conv_rate_mom ,t1.sr_order_conv_rate_yoy ,t1.first_sr_vol ,t1.re_sr_vol ,t5.sr_record_vol_first ,t5.sr_record_vol_re ,t5.sr_record_vol_order ,t5.sr_record_vol_invalid ,t1.td_vol ,t1.td_vol_mom ,t1.td_vol_yoy ,t6.td_follow_up_rate ,t6.td_follow_up_rate_mom ,t6.td_follow_up_rate_yoy ,t1.order_vol ,t1.order_vol_mom ,t1.order_vol_yoy ,t2.order_vol_tgt ,cast(case when t2.order_vol_tgt=0 then null else (t1.order_vol/t1.pass_day) / (t2.order_vol_tgt/t1.actual_day) end as decimal(32,4)) as order_achv_rate ,tgt_achv.order_achv_rate_ref_floor ,tgt_achv.order_achv_rate_ref_ceiling ,t1.order_handover_conv_rate ,t1.order_handover_conv_rate_mom ,t1.order_handover_conv_rate_yoy ,t1.canceled_order_vol ,t1.handovered_order_vol ,t1.handover_tbd_vol ,t1.order_intake_vol ,t1.order_cancel_vol ,t1.order_cancel_rate ,t1.order_cancel_rate_mom ,t1.order_cancel_rate_yoy ,t1.order_vol_with_td ,t1.order_vol_without_td ,t1.handover_vol ,t1.handover_vol_mom ,t1.handover_vol_yoy ,t2.handover_vol_tgt ,cast(case when t2.handover_vol_tgt=0 then null else (t1.handover_vol/t1.pass_day) / (t2.handover_vol_tgt/t1.actual_day) end as decimal(32,4)) as handover_achv_rate ,tgt_achv.handover_achv_rate_ref_floor ,tgt_achv.handover_achv_rate_ref_ceiling ,t1.handover_intake_vol ,t1.handover_cancel_vol ,t1.avg_delivery_days ,t1.avg_delivery_days_mom ,t1.avg_delivery_days_yoy ,cast(case when t7.leads_vol=0 then null else t1.leads_vol/t7.leads_vol end as decimal(32,4)) as leads_ratio ,cast(case when t7.leads_vol=0 or t7.leads_vol_lm=0 then null else t1.leads_vol/t7.leads_vol - t1.leads_vol_lm/t7.leads_vol_lm end as decimal(32,4)) as leads_ratio_mom ,cast(case when t7.leads_vol=0 or t7.leads_vol_ly=0 then null else t1.leads_vol/t7.leads_vol - t1.leads_vol_ly/t7.leads_vol_ly end as decimal(32,4)) as leads_ratio_yoy ,cast(case when t7.oppty_vol=0 then null else t1.oppty_vol/t7.oppty_vol end as decimal(32,4)) as oppty_ratio ,cast(case when t7.oppty_vol=0 or t7.oppty_vol_lm=0 then null else t1.oppty_vol/t7.oppty_vol - t1.oppty_vol_lm/t7.oppty_vol_lm end as decimal(32,4)) as oppty_ratio_mom ,cast(case when t7.oppty_vol=0 or t7.oppty_vol_ly=0 then null else t1.oppty_vol/t7.oppty_vol - t1.oppty_vol_ly/t7.oppty_vol_ly end as decimal(32,4)) as oppty_ratio_yoy ,cast(case when t7.sr_vol=0 then null else t1.sr_vol/t7.sr_vol end as decimal(32,4)) as sr_ratio ,cast(case when t7.sr_vol=0 or t7.sr_vol_lm=0 then null else t1.sr_vol/t7.sr_vol - t1.sr_vol_lm/t7.sr_vol_lm end as decimal(32,4)) as sr_ratio_mom ,cast(case when t7.sr_vol=0 or t7.sr_vol_ly=0 then null else t1.sr_vol/t7.sr_vol - t1.sr_vol_ly/t7.sr_vol_ly end as decimal(32,4)) as sr_ratio_yoy ,cast(case when t7.td_vol=0 then null else t1.td_vol/t7.td_vol end as decimal(32,4)) as td_ratio ,cast(case when t7.td_vol=0 or t7.td_vol_lm=0 then null else t1.td_vol/t7.td_vol - t1.td_vol_lm/t7.td_vol_lm end as decimal(32,4)) as td_ratio_mom ,cast(case when t7.td_vol=0 or t7.td_vol_ly=0 then null else t1.td_vol/t7.td_vol - t1.td_vol_ly/t7.td_vol_ly end as decimal(32,4)) as td_ratio_yoy ,cast(case when t7.order_vol=0 then null else t1.order_vol/t7.order_vol end as decimal(32,4)) as order_ratio ,cast(case when t7.order_vol=0 or t7.order_vol_lm=0 then null else t1.order_vol/t7.order_vol - t1.order_vol_lm/t7.order_vol_lm end as decimal(32,4)) as order_ratio_mom ,cast(case when t7.order_vol=0 or t7.order_vol_ly=0 then null else t1.order_vol/t7.order_vol - t1.order_vol_ly/t7.order_vol_ly end as decimal(32,4)) as order_ratio_yoy ,cast(case when t7.handover_vol=0 then null else t1.handover_vol/t7.handover_vol end as decimal(32,4)) as handover_ratio ,cast(case when t7.handover_vol=0 or t7.handover_vol_lm=0 then null else t1.handover_vol/t7.handover_vol - t1.handover_vol_lm/t7.handover_vol_lm end as decimal(32,4)) as handover_ratio_mom ,cast(case when t7.handover_vol=0 or t7.handover_vol_ly=0 then null else t1.handover_vol/t7.handover_vol - t1.handover_vol_ly/t7.handover_vol_ly end as decimal(32,4)) as handover_ratio_yoy ,from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss') as etl_create_time ,from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss') as etl_update_time ,'BI' as etl_create_by ,'BI' as etl_update_by from funnel_base t1 left join tgt_base t2 on t1.month_id=t2.month_id and t1.dim_geo_type=t2.dim_type and t1.dim_geo_code=t2.dim_value and t1.brand_code=t2.brand_code and t1.eseries_code=t2.eseries_code and t1.data_agg_type=t2.data_agg_type and t1.source_type='Overview' left join leads_follow_base t3 on t1.month_id=t3.month_id and t1.dim_geo_type=t3.dim_geo_type and t1.dim_geo_code=t3.dim_geo_code and t1.brand_code=t3.leads_brand_code and t1.eseries_code=t3.leads_eseries_code and t1.data_agg_type=t3.data_agg_type and t1.source_type=t3.source_type left join oppty_follow_base t4 on t1.month_id=t4.month_id and t1.dim_geo_type=t4.dim_geo_type and t1.dim_geo_code=t4.dim_geo_code and t1.brand_code=t4.leads_brand_code and t1.eseries_code=t4.leads_eseries_code and t1.data_agg_type=t4.data_agg_type and t1.source_type=t4.source_type left join sr_purpose_base t5 on t1.month_id=t5.month_id and t1.dim_geo_type=t5.dim_geo_type and t1.dim_geo_code=t5.dim_geo_code and t1.brand_code=t5.leads_brand_code and t1.data_agg_type=t5.data_agg_type and t1.eseries_code='All' and t1.source_type='Overview' left join td_follow_base t6 on t1.month_id=t6.month_id and t1.dim_geo_type=t6.dim_geo_type and t1.dim_geo_code=t6.dim_geo_code and t1.brand_code=t6.leads_brand_code and t1.eseries_code=t6.leads_eseries_code and t1.data_agg_type=t6.data_agg_type and t1.source_type=t6.source_type left join funnel_base t7 on t1.month_id=t7.month_id and t1.dim_geo_type=t7.dim_geo_type and t1.dim_geo_code=t7.dim_geo_code and t1.brand_code=t7.brand_code and t1.eseries_code=t7.eseries_code and t1.data_agg_type=t7.data_agg_type and t1.source_type<>'Overview' and t7.source_type='Overview' left join dealership_full dim1 on t1.dim_geo_type='Agent' and t1.dim_geo_code=dim1.dealer_id left join emp_delear dim2 on t1.dim_geo_type='Emp' and t1.dim_geo_code=dim2.id left join tgt_achv on t1.brand_code=tgt_achv.brand_code left join dws.dws_fact_sal_ncs_fsm_ops_leads_oppty_sr_td_channel_t tt on tt.pday='20251123' and t1.month_id=tt.month_id and t1.dim_geo_type=tt.dim_geo_type and t1.dim_geo_code=tt.dim_geo_code and t1.brand_code=tt.brand_code and t1.eseries_code=tt.eseries_code and t1.data_agg_type=tt.data_agg_type and t1.source_type=tt.source_type and tt.same_eseries_flag=0 and tt.channel_name='All' WHERE t1.month_id>='202301' AS SERDE; ----------------------------^^^ at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:255) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:124) at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:49) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:75) at org.apache.spark.sql.SparkSession.$anonfun$sql$2(SparkSession.scala:613) at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111) at org.apache.spark.sql.SparkSession.$anonfun$sql$1(SparkSession.scala:613) at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772) at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:610) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement.$anonfun$executeStatement$1(ExecuteStatement.scala:86) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at org.apache.kyuubi.engine.spark.operation.SparkOperation.$anonfun$withLocalProperties$1(SparkOperation.scala:147) at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163) at org.apache.kyuubi.engine.spark.operation.SparkOperation.withLocalProperties(SparkOperation.scala:131) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement.executeStatement(ExecuteStatement.scala:81) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement$$anon$1.run(ExecuteStatement.scala:103) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:70) at org.apache.kyuubi.engine.spark.operation.SparkOperation$$anonfun$onError$1.$anonfun$applyOrElse$1(SparkOperation.scala:181) at org.apache.kyuubi.Utils$.withLockRequired(Utils.scala:425) at org.apache.kyuubi.operation.AbstractOperation.withLockRequired(AbstractOperation.scala:52) at org.apache.kyuubi.engine.spark.operation.SparkOperation$$anonfun$onError$1.applyOrElse(SparkOperation.scala:169) at org.apache.kyuubi.engine.spark.operation.SparkOperation$$anonfun$onError$1.applyOrElse(SparkOperation.scala:164) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement.executeStatement(ExecuteStatement.scala:92) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement$$anon$1.run(ExecuteStatement.scala:103) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'AS' expecting {<EOF>, ';'}(line 411, pos 28) == SQL == CREATE TABLE orca01_dr_data.ads_rpt_fsm_sfm_kpi_funnel_dmo_t_1218 stored as parquet as with dealership_full as ( select distinct dealer_id ,region_code ,dealer_short_name ,dealer_short_name_en ,region_bmw_sale ,region_mini_sale ,region_moto_sale ,region_bmw_sale_en ,region_mini_sale_en ,region_moto_sale_en ,small_region_bmw_sale_en ,small_region_mini_sale_en ,small_region_moto_sale_en ,dealer_investor_name_en ,organization_id ,investor_id from cdl.cdl_dim_com_dmx_dealership_full_t where pday='20251124' ), emp_delear as ( select distinct emp.company_id ,emp.id ,emp.emp_name ,dealer.dealer_id ,dealer.organization_id ,dealer.region_bmw_sale_en ,dealer.region_mini_sale_en ,dealer.region_moto_sale_en ,dealer.small_region_bmw_sale_en ,dealer.small_region_mini_sale_en ,dealer.small_region_moto_sale_en ,dealer.investor_id from dwc.dwc_dim_com_dmo2_t_employee_full_t as emp left join dealership_full as dealer on emp.company_id=dealer.organization_id where emp.pday='20251124' ) ,funnel_base as ( select month_id ,brand_code ,series_code ,eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,leads_vol ,leads_vol_lm ,leads_vol_ly ,leads_vol_mom ,leads_vol_yoy ,leads_oppty_conv_rate ,leads_oppty_conv_rate_mom ,leads_oppty_conv_rate_yoy ,oppty_vol ,oppty_vol_lm ,oppty_vol_ly ,oppty_vol_mom ,oppty_vol_yoy ,'' as oppty_vol_others ,oppty_sr_conv_rate ,oppty_sr_conv_rate_mom ,oppty_sr_conv_rate_yoy ,sr_vol ,sr_vol_lm ,sr_vol_ly ,sr_vol_mom ,sr_vol_yoy ,sr_td_conv_rate ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4)) as sr_order_conv_rate ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4))-cast(case when sr_vol_lm=0 then null else order_vol_lm/sr_vol_lm end as decimal(32,4)) as sr_order_conv_rate_mom ,cast(case when sr_vol=0 then null else order_vol/sr_vol end as decimal(32,4))-cast(case when sr_vol_ly=0 then null else order_vol_ly/sr_vol_ly end as decimal(32,4)) as sr_order_conv_rate_yoy ,first_sr_vol ,re_sr_vol ,td_vol ,td_vol_lm ,td_vol_ly ,td_vol_mom ,td_vol_yoy ,order_vol ,order_vol_lm ,order_vol_ly ,order_vol_mom ,order_vol_yoy ,order_handover_conv_rate ,order_handover_conv_rate-order_handover_conv_rate_lm as order_handover_conv_rate_mom ,order_handover_conv_rate-order_handover_conv_rate_ly as order_handover_conv_rate_yoy ,canceled_order_vol ,handovered_order_vol ,handover_tbd_vol ,order_intake_vol ,order_cancel_vol ,order_cancel_rate ,order_cancel_rate_mom ,order_cancel_rate_yoy ,order_vol_with_td ,order_vol_without_td ,handover_vol ,handover_vol_lm ,handover_vol_ly ,handover_vol_mom ,handover_vol_yoy ,handover_intake_vol ,handover_cancel_vol ,cast(round(delivery_days/cus_handover_intake_vol,0) as int) as avg_delivery_days ,case when brand_code='BMW' and month_id<'202212' then cast(null as int) when brand_code='MINI' and month_id<'202304' then cast(null as int) else cast(round(delivery_days/cus_handover_intake_vol,0) - round(delivery_days_lm/cus_handover_intake_vol_lm,0) as int) end as avg_delivery_days_mom ,case when month_id<'202401' then cast(null as int) else cast(round(delivery_days/cus_handover_intake_vol,0) - round(delivery_days_ly/cus_handover_intake_vol_ly,0) as int) end as avg_delivery_days_yoy ,case when data_agg_type='YTDM' then case when month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp('20251123','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 day',from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')) else 1 end when data_agg_type='YTD' then case when substr(month_id,1,4)=substr('20251123',1,4) and month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp('20251123','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 day',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) else datediff(from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')+ interval '1 month',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) end end as pass_day ,case when data_agg_type='YTDM' then case when month_id=substr('20251123',1,6) then datediff(from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd')) + interval '1 month'+ interval '1 day',from_unixtime(unix_timestamp(month_id||'01','yyyyMMdd'),'yyyy-MM-dd')) else 1 end when data_agg_type='YTD' then datediff(from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd')) + interval '1 year'+ interval '1 day',from_unixtime(unix_timestamp(substr(month_id,1,4)||'0101','yyyyMMdd'),'yyyy-MM-dd')) end as actual_day from dws.dws_fact_sal_ncs_fsm_ops_funnel_kpi_t where pday='20251123' and dim_geo_type in ('Emp','Agent') and same_eseries_flag=0 and source_type<>'Other' and ! ( (coalesce(brand_code,'')='BMW' AND coalesce(source_type,'') IN ('Retail','NSC','BDC') ) ) ) ,tgt_base as ( select month_id ,dim_type ,dim_value ,brand_code ,series_code ,eseries_code ,data_agg_type ,leads_channel ,cast(leads_tgt as int) as leads_vol_tgt ,cast(oppty_tgt as int) as oppty_vol_tgt ,cast(sr_tgt as int) as sr_vol_tgt ,cast(order_tgt as int) as order_vol_tgt ,cast(handover_tgt as int) as handover_vol_tgt from dws.dws_fact_sal_ncs_fsm_tgt_mon_t where pmonth='{$pmonth}' and leads_channel='All' and dim_type in ('Emp','Agent') ) ,leads_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,leads_timely_follow_up_rate ,leads_timely_follow_up_rate_mom ,leads_timely_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_leads_followup_his_t where pday='20251123' and leads_star_level='All' and dim_geo_type in ('Emp','Agent') ) ,oppty_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,oppty_timely_follow_up_rate ,oppty_timely_follow_up_rate_mom ,oppty_timely_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_oppty_followup_his_t where pday='20251123' and oppty_priority_level='All' and dim_geo_type in ('Emp','Agent') ) ,td_follow_base as ( select month_id ,leads_brand_code ,leads_series_code ,leads_eseries_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,source_type ,td_follow_up_rate ,td_follow_up_rate_mom ,td_follow_up_rate_yoy from dws.dws_fact_sal_ncs_fsm_td_followup_t where pday='20251123' and dim_geo_type in ('Emp','Agent') ) ,sr_purpose_base as ( select month_id ,leads_brand_code ,dim_geo_type ,dim_geo_code ,dim_geo_name_cn ,dim_geo_name_en ,data_agg_type ,sr_record_vol_first ,sr_record_vol_re ,sr_record_vol_order ,sr_record_vol_invalid from (select month_id,leads_brand_code,dim_geo_type,dim_geo_code,dim_geo_name_cn,dim_geo_name_en,data_agg_type,sr_purpose,sr_vol from dws.dws_fact_sal_ncs_fsm_showroom_purpose_analysis_t where pday='20251123')t pivot (max(sr_vol) for sr_purpose in ('1' as sr_record_vol_first,'2' as sr_record_vol_re,'3' as sr_record_vol_order,'4' as sr_record_vol_invalid)) ) ,tgt_achv as ( select month_id ,brand_code ,series_code ,eseries_code ,leads_achv_rate_ref_floor as leads_achv_rate_ref_floor ,oppty_achv_rate_ref_floor as oppty_achv_rate_ref_floor ,sr_achv_rate_ref_floor as sr_achv_rate_ref_floor ,order_achv_rate_ref_floor as order_achv_rate_ref_floor ,handover_achv_rate_ref_floor as handover_achv_rate_ref_floor ,leads_achv_rate_ref_ceiling as leads_achv_rate_ref_ceiling ,oppty_achv_rate_ref_ceiling as oppty_achv_rate_ref_ceiling ,sr_achv_rate_ref_ceiling as sr_achv_rate_ref_ceiling ,order_achv_rate_ref_ceiling as order_achv_rate_ref_ceiling ,handover_achv_rate_ref_ceiling as handover_achv_rate_ref_ceiling from (select month_id,brand_code,series_code,eseries_code,kpi,achv_rate_ref_floor,achv_rate_ref_ceiling from upload.dwc_fact_sal_ncs_fsm_kpi_tgt_achv_mn_t)t pivot (max(achv_rate_ref_floor) as achv_rate_ref_floor,max(achv_rate_ref_ceiling) as achv_rate_ref_ceiling for kpi in ('Leads' as leads,'Oppty' as oppty,'Showroom' as sr,'Order' as order,'Handover' as handover)) ) select t1.month_id ,t1.brand_code ,t1.series_code ,t1.eseries_code ,coalesce(dim1.dealer_id,dim2.dealer_id) as dealer_id ,coalesce(dim1.organization_id,dim2.organization_id) as organization_id ,case when t1.brand_code='BMW' then coalesce(dim1.region_bmw_sale_en,dim2.region_bmw_sale_en) when t1.brand_code='MINI' then coalesce(dim1.region_mini_sale_en,dim2.region_mini_sale_en) when t1.brand_code='MOTO' then coalesce(dim1.region_moto_sale_en,dim2.region_moto_sale_en) end as region_en ,case when t1.brand_code='BMW' then coalesce(dim1.small_region_bmw_sale_en,dim2.small_region_bmw_sale_en) when t1.brand_code='MINI' then coalesce(dim1.small_region_mini_sale_en,dim2.small_region_mini_sale_en) when t1.brand_code='MOTO' then coalesce(dim1.small_region_moto_sale_en,dim2.small_region_moto_sale_en) end as small_region_en ,coalesce(dim1.investor_id,dim2.investor_id) as investor_id ,t1.dim_geo_type ,t1.dim_geo_code ,t1.dim_geo_name_cn ,t1.dim_geo_name_en ,t1.data_agg_type ,t1.source_type ,t1.leads_vol ,t1.leads_vol_mom ,t1.leads_vol_yoy ,t2.leads_vol_tgt ,cast(case when t2.leads_vol_tgt=0 then null else (t1.leads_vol/t1.pass_day) / (t2.leads_vol_tgt/t1.actual_day) end as decimal(32,4)) as leads_achv_rate ,tgt_achv.leads_achv_rate_ref_floor ,tgt_achv.leads_achv_rate_ref_ceiling ,t1.leads_oppty_conv_rate ,t1.leads_oppty_conv_rate_mom ,t1.leads_oppty_conv_rate_yoy ,t3.leads_timely_follow_up_rate ,t3.leads_timely_follow_up_rate_mom ,t3.leads_timely_follow_up_rate_yoy ,t1.oppty_vol ,t1.oppty_vol_mom ,t1.oppty_vol_yoy ,tt.oppty_vol_others ,t2.oppty_vol_tgt ,cast(case when t2.oppty_vol_tgt=0 then null else (t1.oppty_vol/t1.pass_day) / (t2.oppty_vol_tgt/t1.actual_day) end as decimal(32,4)) as oppty_achv_rate ,tgt_achv.oppty_achv_rate_ref_floor ,tgt_achv.oppty_achv_rate_ref_ceiling ,t4.oppty_timely_follow_up_rate ,t4.oppty_timely_follow_up_rate_mom ,t4.oppty_timely_follow_up_rate_yoy ,t1.oppty_sr_conv_rate ,t1.oppty_sr_conv_rate_mom ,t1.oppty_sr_conv_rate_yoy ,t1.sr_vol ,t1.sr_vol_mom ,t1.sr_vol_yoy ,t2.sr_vol_tgt ,cast(case when t2.sr_vol_tgt=0 then null else (t1.sr_vol/t1.pass_day) / (t2.sr_vol_tgt/t1.actual_day) end as decimal(32,4)) as sr_achv_rate ,tgt_achv.sr_achv_rate_ref_floor ,tgt_achv.sr_achv_rate_ref_ceiling ,t1.sr_td_conv_rate ,t1.sr_order_conv_rate ,t1.sr_order_conv_rate_mom ,t1.sr_order_conv_rate_yoy ,t1.first_sr_vol ,t1.re_sr_vol ,t5.sr_record_vol_first ,t5.sr_record_vol_re ,t5.sr_record_vol_order ,t5.sr_record_vol_invalid ,t1.td_vol ,t1.td_vol_mom ,t1.td_vol_yoy ,t6.td_follow_up_rate ,t6.td_follow_up_rate_mom ,t6.td_follow_up_rate_yoy ,t1.order_vol ,t1.order_vol_mom ,t1.order_vol_yoy ,t2.order_vol_tgt ,cast(case when t2.order_vol_tgt=0 then null else (t1.order_vol/t1.pass_day) / (t2.order_vol_tgt/t1.actual_day) end as decimal(32,4)) as order_achv_rate ,tgt_achv.order_achv_rate_ref_floor ,tgt_achv.order_achv_rate_ref_ceiling ,t1.order_handover_conv_rate ,t1.order_handover_conv_rate_mom ,t1.order_handover_conv_rate_yoy ,t1.canceled_order_vol ,t1.handovered_order_vol ,t1.handover_tbd_vol ,t1.order_intake_vol ,t1.order_cancel_vol ,t1.order_cancel_rate ,t1.order_cancel_rate_mom ,t1.order_cancel_rate_yoy ,t1.order_vol_with_td ,t1.order_vol_without_td ,t1.handover_vol ,t1.handover_vol_mom ,t1.handover_vol_yoy ,t2.handover_vol_tgt ,cast(case when t2.handover_vol_tgt=0 then null else (t1.handover_vol/t1.pass_day) / (t2.handover_vol_tgt/t1.actual_day) end as decimal(32,4)) as handover_achv_rate ,tgt_achv.handover_achv_rate_ref_floor ,tgt_achv.handover_achv_rate_ref_ceiling ,t1.handover_intake_vol ,t1.handover_cancel_vol ,t1.avg_delivery_days ,t1.avg_delivery_days_mom ,t1.avg_delivery_days_yoy ,cast(case when t7.leads_vol=0 then null else t1.leads_vol/t7.leads_vol end as decimal(32,4)) as leads_ratio ,cast(case when t7.leads_vol=0 or t7.leads_vol_lm=0 then null else t1.leads_vol/t7.leads_vol - t1.leads_vol_lm/t7.leads_vol_lm end as decimal(32,4)) as leads_ratio_mom ,cast(case when t7.leads_vol=0 or t7.leads_vol_ly=0 then null else t1.leads_vol/t7.leads_vol - t1.leads_vol_ly/t7.leads_vol_ly end as decimal(32,4)) as leads_ratio_yoy ,cast(case when t7.oppty_vol=0 then null else t1.oppty_vol/t7.oppty_vol end as decimal(32,4)) as oppty_ratio ,cast(case when t7.oppty_vol=0 or t7.oppty_vol_lm=0 then null else t1.oppty_vol/t7.oppty_vol - t1.oppty_vol_lm/t7.oppty_vol_lm end as decimal(32,4)) as oppty_ratio_mom ,cast(case when t7.oppty_vol=0 or t7.oppty_vol_ly=0 then null else t1.oppty_vol/t7.oppty_vol - t1.oppty_vol_ly/t7.oppty_vol_ly end as decimal(32,4)) as oppty_ratio_yoy ,cast(case when t7.sr_vol=0 then null else t1.sr_vol/t7.sr_vol end as decimal(32,4)) as sr_ratio ,cast(case when t7.sr_vol=0 or t7.sr_vol_lm=0 then null else t1.sr_vol/t7.sr_vol - t1.sr_vol_lm/t7.sr_vol_lm end as decimal(32,4)) as sr_ratio_mom ,cast(case when t7.sr_vol=0 or t7.sr_vol_ly=0 then null else t1.sr_vol/t7.sr_vol - t1.sr_vol_ly/t7.sr_vol_ly end as decimal(32,4)) as sr_ratio_yoy ,cast(case when t7.td_vol=0 then null else t1.td_vol/t7.td_vol end as decimal(32,4)) as td_ratio ,cast(case when t7.td_vol=0 or t7.td_vol_lm=0 then null else t1.td_vol/t7.td_vol - t1.td_vol_lm/t7.td_vol_lm end as decimal(32,4)) as td_ratio_mom ,cast(case when t7.td_vol=0 or t7.td_vol_ly=0 then null else t1.td_vol/t7.td_vol - t1.td_vol_ly/t7.td_vol_ly end as decimal(32,4)) as td_ratio_yoy ,cast(case when t7.order_vol=0 then null else t1.order_vol/t7.order_vol end as decimal(32,4)) as order_ratio ,cast(case when t7.order_vol=0 or t7.order_vol_lm=0 then null else t1.order_vol/t7.order_vol - t1.order_vol_lm/t7.order_vol_lm end as decimal(32,4)) as order_ratio_mom ,cast(case when t7.order_vol=0 or t7.order_vol_ly=0 then null else t1.order_vol/t7.order_vol - t1.order_vol_ly/t7.order_vol_ly end as decimal(32,4)) as order_ratio_yoy ,cast(case when t7.handover_vol=0 then null else t1.handover_vol/t7.handover_vol end as decimal(32,4)) as handover_ratio ,cast(case when t7.handover_vol=0 or t7.handover_vol_lm=0 then null else t1.handover_vol/t7.handover_vol - t1.handover_vol_lm/t7.handover_vol_lm end as decimal(32,4)) as handover_ratio_mom ,cast(case when t7.handover_vol=0 or t7.handover_vol_ly=0 then null else t1.handover_vol/t7.handover_vol - t1.handover_vol_ly/t7.handover_vol_ly end as decimal(32,4)) as handover_ratio_yoy ,from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss') as etl_create_time ,from_unixtime(unix_timestamp(),'yyyy-MM-dd HH:mm:ss') as etl_update_time ,'BI' as etl_create_by ,'BI' as etl_update_by from funnel_base t1 left join tgt_base t2 on t1.month_id=t2.month_id and t1.dim_geo_type=t2.dim_type and t1.dim_geo_code=t2.dim_value and t1.brand_code=t2.brand_code and t1.eseries_code=t2.eseries_code and t1.data_agg_type=t2.data_agg_type and t1.source_type='Overview' left join leads_follow_base t3 on t1.month_id=t3.month_id and t1.dim_geo_type=t3.dim_geo_type and t1.dim_geo_code=t3.dim_geo_code and t1.brand_code=t3.leads_brand_code and t1.eseries_code=t3.leads_eseries_code and t1.data_agg_type=t3.data_agg_type and t1.source_type=t3.source_type left join oppty_follow_base t4 on t1.month_id=t4.month_id and t1.dim_geo_type=t4.dim_geo_type and t1.dim_geo_code=t4.dim_geo_code and t1.brand_code=t4.leads_brand_code and t1.eseries_code=t4.leads_eseries_code and t1.data_agg_type=t4.data_agg_type and t1.source_type=t4.source_type left join sr_purpose_base t5 on t1.month_id=t5.month_id and t1.dim_geo_type=t5.dim_geo_type and t1.dim_geo_code=t5.dim_geo_code and t1.brand_code=t5.leads_brand_code and t1.data_agg_type=t5.data_agg_type and t1.eseries_code='All' and t1.source_type='Overview' left join td_follow_base t6 on t1.month_id=t6.month_id and t1.dim_geo_type=t6.dim_geo_type and t1.dim_geo_code=t6.dim_geo_code and t1.brand_code=t6.leads_brand_code and t1.eseries_code=t6.leads_eseries_code and t1.data_agg_type=t6.data_agg_type and t1.source_type=t6.source_type left join funnel_base t7 on t1.month_id=t7.month_id and t1.dim_geo_type=t7.dim_geo_type and t1.dim_geo_code=t7.dim_geo_code and t1.brand_code=t7.brand_code and t1.eseries_code=t7.eseries_code and t1.data_agg_type=t7.data_agg_type and t1.source_type<>'Overview' and t7.source_type='Overview' left join dealership_full dim1 on t1.dim_geo_type='Agent' and t1.dim_geo_code=dim1.dealer_id left join emp_delear dim2 on t1.dim_geo_type='Emp' and t1.dim_geo_code=dim2.id left join tgt_achv on t1.brand_code=tgt_achv.brand_code left join dws.dws_fact_sal_ncs_fsm_ops_leads_oppty_sr_td_channel_t tt on tt.pday='20251123' and t1.month_id=tt.month_id and t1.dim_geo_type=tt.dim_geo_type and t1.dim_geo_code=tt.dim_geo_code and t1.brand_code=tt.brand_code and t1.eseries_code=tt.eseries_code and t1.data_agg_type=tt.data_agg_type and t1.source_type=tt.source_type and tt.same_eseries_flag=0 and tt.channel_name='All' WHERE t1.month_id>='202301' AS SERDE; ----------------------------^^^ at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:255) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:124) at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:49) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:75) at org.apache.spark.sql.SparkSession.$anonfun$sql$2(SparkSession.scala:613) at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111) at org.apache.spark.sql.SparkSession.$anonfun$sql$1(SparkSession.scala:613) at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:772) at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:610) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement.$anonfun$executeStatement$1(ExecuteStatement.scala:86) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23) at org.apache.kyuubi.engine.spark.operation.SparkOperation.$anonfun$withLocalProperties$1(SparkOperation.scala:147) at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:163) at org.apache.kyuubi.engine.spark.operation.SparkOperation.withLocalProperties(SparkOperation.scala:131) at org.apache.kyuubi.engine.spark.operation.ExecuteStatement.executeStatement(ExecuteStatement.scala:81) ... 6 more这啥原因
最新发布
11-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值