看起来Hive不支持表和列名中的Unicode。例如,我无法在Hive中创建具有西里尔列名称的表(请参阅下面的例外)。 有没有办法让Hive与Cyrillic表和列名一起工作?
我用:
$ hadoop版本 Hadoop 2.2.0.2.0.6.0-101
Subversion git@github.com:hortonworks / hadoop.git -r b07b2906c36defd389c8b5bd22bebc1bead8115b
由jenkins在2014-01-09T05编制:18Z
使用protoc 2.5.0编译
hive> CREATE TABLE test2(`Имя` STRING, `НомерТелефона` INT);
NoViableAltException(10@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.type(HiveParser.java:27461)
at org.apache.hadoop.hive.ql.parse.HiveParser.colType(HiveParser.java:27229)
at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameType(HiveParser.java:26935)
at org.apache.hadoop.hive.ql.parse.HiveParser.columnNameTypeList(HiveParser.java:25185)
at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:4264)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2016)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1298)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:938)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:190)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:424)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:342)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1000)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:911)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:259)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:216)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:413)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:781)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:614)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
FAILED: ParseException line 1:31 cannot recognize input near ',' 'INT' ')' in column type
答案 0 :(得分:1)
您可以在数据/注释上使用Unicode字符串,但不能用于数据库/表/列名称。
请参见此处:https://cwiki.apache.org/confluence/display/Hive/User+FAQ#UserFAQ-DoesHivesupportUnicode?
答案 1 :(得分:0)
Hive 0.13支持引用的Unicode列名。有关详细信息,请参阅HIVE-6013。 Hadoop 2.2包含Hive 0.11,因此请更新到Hadoop 2.4或更高版本以获得此功能。