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

Function create_plan

datafusion-cli/src/exec.rs:411–447  ·  view source on GitHub ↗
(
    ctx: &dyn CliSessionContext,
    statement: Statement,
    resolve_region: bool,
)

Source from the content-addressed store, hash-verified

409}
410
411async 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(&copy_to.file_type.get_ext());
436
437 register_object_store_and_config_extensions(
438 ctx,
439 &copy_to.output_url,
440 &copy_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.

Calls 5

statement_to_planMethod · 0.45
session_stateMethod · 0.45
get_extMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…