Hive Partition ParseException


#1

I am unable to add the insert statement after table creation. I am trying out Arun’s blog Problem 3

hive (shalini_retail_stage)> insert overwrite orders_avro partition(order_month)
> ;
NoViableAltException(26@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.destination(HiveParser.java:45024)
at org.apache.hadoop.hive.ql.parse.HiveParser.insertClause(HiveParser.java:44467)
at org.apache.hadoop.hive.ql.parse.HiveParser.regularBody(HiveParser.java:41473)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpressionBody(HiveParser.java:40691)
at org.apache.hadoop.hive.ql.parse.HiveParser.queryStatementExpression(HiveParser.java:40561)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1605)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1122)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:202)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:437)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:320)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1219)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1260)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1156)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1146)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:216)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:168)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:379)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:739)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:684)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:624)
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.run(RunJar.java:233)
at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
FAILED: ParseException line 1:17 cannot recognize input near ‘orders_avro’ ‘partition’ ‘(’ in destination specification
hive (shalini_retail_stage)> describe orders_avro;
OK
order_id int
order_date string
order_customer_id int
order_status string
order_month string

Partition Information

col_name data_type comment

order_month string
Time taken: 0.271 seconds, Fetched: 10 row(s)
hive (shalini_retail_stage)>