Skip to content

REST: introduce FileIOBuilder to pass storage credentials at construction time#16536

Draft
findinpath wants to merge 1 commit into
apache:mainfrom
findinpath:findinpath/rest-session-catalog-io-builder
Draft

REST: introduce FileIOBuilder to pass storage credentials at construction time#16536
findinpath wants to merge 1 commit into
apache:mainfrom
findinpath:findinpath/rest-session-catalog-io-builder

Conversation

@findinpath

@findinpath findinpath commented May 22, 2026

Copy link
Copy Markdown
Contributor

Problem

The existing BiFunction<SessionContext, Map<String, String>, FileIO> ioBuilder applied storage credentials post-construction via SupportsStorageCredential.setCredentials method
which does not work for engines (e.g. Trino) that need all inputs available at build time.

Technical solution

Introduce a FileIOBuilder functional interface that receives SessionContext, fileIO properties, and List<StorageCredential> all at once. Deprecate the BiFunction constructor with a wrapper that preserves the old two-step behavior for existing callers.

Related issues and PRs

This contribution is attempting to adjust the previous changes performed in #15752 for configuring StorageCredentials in the ioBuilder.

Issue discovered while developing trinodb/trino#29590
The Trino PR makes use of this contribution for ensuring the accuracy of these changes on https://github.com/trinodb/trino project within the Iceberg connector.

UPDATE 27.05.2026

I've created an alternative in trinodb/trino which works without any changes on apache/iceberg 1.11.0

trinodb/trino#29641
By making Trino's ForwardingFileIO to implement SupportsStorageCredentials (as well as providing a hook to update the underlying TrinoFileSystem's storage credentials, the PR adds the functionality of updating storage credentials for the Trino Iceberg REST catalog integration.

@gaborkaszab gaborkaszab 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 for the PR, @findinpath ! Just tried to understand the issue, asked some clarification.

}

/**
* @deprecated Use {@link #RESTSessionCatalog(Function, FileIOBuilder)} instead.

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.

Please mention which is the target release for removal. Technically, in core/ we can drop one minor release after deprecation. deprecation now is released in 1.12.0, we can drop in 1.13.0. Unless we say this is considered public API even though in core/

: (context, properties, credentials) -> {
FileIO fileIO = ioBuilder.apply(context, properties);
if (!credentials.isEmpty()
&& fileIO instanceof SupportsStorageCredentials ioWithCredentials) {

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.

Is the issue that the ioBuilder passed by Trino returns a FileIO that is not an instance of SupportsStorageCredentials?
Isn't it the "contract" for FileIO that storage credentials can be set through SupportsStorageCredentials.setCredentials()? How difficult would it be to adjust the Trino side to work with this design?

@findinpath findinpath May 27, 2026

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.

Thank you for the feedback.

I've created an alternative in trinodb/trino which works without any changes on apache/iceberg 1.11.0

trinodb/trino#29641

The challenge in trinodb/trino is that we are applying SupportsStorageCredentials on both ForwardingFileIO (trino's wrapper for FileIO) as well as on the TrinoFileSystem

If the above mentioned PR goes through, I'm closing the current PR.

Comment thread core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java Outdated
@danielcweeks danielcweeks self-requested a review May 27, 2026 15:25
…tion time

The existing BiFunction<SessionContext, Map<String, String>, FileIO> ioBuilder
applied storage credentials post-construction via
SupportsStorageCredential.setCredentials method
which does not work for engines (e.g. Trino) that need all inputs available
at build time.

Introduce a FileIOBuilder functional interface that receives SessionContext,
fileIO properties, and List<StorageCredential> all at once.
Deprecate the BiFunction constructor with a wrapper that preserves the old
two-step behavior for existing callers.
@findinpath findinpath force-pushed the findinpath/rest-session-catalog-io-builder branch from 38c8ed5 to 5f314fd Compare May 27, 2026 18:58
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Jun 27, 2026
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.

3 participants