2016-02-04 27 views
0

我想知道如何從豬腳本的目錄加載一些文件。從豬腳本的目錄中加載選定的文件

比方說,有4個文件在JAN一個月目錄和那4個文件名稱如下

2016-01-01.txt 
2016-01-02.txt 
2016-01-03.txt 
2016-01-04.txt 

現在,我的要求是文件讀取2016年1月1日至2016年1月3日,這意味着以2016年1月的第3個文件..

我的豬腳本:

此線以下工作:

rec = LOAD '/home/dir/{2016-01-01*,2016-01-02*,2016-01-03*}' USING PigStorage(','); 

這低於行不起作用:

rec = LOAD '/home/dir/{2016-01-{01*-03*}}' USING PigStorage(','); 

我收到以下錯誤。我在MAPR集羣中使用Pig 0.14

N/A  file_records MAP_ONLY  Message:  org.apache.pig.backend.executionengine.ExecException: ERROR 2118: Input Pattern maprfs:///home/dir/{2016-01-{01*-03*}} matches 0 files. Paths with components .*, _* were skipped. 
0 additional path filters were applied 

請問有人能解釋我發生了什麼,我該如何解決這個問題?

回答

1

可能重複Load mutilple files over a date range in PIG

rec = LOAD '/home/dir/{2016-01-0{1,2,3}*}' USING PigStorage(','); 

rec = LOAD '/home/dir/{2016-01-{01,02,03}*}' USING PigStorage(','); 

rec = LOAD '/home/dir/{2016-01-0[1-3]*}' USING PigStorage(','); 
+0

您的意見作品。非常感謝! –