gabotechs commented on code in PR #24670:
URL: https://github.com/apache/datafusion/pull/24670#discussion_r3853980928
##########
datafusion/physical-plan/src/projection.rs:
##########
@@ -1030,7 +1030,8 @@ pub fn remove_unnecessary_projections(
}
/// Compare the inputs and outputs of the projection. All expressions must be
-/// columns without alias, and projection does not change the order of fields.
+/// columns without alias, the projection must not change the order of fields,
+/// and its output schema must match its input schema, including metadata.
Review Comment:
🤔 Why can't it change the order of fields? As long as the name is the same
one, that's what matters AFAIK.
##########
datafusion/physical-plan/src/projection.rs:
##########
@@ -1041,6 +1042,7 @@ fn is_projection_removable(projection: &ProjectionExec)
-> bool {
};
col.name() == proj_expr.alias && col.index() == idx
}) && exprs.len() == projection.input().schema().fields().len()
+ && projection.schema() == projection.input().schema()
Review Comment:
This might be putting more restrictions than just metadata equality. It
might be fine, but if we want to play it safe it could be better to just do `&&
projection.schema().metadata() == projection.input().schema().metadata()`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]