fix: output_bytes metric in hash aggregation - #23777
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23777 +/- ##
==========================================
- Coverage 81.29% 81.14% -0.15%
==========================================
Files 1110 1110
Lines 385197 386141 +944
Branches 385197 386141 +944
==========================================
+ Hits 313132 313342 +210
- Misses 53588 54332 +744
+ Partials 18477 18467 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @ariel-miculas! I was taking a look at the failing CI checks to see if I could help unblock this. Fixing that one word should turn the CI green. Hope this helps, and great work on the hash aggregation metrics! |
|
@2010YOUY01 coud you please take a look? |
|
Is it possible to implement it entirely within the Also let's add some end-to-end tests, ideally we can do it with |
ab748ff to
8995ed6
Compare
I don't see how, since
Added an |
|
Closed and reopen to see if the test failure in an unrelated ordered_aggregate_spill.slt is transient: |
|
@2010YOUY01 let me know what you think |
Perhaps we can use something like |
That's kind of what I'm doing, except I've wrapped Unless I've missed something from your explanation. |
|
Or you mean changing |
Yes, exactly. Even if it's only for aggregation, I think this approach is still overall simpler. The existing approach seems to leak some complexity into the aggregation logic. Also, the memory overcounting in the metrics is also likely in other operators, since now we're using batch concatenation quite commonly in joins/window executions. |
8995ed6 to
17a8e86
Compare
|
Implemented the proposed approach, indeed it looks simpler overall. |
|
Thank you, the implementation looks good to me. There is a related inefficiency that was reported recently. I'll try to look into it soon and then figure out how we should proceed with this PR. Even if we can't eliminate the extra overhead, we can still add a config option to enable or disable this hash-set-based deduplication, this shouldn't be a hard blocker. |
Instead of a config option, could we use a flag that gets set by select operators, such as hash aggregate? Because for hash aggregate we already know that sliced RecordBatches will be produced from a huge initial RecordBatch.
With the config option my concern is that we'd be trading correctness for performance, since without the deduplication the hash aggregation shows heavily inflated output_bytes metrics. |
Yes, I think starting with only aggregate is a good idea
I agree. That also adds extra complexity. I imagine the performance impact would be minimal, since a hash set whose size is proportional to the number of batches is much smaller than the actual workload. We just need to verify that in #24310 |
Which issue does this PR close?
Rationale for this change
Summing together the produced sliced RecordBatches in hash aggregation leads to inflated output_bytes metric
What changes are included in this PR?
Are these changes tested?
Yes
Are there any user-facing changes?
If the metrics are user-facing, then yes.