gokselk commented on code in PR #14111: URL: https://github.com/apache/datafusion/pull/14111#discussion_r1916731975
########## datafusion/core/src/datasource/physical_plan/file_scan_config.rs: ########## @@ -210,30 +221,25 @@ impl FileScanConfig { self } - /// Project the schema and the statistics on the given column indices - pub fn project(&self) -> (SchemaRef, Statistics, Vec<LexOrdering>) { + /// Project the schema, constraints, and the statistics on the given column indices + pub fn project(&self) -> Self { if self.projection.is_none() && self.table_partition_cols.is_empty() { - return ( - Arc::clone(&self.file_schema), - self.statistics.clone(), - self.output_ordering.clone(), - ); + return self.clone(); } - let proj_iter: Box<dyn Iterator<Item = usize>> = match &self.projection { - Some(proj) => Box::new(proj.iter().copied()), - None => Box::new( - 0..(self.file_schema.fields().len() + self.table_partition_cols.len()), - ), - }; + // Get projection indices once, reuse for both schema and constraints + let proj_indices = self.projection.clone().unwrap_or_else(|| { + (0..(self.file_schema.fields().len() + self.table_partition_cols.len())) + .collect::<Vec<_>>() + }); Review Comment: Resolved in ab93279. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org