1

我正在代码中创建一个配置单元表:

HiveInterface client = new HiveServer.HiveServerHandler();
client.execute("CREATE TABLE u_data (" +
        "userid INT," +
        " movieid INT," +
        " rating INT" +
        ")" +
        " ROW FORMAT DELIMITED " +
        "FIELDS TERMINATED BY '\\t' " +
        "STORED AS TEXTFILE;");

运行execute命令时出现此异常:

java.lang.NoSuchFieldError: type
at org.apache.hadoop.hive.ql.parse.HiveLexer.mKW_CREATE(HiveLexer.java:1601)
at org.apache.hadoop.hive.ql.parse.HiveLexer.mTokens(HiveLexer.java:6360)
at org.antlr.runtime.Lexer.nextToken(Lexer.java:85)
at org.antlr.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:143)
at org.antlr.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:137)
at org.antlr.runtime.CommonTokenStream.setup(CommonTokenStream.java:137)
at org.antlr.runtime.CommonTokenStream.LT(CommonTokenStream.java:94)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:546)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:437)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:417)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:889)
at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:191)

我能找到的唯一线索是它与antlr-*.jar我作为依赖项添加到我pom.xml的最新版本相关的东西。

注意:服务器是独立的,我在我的 java 代码中启动。

4

1 回答 1

0

经过一番调查,并尝试了几个antlr罐子,我终于通过添加这个 Maven 依赖项解决了它:

<dependency>
   <groupId>org.antlr</groupId>
   <artifactId>antlr</artifactId>
   <version>3.0.1</version>
</dependency>

我的 Hadoop 罐子是版本0.8.1

于 2013-10-15T19:50:07.253 回答