xiedeyantu commented on code in PR #21715:
URL: https://github.com/apache/datafusion/pull/21715#discussion_r3213225974


##########
datafusion/common/src/functional_dependencies.rs:
##########
@@ -196,15 +196,25 @@ impl FunctionalDependencies {
     }
 
     /// Creates a new `FunctionalDependencies` object from the given 
constraints.
+    ///
+    /// `nullable_flags` must contain one entry per field in the relation,
+    /// indicating whether that field is nullable.  A `UNIQUE` constraint whose
+    /// source columns include any nullable field is **not** a functional
+    /// dependency — because SQL treats `NULL` values as distinct, multiple 
rows
+    /// may carry `NULL` in a unique-key column without violating the 
constraint.
+    /// Such constraints are therefore omitted entirely.  When all source 
columns
+    /// are non-nullable a `UNIQUE` constraint is equivalent to a primary key 
and
+    /// is recorded with `nullable = false`.
     pub fn new_from_constraints(
         constraints: Option<&Constraints>,
-        n_field: usize,
+        nullable_flags: &[bool],
     ) -> Self {

Review Comment:
   Added!



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