hive{case..when}无法识别从shell脚本传递的hiveconf变量

nqwrtyyt  于 2021-06-26  发布在  Hive
关注(0)|答案(0)|浏览(230)

运行配置单元查询时出现以下错误。

FAILED: ParseException line 36:106 cannot recognize input near '$' '{' 'hiveconf' in expression specification

这是我的要求:我有两卷纸的条件。。

if roll_cond=1 then execute something
if roll_cond=2 then execute something

尝试用下面的代码来实现这一点

INSERT OVERWRITE TABLE db.tab_name partition(yr,mon)
select xxxx,xxx,xx,xx
from db.tab_name
left join db.name
on condition
where case when ${hiveconf:roll_cond}=1 then yr = case 
           when ${hiveconf:refresh_yr} <> 0 then ${hiveconf:refresh_yr} 
              else year(current_date) end;
           when ${hiveconf:roll_cond}=2 then condition end;

因此,当我使用“1”运行脚本时,它运行良好,但当我使用“2”时,它会给我上述错误。
请指出代码失败的地方?
提前谢谢。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题