hive调度设置全局变量单引号问题 #6603
Unanswered
CrazyBeeline
asked this question in
Q&A
Replies: 2 comments
-
之前也遇到过sql里面传参数,自带单引号的问题,等一个结果。 |
Beta Was this translation helpful? Give feedback.
0 replies
-
目前sql类型的任务好像只有局部变量值为数字且类型设置为数字时才能像这样拼接字符串。 sql里的列名表名这些可以是 局部变量可以设置类型解决数字变量的问题,但是全局变量没有类型设置,把全局变量也加个类型,再根据类型判断加不加好像也不合适, 因为:
可以看到有些场景不加引号报错(k=qwer),有些会导致结果与事实不符(2022-02-15),但有些场景不加也不影响结果。而且不加引号的话很多流程类似,仅仅因为表面列名不同的工作就可以通过设置全局变量,更方便的部署了。 建议sql类型的任务设置两种变量声明方式,比如${key}还是加引号,不影响老任务运行,$${key}/${{key}}表示不加引号。至于是不是放弃根据局部变量类型判断加不加引号的做法我就不知道了... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我创建了一个hive工作流导入一些数据
如下图:
实现执行sql就会变成下面的图 多了两个单引号
我该怎么配置参数去掉这些单引号
Beta Was this translation helpful? Give feedback.
All reactions