Skip to content

Conversation

@abhi-airspace-intelligence
Copy link
Contributor

Description

This allows passing a SessionState into an OptimizeBuilder, mirroring the other operation APIs. Very useful if running concurrent delta table operations in a kubernetes pod, as you can limit Datafusion to use a certain amount of ram between all shared contexts to prevent OOMs

Related Issue(s)

Closes #3797, effectively reverts/supersedes #3751

@github-actions github-actions bot added the binding/rust Issues for the Rust crate label Oct 2, 2025
@github-actions
Copy link

github-actions bot commented Oct 2, 2025

ACTION NEEDED

delta-rs follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

Comment on lines +319 to 323
/// A session state accompanying a given input plan, containing e.g. registered object stores
pub fn with_input_session_state(mut self, state: SessionState) -> Self {
self.state = Some(state);
self
}
Copy link
Contributor Author

@abhi-airspace-intelligence abhi-airspace-intelligence Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the name of this function is inconsistent across the various builder APIs, happy to open a follow-up PR to rename everything to either with_input_session_state or with_session_state and deprecate the other.

@abhi-airspace-intelligence abhi-airspace-intelligence changed the title Allow passing a SessionState into a OptimizeBuilder feat: allow passing a SessionState into a OptimizeBuilder Oct 2, 2025
Copy link
Collaborator

@ion-elgreco ion-elgreco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make the naming consistent as you mentioned

@abhi-airspace-intelligence
Copy link
Contributor Author

@ion-elgreco I'll do that in a follow-up PR to minimize blast radius!

@ion-elgreco ion-elgreco enabled auto-merge (squash) October 2, 2025 18:40
@codecov
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.06%. Comparing base (18f949e) to head (49656ea).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/operations/optimize.rs 82.14% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3802      +/-   ##
==========================================
- Coverage   76.06%   76.06%   -0.01%     
==========================================
  Files         145      145              
  Lines       45273    45276       +3     
  Branches    45273    45276       +3     
==========================================
- Hits        34439    34438       -1     
- Misses       9144     9147       +3     
- Partials     1690     1691       +1     

☔ View full report in Codecov by Sentry.
📢 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.

/// Optional [SessionConfig] for users that want more control over the Datafusion execution
session_config: Option<SessionConfig>,
/// Datafusion session state relevant for executing the input plan
state: Option<SessionState>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't looked at all the APIs, but would we get away with tracking something like Arc<dyn Session> here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks like that's preferred by Datafusion to pass this instead. https://docs.rs/datafusion-session/50.1.0/datafusion_session/session/trait.Session.html#migration-from-sessionstate. Let me give it a shot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roeap I will resolve this in a follow-up PR, since I'm unifying all the interfaces anyways

@roeap
Copy link
Collaborator

roeap commented Oct 2, 2025

@abhi-airspace-intelligence - blocked the PR not b/c its a pre-requisite, just wanted to ask. If not feasible we can likely merge as is.

@ion-elgreco ion-elgreco merged commit a61ac16 into delta-io:main Oct 2, 2025
79 of 86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

binding/rust Issues for the Rust crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing SessionState into OptimizeBuilder

3 participants