欢迎投稿

今日深度:

hive 变量,

hive 变量,


1. 变量空间:hiveconf, system, and env. ,通常默认引用为 hiveconf
 hive> set a=weihongrao;
hive> set a;
a=weihongrao
hive> set hiveconf:a;
hiveconf:a=weihongrao

2. 通过shell变量传递:
[leo@hadoop ~]$ a="'test*'"####注意里面的单引号主要是将引号也要传递到HQL中否则会导致show tables test*   报错
[leo@hadoop ~]$ echo "$a"
'test*'
[leo@hadoop ~]$ hive -e "use psi;show tables ${a};"

3. HQL中直接调用:
hive> set orgid=1002;
hive> select * from org where orgid=${hiveconf:orgid};

www.htsjk.Com true http://www.htsjk.com/hive/40701.html NewsArticle hive 变量, 1. 变量空间:hiveconf, system, and env. ,通常默认引用为 hiveconf  hive set a=weihongrao; hive set a; a=weihongrao hive set hiveconf:a; hiveconf:a=weihongrao 2. 通过shell变量传递: [leo@hadoop ~]$ a="'tes...
相关文章
    暂无相关文章
评论暂时关闭