Support Questions

Find answers, ask questions, and share your expertise

Unable to create a table in hive

avatar
Contributor

CREATE TABLE IF NOT EXISTS employee (eid int, name String,
salary String)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t’
LINES TERMINATED BY ‘\n’
STORED AS TEXTFILE;

I'm getting the below error:

MismatchedTokenException(26!=298)
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:31777)
at org.apache.hadoop.hive.ql.parse.HiveParser.rowFormatDelimited(HiveParser.java:30730)
at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormat(HiveParser.java:31006)
at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:4677)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2138)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1392)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1030)
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:417)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1026)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1091)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:269)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:221)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:431)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:800)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:694)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
FAILED: ParseException line 3:44 mismatched input 't' expecting StringLiteral near 'BY' in table row format's field separator

Even iIf I use '\073' , I'm getting the error:

MismatchedTokenException(287!=298)
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:31777)
at org.apache.hadoop.hive.ql.parse.HiveParser.rowFormatDelimited(HiveParser.java:30730)
at org.apache.hadoop.hive.ql.parse.HiveParser.tableRowFormat(HiveParser.java:31006)
at org.apache.hadoop.hive.ql.parse.HiveParser.createTableStatement(HiveParser.java:4677)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2138)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1392)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1030)
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:417)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1026)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1091)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:269)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:221)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:431)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:800)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:694)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
FAILED: ParseException line 3:44 mismatched input '073' expecting StringLiteral near 'BY' in table row format's field separator

Please let me know how to fix this.

1 ACCEPTED SOLUTION

avatar
Super Guru

@Sivakumar Mahalingam,

I guess the problem is with quotes. use ' instead of ’

View solution in original post

1 REPLY 1

avatar
Super Guru

@Sivakumar Mahalingam,

I guess the problem is with quotes. use ' instead of ’