(
ctx: &dyn CliSessionContext,
statement: Statement,
resolve_region: bool,
)
| 409 | } |
| 410 | |
| 411 | async fn create_plan( |
| 412 | ctx: &dyn CliSessionContext, |
| 413 | statement: Statement, |
| 414 | resolve_region: bool, |
| 415 | ) -> Result<LogicalPlan, DataFusionError> { |
| 416 | let mut plan = ctx.session_state().statement_to_plan(statement).await?; |
| 417 | |
| 418 | // Note that cmd is a mutable reference so that create_external_table function can remove all |
| 419 | // datafusion-cli specific options before passing through to datafusion. Otherwise, datafusion |
| 420 | // will raise Configuration errors. |
| 421 | if let LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) = &plan { |
| 422 | // To support custom formats, treat error as None |
| 423 | let format = config_file_type_from_str(&cmd.file_type); |
| 424 | register_object_store_and_config_extensions( |
| 425 | ctx, |
| 426 | &cmd.location, |
| 427 | &cmd.options, |
| 428 | format, |
| 429 | resolve_region, |
| 430 | ) |
| 431 | .await?; |
| 432 | } |
| 433 | |
| 434 | if let LogicalPlan::Copy(copy_to) = &mut plan { |
| 435 | let format = config_file_type_from_str(©_to.file_type.get_ext()); |
| 436 | |
| 437 | register_object_store_and_config_extensions( |
| 438 | ctx, |
| 439 | ©_to.output_url, |
| 440 | ©_to.options, |
| 441 | format, |
| 442 | false, |
| 443 | ) |
| 444 | .await?; |
| 445 | } |
| 446 | Ok(plan) |
| 447 | } |
| 448 | |
| 449 | /// Asynchronously registers an object store and its configuration extensions |
| 450 | /// to the session context. |
no test coverage detected
searching dependent graphs…