我正在尝试在以下查询中使用Hive中的用户定义变量(在Azure中):
CREATE EXTERNAL TABLE mydb.mytable(
Time STRING,
Src STRING,
)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS TEXTFILE LOCATION 'wasb://container@account.blob.core.windows.net/${hiveconf:OLD_DATE_FORMAT}/'
我设置
时有效set OLD_DATE_FORMAT = 2015/07/11
但是,当我设置
时,它不起作用set set OLD_DATE_FORMAT = regexp_replace(date_sub(from_unixtime(unix_timestamp(),'yyyy-MM-dd'), 2), '-', '/');
它会抛出错误:
FAILED: ParseException line 14:147 missing EOF at 'yyyy' near ''wasb://container@account.blob.core.windows.net/regexp_replace(date_sub(from_unixtime(unix_timestamp(),''
我的猜测是,用户定义变量中的单引号导致问题。
你能帮忙吗?
谢谢!