MCPcopy Create free account
hub / github.com/apache/datafusion / get_session_config

Function get_session_config

datafusion-cli/src/main.rs:311–336  ·  view source on GitHub ↗

Get the session configuration based on the provided arguments and environment settings.

(args: &Args)

Source from the content-addressed store, hash-verified

309/// Get the session configuration based on the provided arguments
310/// and environment settings.
311fn get_session_config(args: &Args) -> Result<SessionConfig> {
312 // Read options from environment variables and merge with command line options
313 let mut config_options = ConfigOptions::from_env()?;
314
315 if let Some(batch_size) = args.batch_size {
316 if batch_size == 0 {
317 return config_err!("batch_size must be greater than 0");
318 }
319 config_options.execution.batch_size = batch_size;
320 };
321
322 // use easier to understand "tree" mode by default
323 // if the user hasn't specified an explain format in the environment
324 if env::var_os("DATAFUSION_EXPLAIN_FORMAT").is_none() {
325 config_options.explain.format = ExplainFormat::Tree;
326 }
327
328 // in the CLI, we want to show NULL values rather the empty strings
329 if env::var_os("DATAFUSION_FORMAT_NULL").is_none() {
330 config_options.format.null = String::from("NULL");
331 }
332
333 let session_config =
334 SessionConfig::from(config_options).with_information_schema(true);
335 Ok(session_config)
336}
337
338fn parse_valid_file(dir: &str) -> Result<String, String> {
339 if Path::new(dir).is_file() {

Callers 1

main_innerFunction · 0.85

Calls 3

from_envFunction · 0.85
is_noneMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…