我正在代码中创建一个配置单元表:
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 代码中启动。