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

Method create_and_execute_logical_plan

datafusion-cli/src/exec.rs:324–353  ·  view source on GitHub ↗
(
        mut self,
        ctx: &dyn CliSessionContext,
        print_options: &PrintOptions,
    )

Source from the content-addressed store, hash-verified

322 }
323
324 async fn create_and_execute_logical_plan(
325 mut self,
326 ctx: &dyn CliSessionContext,
327 print_options: &PrintOptions,
328 ) -> Result<(datafusion::dataframe::DataFrame, AdjustedPrintOptions)> {
329 let adjusted = AdjustedPrintOptions::new(print_options.clone())
330 .with_statement(&self.statement);
331
332 let plan = create_plan(ctx, self.statement, false).await?;
333 let adjusted = adjusted.with_plan(&plan);
334
335 let df = match ctx.execute_logical_plan(plan).await {
336 Ok(df) => Ok(df),
337 Err(DataFusionError::ObjectStore(err))
338 if matches!(err.as_ref(), Generic { store, source: _ } if "S3".eq_ignore_ascii_case(store))
339 && self.statement_for_retry.is_some() =>
340 {
341 warn!(
342 "S3 region is incorrect, auto-detecting the correct region (this may be slow). Consider updating your region configuration."
343 );
344 let plan =
345 create_plan(ctx, self.statement_for_retry.take().unwrap(), true)
346 .await?;
347 ctx.execute_logical_plan(plan).await
348 }
349 Err(e) => Err(e),
350 }?;
351
352 Ok((df, adjusted))
353 }
354}
355
356/// Track adjustments to the print options based on the plan / statement being executed

Callers 1

executeMethod · 0.80

Calls 7

newFunction · 0.85
with_statementMethod · 0.80
create_planFunction · 0.70
cloneMethod · 0.45
with_planMethod · 0.45
execute_logical_planMethod · 0.45
takeMethod · 0.45

Tested by

no test coverage detected