Datafusion session integration - #3000
Draft
DerGut wants to merge 11 commits into
Draft
Conversation
DerGut
force-pushed
the
datafusion-session-integration
branch
from
August 15, 2026 17:16
6f7924b to
3965cfc
Compare
DerGut
force-pushed
the
datafusion-session-integration
branch
from
August 15, 2026 17:21
3965cfc to
7238c5d
Compare
DerGut
force-pushed
the
datafusion-session-integration
branch
from
August 15, 2026 20:26
7238c5d to
0208eef
Compare
DerGut
force-pushed
the
datafusion-session-integration
branch
from
August 17, 2026 13:04
391d7fd to
110d81b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
This is another PR in my series to close #2774.
Today, the Datafusion Session (which is already available for each query) terminates at the Iceberg catalog boundary. Scans for example, use a shared
dyn Catalogand then call thecatalog.load_table(&self.table_ident)function on it, which doesn't support any way of context propagation.Our downstream REST catalog requires this context to make authorization, rate limiting and shard routing decisions.
What changes are included in this PR?
This PR starts to use the freshly introduced
SessionCatalogtrait in our Datafusion{Catalog, Schema, Table}Providers.A user will now be able to provide forward Datafusion query context to their Iceberg catalog by providing 1) a
dyn SessionCatalog(like theRestSessionCatalogintroduced by #2920) and 2) a customdyn SessionContextResolverimplementation.Public API
The public API is extended with two new symbols:
IcebergCatalogProvider::try_new_with_session_catalogSessionContext(which the session catalog accepts)A possible implementation of this trait may look like
Why a new Trait?
This is necessary because Datafusion doesn't have a canonical way of encoding query context (in contrast to Trino's
ConnectorSession). Instead, it propagates arbitrary types via itsSessionConfig's extension mechanism.This leaves us with two ways to shape a Datafusion SessionConfig's extension into a
SessionContext:Option 1. has a meaningful drawback: a Datafusion instance that connects to multiple data sources/ catalog providers (and supports joins between those) shouldn't use a dedicated query context for each, but one user-defined one that can be interpreted by each data source.
Note on
RestSessionCatalogSince the REST catalog implementations abstract the HTTP protocol away, there's another layer missing to specify how an Iceberg
SessionContextcan be used to enrich HTTP requests with the provided metadata. The newly introducedAuthManagertrait (via #2838) can be used for that.The Implementation
CatalogAccessEnumI'd like to keep a way for users to create
CatalogProviders from plainCatalogs in case they don't deal with sessions. Removing that constructor would be breaking anyway.Again, I saw two options to do this:
{Catalog, Schema, Table}Providerwe'd have something like{Catalog, Schema, Table}SessionProvidersFor this draft, I figured that the overhead of two sets of public APIs, in addition to the duplicate code (or a similar common abstraction to 1. to reduce some duplication) makes 2. seem simpler. So that's what I went for.
Are these changes tested?
⏳ Tests are coming.
AI Disclosure