Skip to content

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

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

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
Copy link
Copy Markdown
Contributor

@findinpath findinpath commented May 22, 2026

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.

…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.
Copy link
Copy Markdown
Contributor

@gaborkaszab gaborkaszab 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 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?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants