简体   繁体   English

将文件添加到配置单元分区

[英]Adding file to hive partition

Until hive 0.13 version I was able to add a file to a particular partition of a hive table using the below command : 在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';

Our cluster got updated and hive is now hive 1.2 version. 我们的集群已更新,并且hive现在是hive 1.2版本。 I am unable to execute the above command as it throws out the below error : 我无法执行上述命令,因为它抛出以下错误:

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)

Could you please let me know that from hive 1.2 version we can only add directories to partition? 您能否让我知道,从配置单元1.2版本开始,我们只能将目录添加到分区中?

Partition location should be directory. 分区位置应该是目录。 Create partition with location=some_directory first then put files into directory. 首先使用location = some_directory创建分区,然后将文件放入目录。 Or put files into some directory then alter table add partition with location = directory. 或将文件放入某个目录,然后更改表,并使用location = directory添加分区。

In your example this is like this: 在您的示例中,如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM