Apache DataFusion SQL Query Engine
Remove `scan_parquet` methods from `LogicalPlanBuilder` (#2539)
Andy Grove419addef30c4
diff --git a/datafusion/core/src/execution/context.rs b/datafusion/core/src/execution/context.rsindex 7ca9a1e4d0..c18c49eb86 100644--- a/datafusion/core/src/execution/context.rs+++ b/datafusion/core/src/execution/context.rs@@ -581,16 +581,21 @@ impl SessionContext {let uri: String = uri.into();let (object_store, path) = self.runtime_env().object_store(&uri)?;let target_partitions = self.copied_config().target_partitions;- let logical_plan = LogicalPlanBuilder::scan_parquet(- object_store,- path,- options,- None,- target_partitions,- )- .await?- .build()?;- Ok(Arc::new(DataFrame::new(self.state.clone(), &logical_plan)))++ let listing_options = options.to_listing_options(target_partitions);+ let path: String = path.into();++ // with parquet we resolve the schema in all cases+ let resolved_schema = listing_options+ .infer_schema(Arc::clone(&object_store), &path)+ .await?;++ let config = ListingTableConfig::new(object_store, path)+ .with_listing_options(listing_options)+ .with_schema(resolved_schema);++ let provider = ListingTable::try_new(config)?;+ self.read_table(Arc::new(provider))}/// Creates a DataFrame for reading a custom TableProvider.diff --git a/datafusion/core/src/logical_plan/builder.rs b/datafusion/core/src/logical_plan/builder.rsindex 69dbde693e..c35b522e6e 100644--- a/datafusion/core/src/logical_plan/builder.rs+++ b/datafusion/core/src/logical_plan/builder.rs@@ -256,51 +256,6 @@ impl LogicalPlanBuilder {Self::scan(table_name, Arc::new(provider), projection)}- /// Scan a Parquet data source- pub async fn scan_parquet(- object_store: Arc<dyn ObjectStore>,- path: impl Into<String>,- options: ParquetReadOptions<'_>,- projection: Option<Vec<usize>>,- target_partitions: usize,- ) -> Result<Self> {- let path = path.into();- Self::scan_parquet_with_name(- object_store,- path.clone(),- options,- projection,- target_partitions,- path,- )- .await- }-- /// Scan a Parquet data source and register it with a given table name- pub async fn scan_parquet_with_name(- object_store: Arc<dyn ObjectStore>,- path: impl Into<String>,- options: ParquetReadOptions<'_>,- projection: Option<Vec<usize>>,- target_partitions: usize,- table_name: impl Into<String>,- ) -> Result<Self> {- let listing_options = options.to_listing_options(target_partitions);- let path: String = path.into();-- // with parquet we resolve the schema in all cases- let resolved_schema = listing_options- .infer_schema(Arc::clone(&object_store), &path)- .await?;-- let config = ListingTableConfig::new(object_store, path)- .with_listing_options(listing_options)- .with_schema(resolved_schema);-- let provider = ListingTable::try_new(config)?;- Self::scan(table_name, Arc::new(provider), projection)- }-/// Scan an Avro data sourcepub async fn scan_avro(object_store: Arc<dyn ObjectStore>,