Hive CREATE EXTERNAL TABLE with parameterized LOCATION



按预期运行:

 DROP TABLE mytable; 
 CREATE EXTERNAL TABLE mytable (
     Dim1 STRING,
     Dim2 STRING,
     Dim3 STRING ) 
 LOCATION 'hdfs:///user/myuser/data';

但这不是:

 set rootpath = 'hdfs:///user/myuser/data'; 
 DROP TABLE mytable; 
 CREATE EXTERNAL TABLE mytable (
     Dim1 STRING,
     Dim2 STRING,
     Dim3 STRING ) 
 LOCATION '${hiveconf:rootpath}';

出现以下错误(Hive 0.9.0):

FAILED: Parse Error: line 9:11 mismatched input 'hdfs' expected EOF near ''''

是我做错了什么,还是这是一个已知的问题/限制?有什么变通的建议吗?

我觉得应该是LOCATION ${hiveconf:rootpath}

您还可以使用我们在创建表DDL中经常使用的环境变量。它可以被引用为${env:variable_name}

相关内容

最新更新