繁体   English   中英

是否可以在Hive中导出许多分区

[英]Is it possible to export many partitions in Hive


是否可以在一个EXPORT中从一个表导出多个分区?

文档说:

EXPORT TABLE tablename [PARTITION (part_column="value"[, ...])]
  TO 'export_target_path'

我想[, ...]表示其他分区列: part_column1="value", part_column2="value"对于同一分区列没有不同的值。

是否可以将一列使用多个值? 我的意思是这样的: part_column1 = "value1","value2"part_column1 = "value1", part_column1 = "value2"吗?

[编辑]我的例子是:

hive (pr)> export table account partition (start_date="2015-06-23",start_date="2015-06-22") to 'accounts';
Copying data from file:/tmp/hive_2015-07-02_17-40-50_937_3732031090994168422-1/-local-10000/_metadata
Copying file: file:/tmp/hive_2015-07-02_17-40-50_937_3732031090994168422-1/-local-10000/_metadata
Copying data from hdfs://server.pl:8020/apps/hive/warehouse/pr.db/account/start_date=2015-06-22
Copying file: hdfs://server.pl:8020/apps/hive/warehouse/pr.db/account/start_date=2015-06-22/000000_0
Copying file: hdfs://server.pl:8020/apps/hive/warehouse/pr.db/account/start_date=2015-06-22/000001_0
Copying file: hdfs://server.pl:8020/apps/hive/warehouse/pr.db/account/start_date=2015-06-22/000002_0
OK
Time taken: 20.69 seconds

所以我想导出两个分区:start_date =“ 2015-06-23”,start_date =“ 2015-06-22”并且仅导出了分区start_date =“ 2015-06-22”

帕维尔

从Hive 0.14开始,您将无法执行此操作。 尝试指定2个分区将在目标目录中仅使用来自一个分区的数据创建一个文件夹。

好吧,文档示例清楚地表明您可以为两栏做

export table employee partition (emp_country="in", emp_state="ka") to 'hdfs_exports_location/employee';

因此,当您可以执行上述操作时,您还可以获取以下内容。 您是否遇到任何错误

export table employee partition (emp_country="in", emp_country="us") to 'hdfs_exports_location/employee';

暂无
暂无

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

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