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


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -2843,13 +2845,21 @@ impl Union {
                     )?
                 };
                 let nullable = fields.iter().any(|field| field.is_nullable());
-                let mut field = Field::new(name, data_type.clone(), nullable);
+
+                // Generate unique field name
+                let name = if let Some(count) = 
name_counts.get_mut(&base_name) {
+                    *count += 1;

Review Comment:
   It seems like `TypeCoercion` undoes the renaming efforts here.
   Maybe `TypeCoercion` should only modify the data types of union inputs, 
rather than field names 🤔



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