Get the session configuration based on the provided arguments and environment settings.
(args: &Args)
| 309 | /// Get the session configuration based on the provided arguments |
| 310 | /// and environment settings. |
| 311 | fn 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 | |
| 338 | fn parse_valid_file(dir: &str) -> Result<String, String> { |
| 339 | if Path::new(dir).is_file() { |
no test coverage detected
searching dependent graphs…