Hive使用参数化的LOCATION创建外部表 [英] Hive CREATE EXTERNAL TABLE with parameterized LOCATION

查看:1591
本文介绍了Hive使用参数化的LOCATION创建外部表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这符合预期:

This works as expected:

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

但这不是:

but this doesn't:

 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):

It fails with the following error (Hive 0.9.0):


FAILED:解析错误:第9行11不匹配的输入'hdfs'期望EOF靠近''''

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

我做错了什么,或者这是一个已知的问题/限制吗?是否有解决方法的建议?

Am I doing something wrong, or is this a known issue/limitation? Are there any suggestions for workarounds?

推荐答案

我认为它应该读取 LOCATION $ {hiveconf:rootpath}

这篇关于Hive使用参数化的LOCATION创建外部表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆