Bin*_*gic 4 hadoop hive emr hiveql
我正在使用Hive,2.1.1并尝试.使用列名称创建表:
CREATE TABLE `test_table`(
`field.with.dots` string
);
Run Code Online (Sandbox Code Playgroud)
当我这样做时,我得到:
FAILED: ParseException line 4:0 Failed to recognize predicate ')'. Failed rule: '[., :] can not be used in column name in create table statement.' in column specification
Run Code Online (Sandbox Code Playgroud)
我一定做错了,因为配置单元文档中说:
在Hive版本0.13.0和更高版本中,默认情况下,可以在反引号(`)中指定列名称,并包含任何Unicode字符(HIVE-6013)
.是Unicode字符。知道我可能在做什么吗?
为了给您更多背景信息,它位于Amazon EMR 5.5.0集群上。谢谢!
源代码:HiveParser
...
private char [] excludedCharForColumnName = {'.', ':'};
...
private CommonTree throwColumnNameException() throws RecognitionException {
throw new FailedPredicateException(input, Arrays.toString(excludedCharForColumnName) + " can not be used in column name in create table statement.", "");
}
Run Code Online (Sandbox Code Playgroud)
吉拉票务:不允许在列名中使用点/冒号创建表
请注意动机:
由于我们不允许用户查询中间带有点的列名(例如emp.no),因此不允许用户使用无法查询的列创建表
似乎create table已处理,但CTASALTER TABLE也未处理...
hive> create table t as select 1 as `a.b.c`;
OK
hive> desc t;
OK
col_name data_type comment
a.b.c int
Time taken: 0.441 seconds, Fetched: 1 row(s)
hive> select * from t;
FAILED: RuntimeException java.lang.RuntimeException: cannot find field a from [0:a.b.c]
Run Code Online (Sandbox Code Playgroud)
hive> create table t (i int);
OK
hive> alter table t change column i `a.b.c` int
hive> select * from t;
Error while compiling statement: FAILED: RuntimeException java.lang.RuntimeException: cannot find field a from [0:a.b.c]
Run Code Online (Sandbox Code Playgroud)
聚苯乙烯
我已经更新了文档(查找colon)
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
| 归档时间: |
|
| 查看次数: |
3555 次 |
| 最近记录: |