ratmice commented on code in PR #23466:
URL: https://github.com/apache/datafusion/pull/23466#discussion_r3562100544
##########
datafusion-cli/src/entry_point.rs:
##########
@@ -229,8 +282,50 @@ pub async fn main_inner() -> Result<()> {
let runtime_env = rt_builder.build_arc()?;
// enable dynamic file query
- let ctx = SessionContext::new_with_config_rt(session_config, runtime_env)
- .enable_url_table();
+ let ctx = if let Some(session_state) = self.session_state {
+ SessionStateBuilder::new_from_existing(session_state)
+ .with_config(session_config)
+ .with_runtime_env(runtime_env)
+ .build()
+ .into()
+ } else {
+ SessionContext::new_with_config_rt(session_config, runtime_env)
+ }
+ .enable_url_table();
+
+ let print_options = PrintOptions {
+ format: args.format,
+ quiet: args.quiet,
+ maxrows: args.maxrows,
+ color: args.color,
+ instrumented_registry: Arc::clone(&instrumented_registry),
+ };
+ Ok(CliSession {
+ ctx,
+ args,
+ print_options,
+ })
+}
+}
+
+impl CliSession {
+ pub fn builder() -> CliSessionBuilder {
+ CliSessionBuilder::default()
+ }
+ pub async fn entry_point() -> Result<(), CliError> {
Review Comment:
Perhaps some bikeshedding here...
I'm not totally enamored with the name, but it seemed descriptive,
we could I guess impl default and use `CliSession::default().run().await?`
instead
of having this `entry_point` function I suppose.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]