Skip to content

[Iceberg AddFiles] Allow very large batch import#38039

Merged
ahmedabu98 merged 6 commits intoapache:masterfrom
ahmedabu98:add-files-large-batch
Apr 7, 2026
Merged

[Iceberg AddFiles] Allow very large batch import#38039
ahmedabu98 merged 6 commits intoapache:masterfrom
ahmedabu98:add-files-large-batch

Conversation

@ahmedabu98
Copy link
Copy Markdown
Contributor

@ahmedabu98 ahmedabu98 commented Apr 1, 2026

Current implementation gathers all data files into one worker to commit. This can result in OOM when importing large amounts of files (e.g. millions).

New implementation batches data files into Manifests, then batches manifests into one worker to commit. This is much more manageable for the one committing worker

Also reverting the in-depth bucket-partition validation, partly because it is too resource intensive, and also because the Spark AddFiles equivalent performs zero validation.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the Iceberg AddFiles implementation to support high-volume data imports. By introducing an intermediate step that batches data files into Iceberg Manifest files before committing, the system avoids memory bottlenecks on the committing worker. This change improves stability and scalability for pipelines processing millions of files.

Highlights

  • Improved Scalability for Large Imports: Replaced the single-worker commit approach with a two-stage batching process: first grouping data files into manifests, then grouping manifests for commit, preventing OOM errors during large imports.
  • New Configuration Parameter: Replaced 'appendBatchSize' with 'manifestFileSize' to better reflect the new architecture of batching data files into manifests.
  • Optimized Resource Usage: Removed the 'ACTIVE_READERS' semaphore, as the new batching strategy inherently manages resource pressure more effectively.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@ahmedabu98
Copy link
Copy Markdown
Contributor Author

Iceberg unit tests are failing with a weird error. It's passing fine locally. I think might be something related to infra?

@chamikaramj chamikaramj added this to the 2.73.0 Release milestone Apr 2, 2026
Copy link
Copy Markdown
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks!

"For a streaming pipeline, sets the desired number of appended files per commit. Defaults to 100,000 files. "
+ "A commit is triggered when either this or append triggering interval is reached.")
public abstract @Nullable Integer getAppendBatchSize();
@SchemaFieldDescription("The number of data files per manifest (default 10,000 files).")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How/why would an end-user customize this ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To tweak the performance of AddFiles, and the performance of table queries

Copy link
Copy Markdown
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

Thanks. LGTM.

It's great if we can get this into Beam 2.73.0.

cc: @Amar3tto

@ahmedabu98
Copy link
Copy Markdown
Contributor Author

It shows IcebergIO Integration Tests passed, but something associated in "Test Results" failed? I'm not sure how to read this

@ahmedabu98
Copy link
Copy Markdown
Contributor Author

So tests passed, but publishing the results failed (issue from GHA side). Will consider this as green and merge

@ahmedabu98 ahmedabu98 merged commit c68f520 into apache:master Apr 7, 2026
34 of 43 checks passed
@ahmedabu98
Copy link
Copy Markdown
Contributor Author

Cherry pick: #38096

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants