Skip to content

Commit d9e963e

Browse files
authored
remove deprecated methods from FileScanConfig / DataSourceExec (#16901)
1 parent 07516aa commit d9e963e

File tree

3 files changed

+5
-156
lines changed

3 files changed

+5
-156
lines changed

datafusion/datasource-parquet/src/source.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ use object_store::ObjectStore;
169169
/// ```no_run
170170
/// # use std::sync::Arc;
171171
/// # use arrow::datatypes::Schema;
172-
/// # use datafusion_datasource::file_scan_config::FileScanConfig;
172+
/// # use datafusion_datasource::file_scan_config::{FileScanConfig, FileScanConfigBuilder};
173173
/// # use datafusion_datasource::PartitionedFile;
174174
/// # use datafusion_datasource::source::DataSourceExec;
175175
///
@@ -183,9 +183,9 @@ use object_store::ObjectStore;
183183
/// .iter()
184184
/// .map(|file_group| {
185185
/// // create a new exec by copying the existing exec's source config
186-
/// let new_config = base_config
187-
/// .clone()
188-
/// .with_file_groups(vec![file_group.clone()]);
186+
/// let new_config = FileScanConfigBuilder::from(base_config.clone())
187+
/// .with_file_groups(vec![file_group.clone()])
188+
/// .build();
189189
///
190190
/// (DataSourceExec::from_data_source(new_config))
191191
/// })

datafusion/datasource/src/file_scan_config.rs

Lines changed: 1 addition & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use log::{debug, warn};
7272
/// The base configurations for a [`DataSourceExec`], the a physical plan for
7373
/// any given file format.
7474
///
75-
/// Use [`Self::build`] to create a [`DataSourceExec`] from a ``FileScanConfig`.
75+
/// Use [`DataSourceExec::from_data_source`] to create a [`DataSourceExec`] from a ``FileScanConfig`.
7676
///
7777
/// # Example
7878
/// ```
@@ -669,65 +669,6 @@ impl DataSource for FileScanConfig {
669669
}
670670

671671
impl FileScanConfig {
672-
/// Create a new [`FileScanConfig`] with default settings for scanning files.
673-
///
674-
/// See example on [`FileScanConfig`]
675-
///
676-
/// No file groups are added by default. See [`Self::with_file`], [`Self::with_file_group`] and
677-
/// [`Self::with_file_groups`].
678-
///
679-
/// # Parameters:
680-
/// * `object_store_url`: See [`Self::object_store_url`]
681-
/// * `file_schema`: See [`Self::file_schema`]
682-
#[allow(deprecated)] // `new` will be removed same time as `with_source`
683-
pub fn new(
684-
object_store_url: ObjectStoreUrl,
685-
file_schema: SchemaRef,
686-
file_source: Arc<dyn FileSource>,
687-
) -> Self {
688-
let statistics = Statistics::new_unknown(&file_schema);
689-
let file_source = file_source
690-
.with_statistics(statistics.clone())
691-
.with_schema(Arc::clone(&file_schema));
692-
Self {
693-
object_store_url,
694-
file_schema,
695-
file_groups: vec![],
696-
constraints: Constraints::default(),
697-
projection: None,
698-
limit: None,
699-
table_partition_cols: vec![],
700-
output_ordering: vec![],
701-
file_compression_type: FileCompressionType::UNCOMPRESSED,
702-
new_lines_in_values: false,
703-
file_source: Arc::clone(&file_source),
704-
batch_size: None,
705-
expr_adapter_factory: None,
706-
}
707-
}
708-
709-
/// Set the file source
710-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
711-
pub fn with_source(mut self, file_source: Arc<dyn FileSource>) -> Self {
712-
self.file_source =
713-
file_source.with_statistics(Statistics::new_unknown(&self.file_schema));
714-
self
715-
}
716-
717-
/// Set the table constraints of the files
718-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
719-
pub fn with_constraints(mut self, constraints: Constraints) -> Self {
720-
self.constraints = constraints;
721-
self
722-
}
723-
724-
/// Set the statistics of the files
725-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
726-
pub fn with_statistics(mut self, statistics: Statistics) -> Self {
727-
self.file_source = self.file_source.with_statistics(statistics);
728-
self
729-
}
730-
731672
fn projection_indices(&self) -> Vec<usize> {
732673
match &self.projection {
733674
Some(proj) => proj.clone(),
@@ -788,88 +729,6 @@ impl FileScanConfig {
788729
self.constraints.project(&indexes).unwrap_or_default()
789730
}
790731

791-
/// Set the projection of the files
792-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
793-
pub fn with_projection(mut self, projection: Option<Vec<usize>>) -> Self {
794-
self.projection = projection;
795-
self
796-
}
797-
798-
/// Set the limit of the files
799-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
800-
pub fn with_limit(mut self, limit: Option<usize>) -> Self {
801-
self.limit = limit;
802-
self
803-
}
804-
805-
/// Add a file as a single group
806-
///
807-
/// See [Self::file_groups] for more information.
808-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
809-
#[allow(deprecated)]
810-
pub fn with_file(self, file: PartitionedFile) -> Self {
811-
self.with_file_group(FileGroup::new(vec![file]))
812-
}
813-
814-
/// Add the file groups
815-
///
816-
/// See [Self::file_groups] for more information.
817-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
818-
pub fn with_file_groups(mut self, mut file_groups: Vec<FileGroup>) -> Self {
819-
self.file_groups.append(&mut file_groups);
820-
self
821-
}
822-
823-
/// Add a new file group
824-
///
825-
/// See [Self::file_groups] for more information
826-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
827-
pub fn with_file_group(mut self, file_group: FileGroup) -> Self {
828-
self.file_groups.push(file_group);
829-
self
830-
}
831-
832-
/// Set the partitioning columns of the files
833-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
834-
pub fn with_table_partition_cols(mut self, table_partition_cols: Vec<Field>) -> Self {
835-
self.table_partition_cols = table_partition_cols
836-
.into_iter()
837-
.map(|f| Arc::new(f) as FieldRef)
838-
.collect();
839-
self
840-
}
841-
842-
/// Set the output ordering of the files
843-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
844-
pub fn with_output_ordering(mut self, output_ordering: Vec<LexOrdering>) -> Self {
845-
self.output_ordering = output_ordering;
846-
self
847-
}
848-
849-
/// Set the file compression type
850-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
851-
pub fn with_file_compression_type(
852-
mut self,
853-
file_compression_type: FileCompressionType,
854-
) -> Self {
855-
self.file_compression_type = file_compression_type;
856-
self
857-
}
858-
859-
/// Set the new_lines_in_values property
860-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
861-
pub fn with_newlines_in_values(mut self, new_lines_in_values: bool) -> Self {
862-
self.new_lines_in_values = new_lines_in_values;
863-
self
864-
}
865-
866-
/// Set the batch_size property
867-
#[deprecated(since = "47.0.0", note = "use FileScanConfigBuilder instead")]
868-
pub fn with_batch_size(mut self, batch_size: Option<usize>) -> Self {
869-
self.batch_size = batch_size;
870-
self
871-
}
872-
873732
/// Specifies whether newlines in (quoted) values are supported.
874733
///
875734
/// Parsing newlines in quoted values may be affected by execution behaviour such as
@@ -1099,12 +958,6 @@ impl FileScanConfig {
1099958
.collect())
1100959
}
1101960

1102-
/// Returns a new [`DataSourceExec`] to scan the files specified by this config
1103-
#[deprecated(since = "47.0.0", note = "use DataSourceExec::new instead")]
1104-
pub fn build(self) -> Arc<DataSourceExec> {
1105-
DataSourceExec::from_data_source(self)
1106-
}
1107-
1108961
/// Write the data_type based on file_source
1109962
fn fmt_file_source(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
1110963
write!(f, ", file_type={}", self.file_source.file_type())?;

datafusion/datasource/src/source.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,6 @@ impl ExecutionPlan for DataSourceExec {
287287
Some(self.data_source.metrics().clone_inner())
288288
}
289289

290-
fn statistics(&self) -> Result<Statistics> {
291-
self.data_source.statistics()
292-
}
293-
294290
fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics> {
295291
if let Some(partition) = partition {
296292
let mut statistics = Statistics::new_unknown(&self.schema());

0 commit comments

Comments
 (0)