I am not able to run ALTER TABLE MY_EXTERNAL_TABLE RECOVER PARTITIONS;
on hive 1.2, however when i run the alternative MSCK REPAIR TABLE MY_EXTERNAL_TABLE
its just listing the partitions which aren't there in Hive Meta Store and not adding it. Based on the source code from hive-exec am able to see under org/apache/hadoop/hive/ql/parse/HiveParser.g:1001:1
that theres no token matching in the grammer for RECOVER PARTITIONS.
Kindly let me know if theres a way to recover all the partitions after creating external table on Hive 1.2.
Stack Trace for ALTER TABLE MY_EXTERNAL_TABLE RECOVER PARTITIONS;
:
NoViableAltException(26@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.alterTableStatementSuffix(HiveParser.java:7946)
at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatement(HiveParser.java:7409)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2693)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1658)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1117)
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:431)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:316)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1189)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1237)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1126)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1116)
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:497)
at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
FAILED: ParseException line 1:45 cannot recognize input near 'recover' 'partitions' '<EOF>' in alter table statement
Note: Am using S3 as the storage, HDP 2.4 for hadoop and Hive 1.2.
Hi after spending some time debugging got the fix, the reason is it was not adding the partition through MSCK, as my partition names were in camel case(FileSystem is case sensitive, but hive treats all partition column names as lowercase), however once made my partition path in lowercase it works like a charm.