无法通过Hive 1.2中的alter table恢复分区

时间:2023-01-08 23:03:12

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.

我无法运行ALTER TABLE MY_EXTERNAL_TABLE RECOVER PARTITIONS;在hive 1.2上,但是当我运行替代MSCK REPAIR TABLE MY_EXTERNAL_TABLE时,它只列出Hive Meta Store中不存在的分区而不添加它。基于来自hive-exec的源代码,我可以在org / apache / hadoop / hive / ql / parse / HiveParser.g:1001:1下看到,在RECOVER PARTITIONS的语法中没有令牌匹配。

Kindly let me know if theres a way to recover all the partitions after creating external table on Hive 1.2.

请告诉我,如果在Hive 1.2上创建外部表后恢复所有分区的方法。

Stack Trace for ALTER TABLE MY_EXTERNAL_TABLE RECOVER PARTITIONS; :

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.

注意:我使用S3作为存储,HDP 2.4用于hadoop和Hive 1.2。

1 个解决方案

#1


1  

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.

嗨花了一些时间调试得到了修复,原因是它没有通过MSCK添加分区,因为我的分区名称是驼峰情况(FileSystem区分大小写,但是hive将所有分区列名称视为小写),但是一旦制作我的小写分区路径就像一个魅力。

#1


1  

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.

嗨花了一些时间调试得到了修复,原因是它没有通过MSCK添加分区,因为我的分区名称是驼峰情况(FileSystem区分大小写,但是hive将所有分区列名称视为小写),但是一旦制作我的小写分区路径就像一个魅力。