我在HDFS(比如說/用戶/ hduser /表1)目錄多發性目錄和目錄下有不同的時間戳像/user/hduser/table1/20160912000000
,/user/hduser/table1/20160912100000
和/user/hduser/table1/20160912121000
閱讀使用HIVE外部表
我如何讀取多個目錄所有通過一個HIVE外部表格在這三個目錄下的文件。意味着我必須在HIVE表的LOCATION參數中指定什麼。
我在HDFS(比如說/用戶/ hduser /表1)目錄多發性目錄和目錄下有不同的時間戳像/user/hduser/table1/20160912000000
,/user/hduser/table1/20160912100000
和/user/hduser/table1/20160912121000
閱讀使用HIVE外部表
我如何讀取多個目錄所有通過一個HIVE外部表格在這三個目錄下的文件。意味着我必須在HIVE表的LOCATION參數中指定什麼。
試試下面的代碼
CREATE TABLE TABLEname (coll INT, coll STRING, coll INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ‘,’
LOCATION ‘/user/hduser/table1/*/*’;
我可以用下面的設置來讀取嵌套的文件夾。
set hive.mapred.supports.subdirectories=true;
set mapred.input.dir.recursive=true;
我在創建表格時設置了它,然後能夠從表格中選擇數據。地點關鍵字我提到如下
LOCATION '/user/hduser/table1/'
,因爲我有文件,就像下面這樣可不行「/用戶/ hduser /表1/201609.12億/文件1及/用戶/ hduser /表1/201609.12億/文件2」,「/用戶/ hduser/table1/20160912100000/file3&/ user/hduser/table1/20160912100000/file4「和」/ user/hduser/table1/20160912121000/file5&/ user/hduser/table1/20160912121000/file6「。我想從file1讀取所有文件到file6 –
我已經編輯了答案,假設在/ user/hduser/table1/ –
下會有與同一個表相關的文件否,在使用LOCATION值後仍然沒有采集數據如上所述。 –