-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b333d4b
commit e321bd5
Showing
4 changed files
with
28 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
use datafusion::{execution::SessionState, logical_expr::TableSource}; | ||
use std::fmt::Debug; | ||
use std::{collections::HashMap, sync::Arc}; | ||
|
||
pub mod from_optd; | ||
pub mod into_optd; | ||
|
||
/// A context for converting between optd and datafusion. | ||
/// The map is used to lookup table sources when converting TableScan operators from optd to datafusion. | ||
pub(crate) struct OptdDataFusionContext<'a> { | ||
/// The map is used to lookup table sources when converting TableScan operators from optd to | ||
/// datafusion. | ||
pub(crate) struct OptdContext { | ||
/// Maps table names to table sources. | ||
pub tables: HashMap<String, Arc<dyn TableSource>>, | ||
tables: HashMap<String, Arc<dyn TableSource>>, | ||
/// DataFusion session state. | ||
pub session_state: &'a SessionState, | ||
session_state: SessionState, | ||
} | ||
|
||
impl OptdDataFusionContext<'_> { | ||
impl OptdContext { | ||
/// Creates a new empty `OptdDataFusionContext` with the provided session state. | ||
pub(crate) fn new(session_state: &SessionState) -> OptdDataFusionContext { | ||
OptdDataFusionContext { | ||
pub(crate) fn new(session_state: &SessionState) -> OptdContext { | ||
OptdContext { | ||
tables: HashMap::new(), | ||
session_state, | ||
session_state: session_state.clone(), | ||
} | ||
} | ||
} | ||
|
||
impl Debug for OptdContext { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.debug_struct("OptdContext") | ||
.field("tables", &self.tables.keys()) | ||
.field("session_state", &self.session_state) | ||
.finish() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters