Skip to content

Implement Iceberg Table Metadata Driver transform - #39883

Open
jrmccluskey wants to merge 2 commits into
apache:masterfrom
jrmccluskey:feat/iceberg-side-input-table-cache-pr2
Open

Implement Iceberg Table Metadata Driver transform#39883
jrmccluskey wants to merge 2 commits into
apache:masterfrom
jrmccluskey:feat/iceberg-side-input-table-cache-pr2

Conversation

@jrmccluskey

Copy link
Copy Markdown
Contributor

Implements the Iceberg table metadata query transform and materializes the table metadata to be used downstream as a side input.

Part of #39723


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @chamikaramj for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@chamikaramj chamikaramj left a comment

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.

Thanks!

import org.joda.time.Instant;

/**
* A driver transform that extracts table identifiers from incoming {@link Row}s, deduplicates them

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.

Cloud you clarify in the docs how this helper will be used, specially given that this seem to be providing a sample of tables ?

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.

As-written this effectively acts as a maximum cache size, "sample" is maybe not the right word unless you get more tables than the configured maximum. My lack of experience with Iceberg kind of becomes a problem here, I'm not sure what a "typical" workload looks like in terms of the number of tables being operated on. We could do away with this parameter or make it uncapped by default if that makes more sense

@Test
public void testWindowedDeduplication() {
Catalog catalog = getCatalog();
TableIdentifier table1 = TableIdentifier.of("default", "t1");

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.

Did you expect to test same table ID being returned by multiple windows here ?

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.

This is what I get for leaning on Gemini to produce some unit tests. The name is misleading, it's really testing that we deduplicate the target table IDs when we build the spec (since there are 50 elements referring to t1 and 50 elements referring to t2, we deduplicate that to single references to the two tables.) I'll rename this, the window doesn't really matter

public void processElement(
@Element String tableIdString, OutputReceiver<KV<String, SerializableTableSpec>> out) {
TableIdentifier tableId = IcebergUtils.parseTableIdentifier(tableIdString);
Table table = catalogConfig.catalog().loadTable(tableId);

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.

Note that a bad table string here will cause the whole bundle to fail. Is this intended or should we skip bad records and try other elements ?

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.

We could set up some sort of DLQ here. As best I can tell the current iceberg implementation uses the same approach of outright failing on bad table identifiers though

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.34%. Comparing base (66ecc31) to head (11fffa9).
⚠️ Report is 27 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #39883      +/-   ##
============================================
+ Coverage     57.22%   58.34%   +1.12%     
- Complexity     3661    13472    +9811     
============================================
  Files          1195     2567    +1372     
  Lines        193411   268606   +75195     
  Branches       3831    11030    +7199     
============================================
+ Hits         110670   156717   +46047     
- Misses        79171   105952   +26781     
- Partials       3570     5937    +2367     
Flag Coverage Δ
java 64.45% <ø> (-7.75%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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