wudidapaopao commented on code in PR #25990:
URL: https://github.com/apache/datafusion/pull/25990#discussion_r4406246248
##########
datafusion/optimizer/src/single_distinct_to_groupby.rs:
##########
@@ -104,6 +104,32 @@ struct CountRollup {
sum: Arc<AggregateUDF>,
}
+fn unalias_top(mut expr: &Expr) -> &Expr {
+ while let Expr::Alias(alias) = expr
+ && alias
+ .metadata
+ .as_ref()
+ .is_none_or(|metadata| metadata.is_empty())
+ {
+ expr = &alias.expr;
+ }
+ expr
+}
+
+fn into_unaliased_top(expr: Expr) -> Expr {
Review Comment:
Added a test for this, the plan stays unchanged and the metadata is kept.
--
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]