GWphua commented on code in PR #18731:
URL: https://github.com/apache/druid/pull/18731#discussion_r2681587180
##########
processing/src/main/java/org/apache/druid/query/groupby/GroupByStatsProvider.java:
##########
@@ -110,50 +159,63 @@ public long getSpilledBytes()
return spilledBytes;
}
+ public long getMaxSpilledBytes()
+ {
+ return maxSpilledBytes;
+ }
+
public long getMergeDictionarySize()
{
return mergeDictionarySize;
}
+ public long getMaxMergeDictionarySize()
+ {
+ return maxMergeDictionarySize;
+ }
+
public void addQueryStats(PerQueryStats perQueryStats)
{
if (perQueryStats.getMergeBufferAcquisitionTimeNs() > 0) {
mergeBufferQueries++;
mergeBufferAcquisitionTimeNs +=
perQueryStats.getMergeBufferAcquisitionTimeNs();
+ maxMergeBufferAcquisitionTimeNs = Math.max(
+ maxMergeBufferAcquisitionTimeNs,
+ perQueryStats.getMergeBufferAcquisitionTimeNs()
+ );
+ mergeBufferTotalUsage += perQueryStats.getMergeBufferTotalUsage();
+ maxMergeBufferUsage = Math.max(maxMergeBufferUsage,
perQueryStats.getMergeBufferTotalUsage());
}
if (perQueryStats.getSpilledBytes() > 0) {
spilledQueries++;
spilledBytes += perQueryStats.getSpilledBytes();
+ maxSpilledBytes = Math.max(maxSpilledBytes,
perQueryStats.getSpilledBytes());
}
mergeDictionarySize += perQueryStats.getMergeDictionarySize();
+ maxMergeDictionarySize = Math.max(maxMergeDictionarySize,
perQueryStats.getMergeDictionarySize());
}
- public AggregateStats reset()
+ public void reset()
{
- AggregateStats aggregateStats =
- new AggregateStats(
- mergeBufferQueries,
- mergeBufferAcquisitionTimeNs,
- spilledQueries,
- spilledBytes,
- mergeDictionarySize
- );
-
Review Comment:
My reason for the change is more from a new reader's perspective.
To understand `getStatsSince()`, I had to understand that `reset()` not only
resets the stats monitored, it also returns a copy of all stats being monitored
so far.
Hopefully, the current implementation will make it easier to understand the
intent of `getStatsSince` without jumping to `reset()`.
--
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]