Skip to content

[#39723] Implement model for Iceberg side input cache - #39724

Merged
jrmccluskey merged 2 commits into
apache:masterfrom
jrmccluskey:feat/iceberg-side-input-table-cache-pr1
Aug 20, 2026
Merged

jrmccluskey merged 2 commits into
apache:masterfrom
jrmccluskey:feat/iceberg-side-input-table-cache-pr1

Conversation

@jrmccluskey

@jrmccluskey jrmccluskey commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Implements the SerializableTableSpec and SideInputTable classes to provide a serializable representation of Iceberg table metadata + corresponding tests.

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: @Abacn 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).

public abstract String getPartitionSpecJson();

@SchemaFieldNumber("6")
public abstract String getSortOrderJson();

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.

I think we should keep track of the full map of schemas / partition specs / sort orders. There are instances where we're not always working with the most recent table metadata, so we'll need to have access to historical schema/spec/sort orders.

Might make sense to add 3 int fields to indicate the "current" schemaId, specId, orderId, and use them to return the respective metadata property.

@ahmedabu98 ahmedabu98 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.

Looks good, just left one nit

Comment on lines +110 to 125
public Map<Integer, Schema> getSchemas() {
Map<Integer, Schema> local = cachedSchemas;
if (local == null) {
synchronized (this) {
local = cachedSchema;
local = cachedSchemas;
if (local == null) {
cachedSchema = local = SchemaParser.fromJson(getSchemaJson());
ImmutableMap.Builder<Integer, Schema> builder = ImmutableMap.builder();
for (Map.Entry<Integer, String> entry : getSchemasJson().entrySet()) {
builder.put(entry.getKey(), SchemaParser.fromJson(entry.getValue()));
}
cachedSchemas = local = builder.build();
}
}
}
return local;
}

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.

Can we do this in a more lazy way? If the table historically has 10 schemas and I want to get one, I should only have to serialize that one schema, not all 10.

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.

Same comment for the partition spec and sort order maps

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.

How heavy-weight are these schemas/specs/sort orders? If they're not particularly intensive to serialize and deserialize I don't know if there's much benefit to adding an extra level of tuning here, the downstream usages would be able to make determinations as to what they need without having the extra overhead of a separately configurable thing here.

Probably something we could explore after the e2e implementation is done, benchmarking to see if tuning the number of serialized objects matters or not.

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.

Sounds good, we can leave it as a later improvement

@ahmedabu98 ahmedabu98 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.

LGTM, thanks

@jrmccluskey
jrmccluskey merged commit a26ecfd into apache:master Aug 20, 2026
20 checks passed
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