[英]Moving and merging directories in hdfs
我正在更改hdfs目錄結構。 當前的內容如下:
.../customers/customers1/2016-05-16-10/lots_of_files1.csv
.../customers/customers2/2016-05-16-10/lots_of_files2.csv
.../customers/customers3/2016-05-16-10/lots_of_files1.csv
.../customers/customers4/2016-05-16-10/...
.../customers/customers5/2016-05-16-10/...
.../customers/customers6/2016-05-16-10/...
.../customers/customers7/2016-05-16-10/...
我想擺脫顧客(1-7):
.../customers/2016-05-16-10/lots_of_files1.csv
.../customers/2016-05-16-10/lots_of_files2.csv
.../customers/2016-05-16-10/lots_of_files1(1).csv
我以為使用了蛇咬的python hdfs庫,但出現了許多極端情況:1.同一日期可能會發生多次。 2. csv的名稱可能多次出現,但其數據不同,因此也必須移動。
您如何以最干凈的方式實現它?
如果您不擔心保留文件名,則可以輕松使用Apache Drill。 諸如Apache Drill之類的東西支持通過SQL讀寫文件。 就像是
create table dfs.`/myfolder/customers/2016-05-16-10` select * from dfs.`/myfolder/customers` where dir1 = '2016-05-16-10';
/ * / 2016-05-16-10中的所有文件都將寫入目標表。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.