alamb commented on code in PR #7609:
URL: https://github.com/apache/arrow-datafusion/pull/7609#discussion_r1332141464
##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
if desc != order.options.descending {
return None;
}
- let group_key = aggr.group_expr().expr().first()?;
+ let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;
Review Comment:
TIL `exactly_one` 👍 makes sense to me.
Another way to write this that is more verbose but perhaps clearer might be:
```rust
if agg.group_expr().len() != 1 {
return None;
}
```
##########
datafusion/core/src/physical_optimizer/topk_aggregation.rs:
##########
@@ -51,7 +52,7 @@ impl TopKAggregation {
if desc != order.options.descending {
return None;
}
- let group_key = aggr.group_expr().expr().first()?;
+ let group_key = aggr.group_expr().expr().iter().exactly_one().ok()?;
Review Comment:
TIL `exactly_one` 👍 makes sense to me.
Another way to write this that is more verbose but perhaps clearer might be:
```rust
if agg.group_expr().len() != 1 {
return None;
}
```
--
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]