1.
--注意:有些引擎运行正常(Tez spark),有些会报错(presto)
set a=10;
select * from table limit ${hiveconf:a};
2.
-- 注意加了引号就相当于 加引号的变量值'2021-06-01',字段需要加引号就加,不需要加就不加
-- 同样 有的引擎可用,有的不可用
set a=2021-06-01;
select * from table where sale_ord_dt= '${hiveconf:a}' limit 10;
-- 当然,先给变量加引号也是可以滴
set a='2021-06-01';
select * from table where sale_ord_dt= ${hiveconf:a} limit 10;
3.
-- 这种不可行
set hiveconf:a=10;
select * from table limit ${a};
-- 可行
set hivevar:a=10;
select * from table limit ${a};
-- 可行
set a=10;
select * from table limit ${hivevar:a};