Skip to content

Use returned cuDF Parquet footer for Iceberg writes [fast-ut] - #15877

Open
liurenjie1024 wants to merge 6 commits into
NVIDIA:mainfrom
liurenjie1024:ray/cudf-18886
Open

Use returned cuDF Parquet footer for Iceberg writes [fast-ut]#15877
liurenjie1024 wants to merge 6 commits into
NVIDIA:mainfrom
liurenjie1024:ray/cudf-18886

Conversation

@liurenjie1024

@liurenjie1024 liurenjie1024 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Related to NVIDIA/cudf#18886.

Description

Iceberg GPU writes currently reopen each Parquet output file after closing it to obtain footer metadata for file metrics and split offsets. This causes an unnecessary read from the output filesystem, which is especially costly for remote storage.

This change uses the new cuDF ParquetTableWriter.closeAndGetFooter() API to return the metadata-only Parquet footer during writer finalization. GpuParquetWriter exposes the returned host buffer to the Iceberg appender, which parses it through Iceberg's shaded Parquet reader without reopening the output file.

The shared columnar writer close path preserves the existing finalization sequence and closes the returned buffer if output finalization fails.

Validation:

  • Spark 4.1.1 / Scala 2.13 build: all 19 modules succeeded.
  • Spark 4.1.1 with Iceberg 1.11.0 local Hadoop catalog: 432 passed, 19 skipped, 6 xfailed, and 3 xpassed.
  • The existing Iceberg integration suite exercises append, overwrite, merge, schema and partition evolution, metrics, and split-offset paths.

This change and PR description were prepared with AI assistance from OpenAI Codex.

Checklists

Documentation

  • Updated for new or modified user-facing features or behaviors
  • No user-facing change

Testing

  • Added or modified tests to cover new code paths
  • Covered by existing tests
    (Iceberg integration suite with Spark 4.1.1 and Iceberg 1.11.0.)
  • Not required

Performance

  • Tests ran and results are added in the PR description
  • Issue filed with a link in the PR description
  • Not required

Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
@liurenjie1024 liurenjie1024 added SQL part of the SQL/Dataframe plugin performance A performance related task/issue cudf_dependency An issue or PR with this label depends on a new feature in cudf labels Sep 2, 2026
@liurenjie1024
liurenjie1024 marked this pull request as ready for review September 4, 2026 03:32
@liurenjie1024 liurenjie1024 changed the title [WIP] Use returned cuDF Parquet footer for Iceberg writes [fast-ut] Use returned cuDF Parquet footer for Iceberg writes [fast-ut] Sep 4, 2026
@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR avoids reopening completed Iceberg Parquet files by obtaining footer metadata directly from the cuDF writer.

  • Adds a shared close path that returns an owned resource while preserving output finalization.
  • Exposes the cuDF Parquet footer buffer through GpuParquetWriter.
  • Parses the returned buffer with Iceberg’s shaded Parquet reader for metrics and split offsets.
  • Removes the now-unused Iceberg footer-reopen helper and appender FileIO dependency.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains in the eligible follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
iceberg/common/src/main/java/com/nvidia/spark/rapids/fileio/iceberg/IcebergFileIO.java Removes the specialized input-file helper that was used only to reopen newly written files for footer metadata.
iceberg/common/src/main/scala/com/nvidia/spark/rapids/iceberg/parquet/GpuIcebergParquetAppender.scala Replaces post-close filesystem footer reads with parsing of the host buffer returned during writer finalization.
iceberg/common/src/main/scala/org/apache/iceberg/spark/source/GpuSparkFileWriterFactory.scala Stops passing a redundant Iceberg FileIO instance into the Parquet appender.
sql-plugin/src/main/scala/com/nvidia/spark/rapids/ColumnarOutputWriter.scala Factors writer shutdown into preparation and output-finalization stages and adds a resource-safe close-and-return helper.
sql-plugin/src/main/scala/com/nvidia/spark/rapids/GpuParquetFileFormat.scala Narrows the writer type to ParquetTableWriter and exposes its returned footer buffer to Iceberg.

Sequence Diagram

sequenceDiagram
  participant Iceberg as Iceberg writer
  participant Appender as GpuIcebergParquetAppender
  participant Writer as GpuParquetWriter
  participant cuDF as cuDF ParquetTableWriter
  participant Output as Output stream
  participant Reader as Shaded ParquetFileReader

  Iceberg->>Appender: close()
  Appender->>Writer: closeAndGetFooter()
  Writer->>cuDF: closeAndGetFooter()
  cuDF-->>Writer: HostMemoryBuffer
  Writer->>Output: flush buffered data and close
  Writer-->>Appender: footer buffer
  Appender->>Reader: open(HMBInputFile(buffer))
  Reader-->>Appender: ParquetMetadata
  Appender->>Appender: close footer buffer
  Iceberg->>Appender: metrics() / splitOffsets()
  Appender-->>Iceberg: footer-derived metadata
Loading

Reviews (5): Last reviewed commit: "Remove unused Iceberg input file helper" | Re-trigger Greptile

Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
@liurenjie1024

Copy link
Copy Markdown
Collaborator Author

build

@res-life

res-life commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Please clean IcebergFileIO.newIcebergInputFile if it's dead now.

Signed-off-by: Ray Liu <liurenjie2008@gmail.com>
@liurenjie1024

Copy link
Copy Markdown
Collaborator Author

Removed IcebergFileIO.newIcebergInputFile; the in-memory footer path left it with no callers. Spark 4.1.1/Scala 2.13 build and scalastyle pass.

@res-life res-life left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@liurenjie1024

Copy link
Copy Markdown
Collaborator Author

build

@gerashegalov gerashegalov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gerashegalov

Copy link
Copy Markdown
Collaborator

build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cudf_dependency An issue or PR with this label depends on a new feature in cudf performance A performance related task/issue SQL part of the SQL/Dataframe plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants