alamb commented on code in PR #12979:
URL: https://github.com/apache/datafusion/pull/12979#discussion_r1806919102


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1402,7 +1402,12 @@ pub fn validate_unique_names<'a>(
 pub fn union(left_plan: LogicalPlan, right_plan: LogicalPlan) -> 
Result<LogicalPlan> {
     // Temporarily use the schema from the left input and later rely on the 
analyzer to
     // coerce the two schemas into a common one.
-    let schema = Arc::clone(left_plan.schema());
+
+    // Functional Dependencies doesn't preserve after UNION operation
+    let schema = (**left_plan.schema()).clone();
+    let schema =
+        
Arc::new(schema.with_functional_dependencies(FunctionalDependencies::empty())?);
+

Review Comment:
   I'll wait to merge this PR until tomorrow to give @Sevenannn  a chance to 
respond



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

Reply via email to