jonahgao commented on code in PR #15120:
URL: https://github.com/apache/datafusion/pull/15120#discussion_r1989378352


##########
datafusion/expr/src/expr_schema.rs:
##########
@@ -343,7 +343,17 @@ impl ExprSchemable for Expr {
     fn metadata(&self, schema: &dyn ExprSchema) -> Result<HashMap<String, 
String>> {
         match self {
             Expr::Column(c) => Ok(schema.metadata(c)?.clone()),
-            Expr::Alias(Alias { expr, .. }) => expr.metadata(schema),
+            Expr::Alias(Alias { expr, metadata, .. }) => {
+                let ret = expr.metadata(schema)?;
+                if let Some(metadata) = metadata {
+                    if !metadata.is_empty() {
+                        let mut ret = ret.clone();

Review Comment:
   I think this clone is unnecessary.
   ```rust
                   let mut ret = expr.metadata(schema)?;
                   if let Some(metadata) = metadata {
                       if !metadata.is_empty() {
                           ret.extend(metadata.clone());
                           return Ok(ret);
                       }
                   }
   ```



-- 
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

Reply via email to