2016-11-15 49 views
0

當我這樣做:火花 「基本路徑」 選項設置

allf = spark.read.parquet("gs://bucket/folder/*")

我得到:

java.lang.AssertionError: assertion failed: Conflicting directory structures detected. Suspicious paths:

...和路徑列表後,下面的消息:

If provided paths are partition directories, please set "basePath" in the options of the data source to specify the root directory of the table. If there are multiple root directories, please load them separately and then union them.

我是Spark新手。我相信我的數據源真的是一個「文件夾」(如base/top_folder/year=x/month=y/*.parquet)的集合,我想加載所有文件並進行轉換。

感謝您的幫助!

  • 更新1:我已經看過Dataproc控制檯,創建羣集時無法設置「選項」。
  • 更新2:我檢查了羣集的「cluster.properties」文件,並且沒有這樣的選項。難道是我必須添加一個並重置羣集?對木地板partition discovery

回答

1

每Saprk文檔,我相信,改變你的負載的語句從

allf = spark.read.parquet("gs://bucket/folder/*") 

allf = spark.read.parquet("gs://bucket/folder") 

應及時發現並加載的所有實木複合地板分區。這是假設數據是以「文件夾」作爲其基本目錄寫入的。

如果目錄庫/文件夾實際上包含多個數據集,則需要獨立加載每個數據集,然後將它們結合在一起。

+0

我希望有一種方法來加載通配符中的所有數據集。沒有看起來這樣的事情。謝謝。 – jldupont