Skip to content

Conversation

@gabotechs
Copy link
Collaborator

@gabotechs gabotechs commented Aug 21, 2025

This PR redesigns the SessionBuilder interface into a more simple one: the DistributedSesssionBuilder, with just 1 method instead of 3.

Now building a Session for an ArrowFlightEndpoint is driven completely by the user, and they can either implement the trait themselves:

#[async_trait]
impl DistributedSessionBuilder for MySessionBuilder {
    async fn build_session_state(
        &self,
        ctx: DistributedSessionBuilderContext,
    ) -> Result<SessionState, DataFusionError> {
        Ok(SessionStateBuilder::new()
            .with_runtime_env(ctx.runtime_env.clone())
            .with_default_features()
            .build())
    }
}

or just the function shorthand

// Any function with this signature automatically implements the `DistributedSessionBuilder` trait
fn build_state(ctx: DistributedSessionBuilderContext) -> Result<SessionState, DataFusionError> {
    Ok(SessionStateBuilder::new()
        .with_runtime_env(ctx.runtime_env.clone())
        .with_default_features()
        .build())
}

This PR also addresses the clippy errors failing in the pipelines

@gabotechs gabotechs changed the title Ergonomy improvements Improve SessionBuilder ergonomy and fix clippy errors Aug 21, 2025
Base automatically changed from gabrielmusat/propagate-config-extensions to main August 21, 2025 12:49
# Conflicts:
#	src/config_extension_ext.rs
#	src/flight_service/do_get.rs
#	src/lib.rs
#	tests/custom_config_extension.rs
@gabotechs gabotechs marked this pull request as ready for review August 21, 2025 13:29
# Conflicts:
#	src/common/ttl_map.rs
#	tests/tpch_validation_test.rs
@robtandy
Copy link
Collaborator

This looks great! I'm glad to see ergonomic improvements in the user facing API. This is a clear step forward.

@gabotechs gabotechs merged commit f8bb759 into main Aug 21, 2025
3 checks passed
@gabotechs gabotechs deleted the gabrielmusat/ergonomy-improvements branch August 21, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants