alamb commented on code in PR #11814:
URL: https://github.com/apache/datafusion/pull/11814#discussion_r1704081412
##########
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:
Nice -- so this also fixes a bug 🚀
--
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]