Omega359 commented on code in PR #14684: URL: https://github.com/apache/datafusion/pull/14684#discussion_r2110126162
########## datafusion/core/src/dataframe/mod.rs: ########## @@ -1972,41 +1972,85 @@ impl DataFrame { .config_options() .sql_parser .enable_ident_normalization; + let old_column: Column = if ident_opts { Column::from_qualified_name(old_name) } else { Column::from_qualified_name_ignore_case(old_name) }; - let (qualifier_rename, field_rename) = - match self.plan.schema().qualified_field_from_column(&old_column) { - Ok(qualifier_and_field) => qualifier_and_field, - // no-op if field not found - Err(DataFusionError::SchemaError( - SchemaError::FieldNotFound { .. }, - _, - )) => return Ok(self), - Err(err) => return Err(err), - }; - let projection = self - .plan - .schema() - .iter() - .map(|(qualifier, field)| { - if qualifier.eq(&qualifier_rename) && field.as_ref() == field_rename { - ( - col(Column::from((qualifier, field))) - .alias_qualified(qualifier.cloned(), new_name), - false, - ) - } else { - (col(Column::from((qualifier, field))), false) - } - }) - .collect::<Vec<_>>(); - let project_plan = LogicalPlanBuilder::from(self.plan) - .project_with_validation(projection)? - .build()?; + let project_plan = if let LogicalPlan::Projection(Projection { Review Comment: I think it may have been related to trying to improve planning performance by reducing the number of projections up front so planning doesn't need to do it. Improving the logical plan output is definitely nice though :) -- 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