在hive 0.13版本之前,我可以使用以下命令将文件添加到hive表的特定分区中:

alter table table add partition (year=2016,month=07,day=25,file_part=1) location '/home/user/data/201607/NetworkActivity_553_1051924_07-25-2016.log.gz';

我们的集群已更新,并且hive现在是hive 1.2版本。我无法执行上述命令,因为它抛出以下错误:
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:maprfs:/home/user/data/201607/NetworkActivity_553_1051924_07-25-2016.log.g is not a directory or unable to create one)

您能否让我知道,从配置单元1.2版本开始,我们只能将目录添加到分区中?

最佳答案

分区位置应该是目录。首先使用location = some_directory创建分区,然后将文件放入目录。或者将文件放入某个目录,然后更改表,并使用location = directory添加分区。

在您的示例中,如下所示:

alter table table add partition (year=2016,month=07,day=25,file_part=1) location '/home/user/data/201607';

关于hadoop - 将文件添加到配置单元分区,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38625213/

10-16 21:29