Skip to content

Commit 3e08664

Browse files
authored
Aovid computing unnecessary statstics (#15729)
1 parent 42a45d1 commit 3e08664

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

datafusion/datasource/src/file_scan_config.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ impl DataSource for FileScanConfig {
474474
fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
475475
match t {
476476
DisplayFormatType::Default | DisplayFormatType::Verbose => {
477-
let (schema, _, _, orderings) = self.project();
477+
let schema = self.projected_schema();
478+
let orderings = get_projected_output_ordering(self, &schema);
478479

479480
write!(f, "file_groups=")?;
480481
FileGroupsDisplay(&self.file_groups).fmt_as(t, f)?;
@@ -1051,7 +1052,8 @@ impl Debug for FileScanConfig {
10511052

10521053
impl DisplayAs for FileScanConfig {
10531054
fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter) -> FmtResult {
1054-
let (schema, _, _, orderings) = self.project();
1055+
let schema = self.projected_schema();
1056+
let orderings = get_projected_output_ordering(self, &schema);
10551057

10561058
write!(f, "file_groups=")?;
10571059
FileGroupsDisplay(&self.file_groups).fmt_as(t, f)?;
@@ -1564,7 +1566,7 @@ mod tests {
15641566
);
15651567

15661568
// verify the proj_schema includes the last column and exactly the same the field it is defined
1567-
let (proj_schema, _, _, _) = conf.project();
1569+
let proj_schema = conf.projected_schema();
15681570
assert_eq!(proj_schema.fields().len(), file_schema.fields().len() + 1);
15691571
assert_eq!(
15701572
*proj_schema.field(file_schema.fields().len()),
@@ -1670,7 +1672,7 @@ mod tests {
16701672
assert_eq!(source_statistics, statistics);
16711673
assert_eq!(source_statistics.column_statistics.len(), 3);
16721674

1673-
let (proj_schema, ..) = conf.project();
1675+
let proj_schema = conf.projected_schema();
16741676
// created a projector for that projected schema
16751677
let mut proj = PartitionColumnProjector::new(
16761678
proj_schema,

datafusion/datasource/src/file_stream.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl FileStream {
7878
file_opener: Arc<dyn FileOpener>,
7979
metrics: &ExecutionPlanMetricsSet,
8080
) -> Result<Self> {
81-
let (projected_schema, ..) = config.project();
81+
let projected_schema = config.projected_schema();
8282
let pc_projector = PartitionColumnProjector::new(
8383
Arc::clone(&projected_schema),
8484
&config

0 commit comments

Comments
 (0)