You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[datafusion-spark] Add method to register udf and expr planner in one go #19843
Is your feature request related to a problem or challenge?
The SparkFunctionPlanner was introduced recently, but there is currently no convenient way to register both the Spark UDFs and the Spark expression planner together.
Additionally, combining the default DataFusion features with Spark features is awkward because:
Expression planners must be registered before calling with_default_features().build() to take precedence (planners are tried in order, first match wins)
UDFs must be registered after the state is built (if using the register_all helper)
Here's the current code required in sqllogictests to properly register Spark features:
let runtime = Arc::new(RuntimeEnv::default());letmut state_builder = SessionStateBuilder::new().with_config(config).with_runtime_env(runtime);// Phase 1: Register planner BEFORE build (so it takes precedence)ifis_spark_path(relative_path){
state_builder = state_builder.with_expr_planners(vec![Arc::new(
datafusion_spark::planner::SparkFunctionPlanner,)]);}letmut state = state_builder.with_default_features().build();// Phase 2: Register UDFs AFTER buildifis_spark_path(relative_path){info!("Registering Spark functions");
datafusion_spark::register_all(&mut state).expect("Can not register Spark functions");}
Describe the solution you'd like
Provide a with_spark_features() method on SessionStateBuilder that registers both the Spark expression planner and UDFs in one call, ensuring proper precedence.
let state = SessionStateBuilder::new()
.with_config(config)
.with_runtime_env(runtime)
.with_default_features()
.with_spark_features() // Registers planner (with precedence) + UDFs
.build();
Describe alternatives you've considered
A standalone function datafusion_spark::register_all_features(&mut SessionState) that handles both planner and UDF registration post-build (though this may not solve the planner precedence issue cleanly)
Expose planner priority control - Allow specifying priority when registering planners, rather than relying on insertion order
@GaneshPatil7517 please be considerate of others who have volunteered to take the issue (even if for some reason the action didn't work). In this case @cht42 seems to already intend to take on this issue.
Activity
cht42 commentedon Jan 16, 2026
take
GaneshPatil7517 commentedon Jan 16, 2026
take
Jefffrey commentedon Jan 16, 2026
@GaneshPatil7517 please be considerate of others who have volunteered to take the issue (even if for some reason the action didn't work). In this case @cht42 seems to already intend to take on this issue.
GaneshPatil7517 commentedon Jan 16, 2026
ok no problem..
feat(spark): Add `SessionStateBuilderSpark` to datafusion-spark (#19865)
feat(spark): Add `SessionStateBuilderSpark` to datafusion-spark (apac…