Add AggregationNode.hasSingleGlobalAggregation#14559
Conversation
...in/java/io/trino/sql/planner/iterative/rule/DecorrelateInnerUnnestWithGlobalAggregation.java
Outdated
Show resolved
Hide resolved
a24f8b0 to
90a4e2a
Compare
There was a problem hiding this comment.
I would remove Returns {@code false} case.
I wondder why
even if all are empty e.g. GROUP BY GROUPING SETS ((), ()).
is relevant
There was a problem hiding this comment.
some places look only at getGroupingKeys().isEmpty() and consider this a global aggregation. This includes any number of empty grouping sets.
This method only allows for a single empty grouping set and I wanted to emphasize that in the comment so it's easier to spot the difference.
There was a problem hiding this comment.
Which places do that? That would be a bug.
There's only one possible interpretation of "single global aggregation". It must collapse all rows into a single group and produce a single row. The presence of multiple groups would immediately disqualify it as a "single" aggregation.
There was a problem hiding this comment.
Which places do that?
The most prominent example:
io.trino.sql.planner.LocalExecutionPlanner.Visitor#visitAggregation
...
if (node.getGroupingKeys().isEmpty()) {
return planGlobalAggregation(node, source, context);
}
There was a problem hiding this comment.
This should be documented using @return in the javadocs:
@returntrue if the aggregation collapses all rows into a single global group (e.g., as a result of aGROUP BY ()query). Otherwise, false.
There was a problem hiding this comment.
I updated the comment
90a4e2a to
d7aff06
Compare
|
flaky TestParquetReader #13633 |
d7aff06 to
ba65a86
Compare
|
rebased on the master to restart CI |
Description
Extract single global aggregation (
GROUP BY ()) from multiple places to a method inAggregationNodeNon-technical explanation
Code refactoring
Release notes
( X) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: