(
&self,
state: &dyn Session,
conf: FileScanConfig,
)
| 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, |
nothing calls this directly
no test coverage detected