-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor: Move TableProviderFactories up out of RuntimeEnv
and into SessionState
#5477
Conversation
@@ -278,6 +282,15 @@ impl SessionContext { | |||
self.session_id.clone() | |||
} | |||
|
|||
/// Return the [`TableFactoryProvider`] that is registered for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Return the [`TableFactoryProvider`] that is registered for the | |
/// Return the [`TableProviderFactory`] that is registered for the |
|
||
use crate::datasource::datasource::TableProviderFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point of the PR is to remove the datasource
dependency from the runtime_env
module (as I am trying to move the runtime_env
module into a new crate, datafusion-execution
, that does not depend on datasource
)
I plan to move object_store registry in a separate PR to keep the reviews smaller
} | ||
|
||
impl RuntimeConfig { | ||
/// New with default values | ||
pub fn new() -> Self { | ||
let mut table_factories: HashMap<String, Arc<dyn TableProviderFactory>> = | ||
HashMap::new(); | ||
table_factories.insert("PARQUET".into(), Arc::new(ListingTableFactory::new())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this construction now happens as part of creating SessionState
let env = RuntimeEnv::new(cfg).unwrap(); | ||
let ses = SessionConfig::new(); | ||
let ctx = SessionContext::with_config_rt(ses, Arc::new(env)); | ||
let mut state = SessionState::with_config_rt(ses, Arc::new(env)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the new pattern of how to add a table provider factory
RuntimeEnv
and into SessionState
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems okay...
Thank you for the review @avantgardnerio |
Which issue does this PR close?
Part of #1754
Rationale for this change
I am trying to extract the physical_plan code into its own crate; and to do so I need to remove the circular dependencies between core --> datasource --> execution --> datasource
Table factories are used for planning, not for execution, but RuntimeEnv is used for execution (and I am trying to move it into the
datafusion_execution
crate)See more details in #1754 (comment)
What changes are included in this PR?
Are these changes tested?
Covered by existing tests (and the test changes illustrate what happened to the API). I believe this will affect Ballista (@avantgardnerio ) and delta-rs (cc @roeap )
Are there any user-facing changes?
Users who are specifying custom TableFactoryProviders have a slightly different API to register them.