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


##########
datafusion/optimizer/src/replace_distinct_aggregate.rs:
##########
@@ -82,10 +82,11 @@ impl OptimizerRule for ReplaceDistinctWithAggregate {
                 for dep in input.schema().functional_dependencies().iter() {
                     // If distinct is exactly the same with a previous GROUP 
BY, we can
                     // simply remove it:
-                    if dep.source_indices[..field_count]
-                        .iter()
-                        .enumerate()
-                        .all(|(idx, f_idx)| idx == *f_idx)
+                    if dep.source_indices.len() >= field_count

Review Comment:
   is this change required for the test to pass? Or is it a "drive by" cleanup 
(made while you were making the change already but not required)?



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