Apache Parquet I/O 連接器
- Java SDK
- Python SDK
Beam SDK 包含內建轉換,可以從 Apache Parquet 檔案讀取資料和寫入資料。
開始之前
若要使用 ParquetIO,請將 Maven 成品依賴性新增至您的 pom.xml
檔案。
其他資源
ParquetIO 已預先安裝在 Apache Beam python sdk..2.60.0 中
其他資源
在 2.4 之前的 Spark 中使用 ParquetIO
ParquetIO
依賴於 Apache Parquet 1.10.0 中引入的 API。Spark 2.4.x 相容,且無需其他步驟。較舊版本的 Spark 無法直接運作,因為在執行期間會優先使用預先安裝的 Parquet 程式庫。應套用以下解決方法。
注意:以下技術可讓您正確執行
ParquetIO
的管道。此 Beam 連接器所使用或產生的 Parquet 檔案應保持與叢集上的其他工具互通。
正常包含 Parquet 成品,並確保它引入正確版本的 Parquet 作為傳遞依賴性。
重新定位下列套件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<relocations>
<relocation>
<pattern>org.apache.parquet</pattern>
<shadedPattern>shaded.org.apache.parquet</shadedPattern>
</relocation>
<!-- Some packages are shaded already, and on the original spark classpath. Shade them more. -->
<relocation>
<pattern>shaded.parquet</pattern>
<shadedPattern>reshaded.parquet</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.avro</pattern>
<shadedPattern>shaded.org.apache.avro</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
此技術已測試可在 Spark 2.2.3、Spark 2.3.3 和 Spark 2.4.3 上運作 (雖然對於 Spark 2.4+ 是選用的)。
上次更新於 2024/10/31
您是否找到了您要尋找的所有內容?
是否一切都有用且清楚?是否有任何您想要變更的地方?請告訴我們!