HIVE创建表的时候报错,错误信息如下:
MismatchedTokenException(-1!=282)
at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(BaseRecognizer.java:617)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormatFieldIdentifier(HiveParser.java:23260)
at org.apache.hadoop.hive.ql.parse.HiveParser.rowFormatDelimited(HiveParser.java:22272)
at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormat(HiveParser.java:22500)
at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:4329)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:1987)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1273)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:928)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:190)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:418)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:902)
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.run(CliDriver.java:756)
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:197)
FAILED: ParseException line 32:75 mismatched input '<EOF>' expecting StringLiteral near 'by' in table row format's field separator
主要原因是 定义字段分割符的时候 用了";" 因为hdfs文件的的格式就是用分号隔开的。
解决办法:
找到分号的asc码值 : http://blog.csdn.net/lxpbs8851/article/details/11525501
(其他字符有同样问题 也可以这样做) 找到的是073 那么将定义表的语句修改为:
row format delimited fields terminated by '\073' 。