gokselk commented on code in PR #14111:
URL: https://github.com/apache/datafusion/pull/14111#discussion_r1916592153


##########
datafusion/common/src/functional_dependencies.rs:
##########
@@ -60,6 +60,41 @@ impl Constraints {
     pub fn is_empty(&self) -> bool {
         self.inner.is_empty()
     }
+
+    /// Projects constraints using the given projection indices.
+    /// Returns None if any of the constraint columns are not included in the 
projection.
+    pub fn project(&self, proj_indices: &[usize]) -> Option<Self> {
+        let projected = self
+            .inner
+            .iter()
+            .filter_map(|constraint| {
+                match constraint {
+                    Constraint::PrimaryKey(indices) => {
+                        let new_indices =
+                            update_elements_with_matching_indices(indices, 
proj_indices);

Review Comment:
   The `update_elements_with_matching_indices` function uses `.position()` on 
`proj_indices`, which makes it necessary to clone it if we take it as an `impl 
Iterator`. I think this defeats the whole purpose of this refactoring.



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