Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add method SessionStateBuilder::new_with_default_features() #14998

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shruti2522
Copy link

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

added method new_with_defaults to StreamStateBuilder

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Mar 4, 2025
@berkaysynnada
Copy link
Contributor

Why don't we just implement Default trait?

@alamb
Copy link
Contributor

alamb commented Mar 4, 2025

Why don't we just implement Default trait?

There is some more backstory here:

Basically the question is what "defaults" means -- is default an empty builder or does it have all the default functions, etc.

An alternate design might be to always create SessionStateBuilder with all default functions and have a clear() method or something to reset the state.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @shruti2522 -- this looks great. I think we just need to improve the name and it will be good to go (assuming it is ok with @berkaysynnada and other reviewers)

Could you also add a comment to SessionStateBuilder::new() here:

/// Returns a new empty [`SessionStateBuilder`].
///
/// See [`Self::with_default_features`] to install the default set of functions,
/// catalogs, etc.

Something like "to create a SessionStateBuilder with default features such as functions please see [SessionStateBuilder::new_with_default_features}

/// .with_session_id("my_session".to_string())
/// .build();
/// ```
pub fn new_with_defaults() -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

To keep the name consistent (and make it harder to confuse this with default()) could we please name this default_features? Like:

Suggested change
pub fn new_with_defaults() -> Self {
pub fn new_with_default_features() -> Self {

Copy link
Author

Choose a reason for hiding this comment

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

done @alamb

@shruti2522 shruti2522 changed the title add method SessionStateBuilder::new_with_defaults() add method SessionStateBuilder::new_with_default_features() Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add method to SessionStateBuilder that has all the defaut features
3 participants