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

Method create_physical_plan

datafusion/datasource-arrow/src/file_format.rs:184–225  ·  view source on GitHub ↗
(
        &self,
        state: &dyn Session,
        conf: FileScanConfig,
    )

Source from the content-addressed store, hash-verified

182 }
183
184 async fn create_physical_plan(
185 &self,
186 state: &dyn Session,
187 conf: FileScanConfig,
188 ) -> Result<Arc<dyn ExecutionPlan>> {
189 let object_store = state.runtime_env().object_store(&conf.object_store_url)?;
190 let object_location = &conf
191 .file_groups
192 .first()
193 .ok_or_else(|| internal_datafusion_err!("No files found in file group"))?
194 .files()
195 .first()
196 .ok_or_else(|| internal_datafusion_err!("No files found in file group"))?
197 .object_meta
198 .location;
199
200 let table_schema = TableSchema::new(
201 Arc::clone(conf.file_schema()),
202 conf.table_partition_cols().clone(),
203 );
204
205 let mut source: Arc<dyn FileSource> =
206 match is_object_in_arrow_ipc_file_format(object_store, object_location).await
207 {
208 Ok(true) => Arc::new(ArrowSource::new_file_source(table_schema)),
209 Ok(false) => Arc::new(ArrowSource::new_stream_file_source(table_schema)),
210 Err(e) => Err(e)?,
211 };
212
213 // Preserve projection from the original file source
214 if let Some(projection) = conf.file_source.projection()
215 && let Some(new_source) = source.try_pushdown_projection(projection)?
216 {
217 source = new_source;
218 }
219
220 let config = FileScanConfigBuilder::from(conf)
221 .with_source(source)
222 .build();
223
224 Ok(DataSourceExec::from_data_source(config))
225 }
226
227 async fn create_writer_physical_plan(
228 &self,

Callers

nothing calls this directly

Calls 13

newFunction · 0.85
filesMethod · 0.80
with_sourceMethod · 0.80
object_storeMethod · 0.45
runtime_envMethod · 0.45
firstMethod · 0.45
file_schemaMethod · 0.45
cloneMethod · 0.45
table_partition_colsMethod · 0.45
projectionMethod · 0.45

Tested by

no test coverage detected