无法通过Hive 1.2中的alter table恢复分区 [英] Not able to recover partitions through alter table in Hive 1.2

查看:695
本文介绍了无法通过Hive 1.2中的alter table恢复分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在配置单元1.2上运行 ALTER TABLE MY_EXTERNAL_TABLE RECOVER PARTITIONS; ,但是当我运行替换 MSCK REPAIR TABLE MY_EXTERNAL_TABLE 它只是列出了Hive Meta Store中没有的分区并且没有添加分区。基于hive-exec的源代码,我可以在 org / apache / hadoop / hive / ql / parse / HiveParser.g:1001:1 下看到theres no token匹配RECOVER PARTITIONS的语法。



请让我知道在Hive 1.2上创建外部表后,如何恢复所有分区。



$

$ b $> NoViableAltException(26 @ [])
。在org.apache.hadoop.hive.ql.parse.HiveParser.alterTableStatementSuffix(HiveParser.java:7946)
。在org.apache.hadoop .hive.ql.parse.HiveParser.alterStatement(HiveParser.java:7409)
在org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2693)
。在组织.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1658)
在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。编译(Driver.java:431)
在org.apache.hadoop.hive.ql.Driver.compile(Driver.java:316)
在org.apache.hadoop.hive.ql.Driver。 compileInternal(Driver.java:1189)
位于org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1237)
位于org.apache.hadoop.hive.ql.Driver。运行(Driver.java:1126)
在org.apache.hadoop.hive.ql.Driver.run(Driver.java:1116)
在org.apache.hadoop.hive.cli.CliDriver。 processLocalCmd(CliDriver.java:216)
处org.apache.hadoop.hive.cli.CliDriver org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:168)
。 ProcessLine从(CliDriver.java:379)
处org.apache.hadoop.hive.cli.CliDriver org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:739)
。运行(CliDriver.java:684)
在org.apache.hadoop.hive.cli.CliDriver.main(CliDriver。 Java的:在sun.reflect.DelegatingMethodAccessorImpl在sun.reflect.NativeMethodAccessorImpl.invoke在sun.reflect.NativeMethodAccessorImpl.invoke0 624)
(本机方法)
(NativeMethodAccessorImpl.java:62)
。 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行1:45无法识别'recover'分区''附近的输入'< EOF> ;'在alter table语句中

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

解决方案

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


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.

这篇关于无法通过Hive 1.2中的alter table恢复分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆