-
Notifications
You must be signed in to change notification settings - Fork 288
Iceberg 1.11 support for Spark 411, part (2/3): add iceberg-1-11-x module #14882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
res-life
wants to merge
4
commits into
NVIDIA:main
Choose a base branch
from
res-life:iceberg-1.11/pr2-new-module-and-411
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
911e7cc
Iceberg 1.11 support for Spark 411, part (2/3): add iceberg-1-11-x mo…
0d82ecb
Return null on any reflection access failure in GpuSparkScanAccess.br…
ee7dd98
Clarify Iceberg version-detect "must stay in sync" comment for Spark 4.1
3ce638f
Note Spark 4.1 iceberg version-detect is nightly-only in pre-merge co…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Copyright (c) 2026 NVIDIA CORPORATION. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>com.nvidia</groupId> | ||
| <artifactId>rapids-4-spark-parent_2.12</artifactId> | ||
| <version>26.08.0-SNAPSHOT</version> | ||
| <relativePath>../../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>rapids-4-spark-iceberg-1-11-x_2.12</artifactId> | ||
| <name>RAPIDS Accelerator for Apache Iceberg</name> | ||
| <description>Apache Iceberg support for the RAPIDS Accelerator for Apache Spark</description> | ||
| <version>26.08.0-SNAPSHOT</version> | ||
|
|
||
| <properties> | ||
| <rapids.module>../iceberg/iceberg-1-11-x</rapids.module> | ||
| <rapids.compressed.artifact>false</rapids.compressed.artifact> | ||
| <rapids.shim.jar.phase>package</rapids.shim.jar.phase> | ||
| <maven.scaladoc.skip>true</maven.scaladoc.skip> | ||
| <!-- | ||
| Spark 4.x catalyst class files (Table, WriteBuilder, etc.) carry | ||
| @Deprecated(since = "...") annotations. Reading them under a Java 8 | ||
| target makes javac emit "Cannot find annotation method 'since()' in | ||
| type 'Deprecated'" against those class files, which the project's | ||
| -Werror promotes to an error. Exclude classfile warnings (and -options | ||
| for parity with release411) so this module's Java sources compile | ||
| under Spark 4.1 builds. | ||
| --> | ||
| <scala.javac.args>-Xlint:all,-serial,-path,-try,-processing,-options,-classfile|-Werror</scala.javac.args> | ||
| </properties> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>com.nvidia</groupId> | ||
| <artifactId>rapids-4-spark-sql_${scala.binary.version}</artifactId> | ||
| <classifier>${spark.version.classifier}</classifier> | ||
| </dependency> | ||
| <dependency> | ||
| <groupId>org.apache.iceberg</groupId> | ||
| <artifactId>iceberg-spark-runtime-${iceberg.artifact.suffix}_${scala.binary.version}</artifactId> | ||
| <version>${iceberg.111x.version}</version> | ||
| <scope>provided</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.codehaus.mojo</groupId> | ||
| <artifactId>build-helper-maven-plugin</artifactId> | ||
| <executions> | ||
| <execution> | ||
| <id>add-common-sources</id> | ||
| <phase>generate-sources</phase> | ||
| <goals> | ||
| <goal>add-source</goal> | ||
| </goals> | ||
| <configuration> | ||
| <sources> | ||
| <source>${spark.rapids.source.basedir}/iceberg/common/src/main/java</source> | ||
| <source>${spark.rapids.source.basedir}/iceberg/common/src/main/scala</source> | ||
| </sources> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>net.alchim31.maven</groupId> | ||
| <artifactId>scala-maven-plugin</artifactId> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.rat</groupId> | ||
| <artifactId>apache-rat-plugin</artifactId> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </project> |
89 changes: 89 additions & 0 deletions
89
...eberg-1-11-x/src/main/java/com/nvidia/spark/rapids/iceberg/iceberg111x/ShimUtilsImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| /* | ||
| * Copyright (c) 2026, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.nvidia.spark.rapids.iceberg.iceberg111x; | ||
|
|
||
| import com.nvidia.spark.rapids.GpuMetric; | ||
| import com.nvidia.spark.rapids.RapidsConf; | ||
| import com.nvidia.spark.rapids.fileio.iceberg.IcebergInputFile; | ||
| import com.nvidia.spark.rapids.iceberg.IcebergShimUtils; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.iceberg.*; | ||
| import org.apache.iceberg.io.FileIO; | ||
| import org.apache.iceberg.io.StorageCredential; | ||
| import org.apache.iceberg.io.SupportsStorageCredentials; | ||
| import org.apache.iceberg.shaded.org.apache.parquet.ParquetReadOptions; | ||
| import org.apache.iceberg.shaded.org.apache.parquet.hadoop.ParquetFileReader; | ||
| import org.apache.iceberg.spark.SparkUtil; | ||
| import org.apache.iceberg.spark.source.GpuSparkCopyOnWriteScan; | ||
| import org.apache.iceberg.spark.source.GpuSparkScan; | ||
| import org.apache.iceberg.types.Types; | ||
| import org.apache.iceberg.util.PartitionUtil; | ||
| import org.apache.spark.sql.connector.read.Scan; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| /** Iceberg 1.11.x shim: uses {@code SparkUtil::internalToSpark} and a cache-aware footer path. */ | ||
| public class ShimUtilsImpl implements IcebergShimUtils { | ||
| @Override | ||
| public String locationOf(ContentFile<?> f) { | ||
| return f.location(); | ||
| } | ||
|
|
||
| @Override | ||
| public Map<Integer, ?> constantsMap(FileScanTask task, Schema readSchema, Table table) { | ||
| if (readSchema.findField(MetadataColumns.PARTITION_COLUMN_ID) != null) { | ||
| Types.StructType partitionType = Partitioning.partitionType(table); | ||
| return PartitionUtil.constantsMap(task, | ||
| partitionType, | ||
| SparkUtil::internalToSpark); | ||
| } else { | ||
| return PartitionUtil.constantsMap(task, SparkUtil::internalToSpark); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public Map<String, Map<String, String>> storageCredentialOverlays(FileIO fileIO) { | ||
| if (!(fileIO instanceof SupportsStorageCredentials)) { | ||
| return Collections.emptyMap(); | ||
| } | ||
| Map<String, Map<String, String>> result = new HashMap<>(); | ||
| for (StorageCredential sc : ((SupportsStorageCredentials) fileIO).credentials()) { | ||
| result.put(sc.prefix(), sc.config()); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public ParquetFileReader openParquetReader( | ||
| IcebergInputFile inputFile, | ||
| Path filePath, | ||
| ParquetReadOptions options, | ||
| scala.collection.immutable.Map<String, GpuMetric> metrics) throws IOException { | ||
| return GpuParquetIOShim.openReader(inputFile, filePath, options, metrics); | ||
| } | ||
|
|
||
| @Override | ||
| public GpuSparkScan newCopyOnWriteScan( | ||
| Scan cpuScan, | ||
| RapidsConf rapidsConf, | ||
| boolean queryUsesInputFile) { | ||
| return GpuSparkCopyOnWriteScan.create(cpuScan, rapidsConf, queryUsesInputFile); | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...-1-11-x/src/main/scala/com/nvidia/spark/rapids/iceberg/iceberg111x/GpuParquetIOShim.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright (c) 2026, NVIDIA CORPORATION. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.nvidia.spark.rapids.iceberg.iceberg111x | ||
|
|
||
| import com.nvidia.spark.rapids.Arm.{closeOnExcept, withResource} | ||
| import com.nvidia.spark.rapids.GpuMetric | ||
| import com.nvidia.spark.rapids.fileio.iceberg.IcebergInputFile | ||
| import com.nvidia.spark.rapids.iceberg.parquet.converter.ToIcebergShaded | ||
| import com.nvidia.spark.rapids.parquet.{HMBInputFile, ParquetFooterUtils} | ||
| import org.apache.hadoop.fs.Path | ||
| import org.apache.iceberg.parquet.GpuParquetIO | ||
| import org.apache.iceberg.shaded.org.apache.parquet.ParquetReadOptions | ||
| import org.apache.iceberg.shaded.org.apache.parquet.hadoop.ParquetFileReader | ||
|
|
||
| /** | ||
| * Iceberg 1.11.x shim: reads the footer via `FileCache` and injects it into `ParquetFileReader` | ||
| * through the 4-arg `(InputFile, ParquetMetadata, ParquetReadOptions, SeekableInputStream)` | ||
| * constructor that is available from iceberg 1.10.x onward. Lives in the versioned | ||
| * `iceberg111x` package so each minor-version shim can evolve independently without the | ||
| * shade-plugin class-name collision that the 1.10.x split introduced. | ||
| */ | ||
| object GpuParquetIOShim { | ||
| def openReader( | ||
| inputFile: IcebergInputFile, | ||
| filePath: Path, | ||
| options: ParquetReadOptions, | ||
| metrics: Map[String, GpuMetric]): ParquetFileReader = { | ||
| val metadata = withResource(ParquetFooterUtils.getFooterBuffer( | ||
| inputFile, metrics, | ||
| ParquetFooterUtils.readFooterBufferFromInputFile(inputFile, filePath))) { hmb => | ||
| val shadedHmbFile = ToIcebergShaded.shade(new HMBInputFile(hmb)) | ||
| withResource(shadedHmbFile.newStream()) { hmbStream => | ||
| ParquetFileReader.readFooter(shadedHmbFile, options, hmbStream) | ||
| } | ||
| } | ||
| val realFile = GpuParquetIO.file(inputFile.getDelegate) | ||
| closeOnExcept(realFile.newStream()) { stream => | ||
| new ParquetFileReader(realFile, metadata, options, stream) | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setAccessiblecan throw uncaughtInaccessibleObjectExceptionf.setAccessible(true)can throwInaccessibleObjectException(which extendsRuntimeException, notIllegalAccessException) in Java 9+ environments with module encapsulation. OnlyIllegalAccessExceptionis caught here, so a security or module access rejection would propagate as an uncaught exception. Sincebranch()is used only for display purposes (query description), the catch block should also coverRuntimeException(orInaccessibleObjectException) to maintain the existing "return null on any access failure" contract.