From 9cf71b13053d9269f77e3da0636b1f473a195630 Mon Sep 17 00:00:00 2001 From: osipovartem Date: Thu, 30 Jan 2025 01:30:09 +0300 Subject: [PATCH 1/2] Make conext public --- datafusion/core/src/execution/session_state.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index 19d0fae207be..011d175552a7 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -572,7 +572,7 @@ impl SessionState { query.statement_to_plan(statement) } - fn get_parser_options(&self) -> ParserOptions { + pub fn get_parser_options(&self) -> ParserOptions { let sql_parser_options = &self.config.options().sql_parser; ParserOptions { @@ -1657,9 +1657,9 @@ impl From for SessionStateBuilder { /// /// This is used so the SQL planner can access the state of the session without /// having a direct dependency on the [`SessionState`] struct (and core crate) -struct SessionContextProvider<'a> { - state: &'a SessionState, - tables: HashMap>, +pub struct SessionContextProvider<'a> { + pub state: &'a SessionState, + pub tables: HashMap>, } impl ContextProvider for SessionContextProvider<'_> { From 91622dd30defa99881963b6532a8f9507b4d5580 Mon Sep 17 00:00:00 2001 From: osipovartem Date: Thu, 30 Jan 2025 08:56:18 +0300 Subject: [PATCH 2/2] Fix clippy --- datafusion/core/src/execution/session_state.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/datafusion/core/src/execution/session_state.rs b/datafusion/core/src/execution/session_state.rs index 011d175552a7..f9ec4ea25ba1 100644 --- a/datafusion/core/src/execution/session_state.rs +++ b/datafusion/core/src/execution/session_state.rs @@ -572,6 +572,7 @@ impl SessionState { query.statement_to_plan(statement) } + /// Get the parser options pub fn get_parser_options(&self) -> ParserOptions { let sql_parser_options = &self.config.options().sql_parser; @@ -1658,7 +1659,9 @@ impl From for SessionStateBuilder { /// This is used so the SQL planner can access the state of the session without /// having a direct dependency on the [`SessionState`] struct (and core crate) pub struct SessionContextProvider<'a> { + /// The session state pub state: &'a SessionState, + /// The tables available in the session pub tables: HashMap>, }