hive创建表的时候出错

hive> CREATE EXTERNAL TABLE IF NOT EXISTS test_table
> (
> id BIGINT,
> doc string
> )
> ROW FORMAT SERDE
> exit;
MismatchedTokenException(26!=305)
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.rowFormatSerde(HiveParser.java:33891)
at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormat(HiveParser.java:34383)
at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:5003)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2364)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1586)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1062)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:199)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:394)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:306)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1111)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1159)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1048)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1038)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:207)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:159)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:370)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:756)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:675)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:615)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 7:0 mismatched input 'exit' expecting StringLiteral near 'SERDE' in serde format specification
hive>

这是什么问题?

wangwensheng - 大数据工程师@腾讯

赞同来自:

hive> CREATE EXTERNAL TABLE IF NOT EXISTS test_table > ( > id BIGINT, > doc string > ) > ROW FORMAT SERDE > exit;   后面这里分号打错了位置了吧?你是想创建完表就退出吗?

juanhu

赞同来自:

老师的课件     创建表  CREATE EXTERNAL TABLE IF NOT EXISTS test_table  (  id BIGINT,  doc STRING  )  ROW FORMAT SERDE  'cn.chinahadoop.hive.serde.ExampleSerDe'  STORED AS  INPUTFORMAT 'cn.chinahadoop.hive.inputformat.ExampleFileInputFormat'  OUTPUTFORMAT 'cn.chinahadoop.hive.outputformat.ExampleFileOutputFormat'  LOCATION '/hive';    'cn.chinahadoop.hive.serde.ExampleSerDe' 和'cn.chinahadoop.hive.inputformat.ExampleFileInputFormat' 和'cn.chinahadoop.hive.outputformat.ExampleFileOutputFormat' 是java文件吗?还是什么?因为我没有这些东西,所以我只写到ROW FORMAT SERDE 

wangwensheng - 大数据工程师@腾讯

赞同来自:

那没有exit这个命令啊?你这看起来就是分号标错了地方吧: > ROW FORMAT SERDE > exit;   改成: > ROW FORMAT SERDE; 试试呢

要回复问题请先登录注册