From bc73f16b53ebd3bc9c8d41dd0a8d36869709b231 Mon Sep 17 00:00:00 2001 From: Vikram Kumar Date: Wed, 4 Feb 2026 16:50:21 +0530 Subject: [PATCH] Fix infinite recursion in Session impl for SessionState The Session trait implementation for SessionState accidentally called its own trait methods (e.g. self.session_id()), causing infinite recursion and stack overflow at runtime. This change fixes the issue by explicitly calling the corresponding inherent SessionState methods using fully qualified syntax. No behavior changes intended beyond removing the recursion bug. --- .../core/src/execution/session_state.rs | 34 +++++-------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index 9560616c1b6d..a03fe66da25b 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -232,18 +232,18 @@ impl Debug for SessionState { #[async_trait] impl Session for SessionState { fn session_id(&self) -> &str { - self.session_id() + SessionState::session_id(self) } fn config(&self) -> &SessionConfig { - self.config() + SessionState::config(self) } async fn create_physical_plan( &self, logical_plan: &LogicalPlan, ) -> datafusion_common::Result> { - self.create_physical_plan(logical_plan).await + SessionState::create_physical_plan(self, logical_plan).await } fn create_physical_expr( @@ -251,43 +251,27 @@ impl Session for SessionState { expr: Expr, df_schema: &DFSchema, ) -> datafusion_common::Result> { - self.create_physical_expr(expr, df_schema) - } - - fn scalar_functions(&self) -> &HashMap> { - &self.scalar_functions - } - - fn aggregate_functions(&self) -> &HashMap> { - &self.aggregate_functions - } - - fn window_functions(&self) -> &HashMap> { - &self.window_functions + SessionState::create_physical_expr(self, expr, df_schema) } fn runtime_env(&self) -> &Arc { - self.runtime_env() + SessionState::runtime_env(self) } fn execution_props(&self) -> &ExecutionProps { - self.execution_props() - } - - fn as_any(&self) -> &dyn Any { - self + SessionState::execution_props(self) } fn table_options(&self) -> &TableOptions { - self.table_options() + SessionState::table_options(self) } fn table_options_mut(&mut self) -> &mut TableOptions { - self.table_options_mut() + SessionState::table_options_mut(self) } fn task_ctx(&self) -> Arc { - self.task_ctx() + SessionState::task_ctx(self) } }