feat: add early emit count metric to partial aggregates - #24996
Conversation
2010YOUY01
left a comment
There was a problem hiding this comment.
Thank you, this makes sense to me. It should be good to go after reverting some changes.
One optional suggestion is: we can test partial mode aggregate in sqllogictest for this metric. (PartialReduce mode is not applicable for SQL interface)
| reduction_factor: Option<metrics::RatioMetrics>, | ||
|
|
||
| /// Number of times accumulated states were emitted due to memory pressure. | ||
| early_emit_count: Option<metrics::Count>, |
There was a problem hiding this comment.
Let's revert the changes in this file. It's deprecated now, and will no longer get maintained
#24961
| reservation: MemoryReservation, | ||
| baseline_metrics: BaselineMetrics, | ||
| reduction_factor: metrics::RatioMetrics, | ||
| early_emit_count: metrics::Count, |
There was a problem hiding this comment.
In OrderedPartialAggregateStream, intermediate states are doing early emit for a different reason, I think reusing the same metric name can cause confusion, and it also seems less useful. Overall I recommend to remove it here.
There was a problem hiding this comment.
thanks! makes sense, will fix this
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24996 +/- ##
==========================================
+ Coverage 81.67% 81.70% +0.02%
==========================================
Files 1126 1127 +1
Lines 414842 415699 +857
Branches 414842 415699 +857
==========================================
+ Hits 338841 339643 +802
- Misses 56070 56110 +40
- Partials 19931 19946 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6bee1d6 to
a5e32f7
Compare
Which issue does this PR close?
Why make this change?
When DataFusion is working on a partial
GROUP BYand memory fills up, it sends out the work completed so far and starts collecting again. Today,EXPLAIN ANALYZEdoes not show that this happened. This makes it hard to tell why the partialGROUP BYproduced more rows than expected.What changed?
This PR adds an
early_emit_countnumber toEXPLAIN ANALYZE. It goes up once each time we send out partial results because memory is full.If one set of partial results is sent in several smaller pieces, the number still goes up only once.
This change does not affect query results and does not add new logs.
How was it tested?
Tests cover each way DataFusion runs a partial
GROUP BY. They check that:Are there any user-facing changes?
EXPLAIN ANALYZEcan now showearly_emit_countfor partialGROUP BYsteps.