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
探していたものはすべて見つかりましたか?
すべてが役立ち、明確でしたか? 変更したいことはありますか?お知らせください!