shauryachats commented on code in PR #17170:
URL: https://github.com/apache/pinot/pull/17170#discussion_r2535742284
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/timeseries/TimeSeriesExchangeReceiveOperator.java:
##########
@@ -146,13 +164,31 @@ private TimeSeriesBlock getNextBlockWithAggregation()
timeSeriesList.add(entry.getValue().build());
seriesMap.put(seriesHash, timeSeriesList);
}
- return new TimeSeriesBlock(timeBuckets, seriesMap);
+ return new TimeSeriesBlock(timeBuckets, seriesMap, aggregatedStats);
+ }
+
+ /**
+ * TODO: Consider consolidating stats merging logic with
+ * {@link org.apache.pinot.core.query.reduce.ExecutionStatsAggregator}
+ **/
+ private void mergeStats(Map<String, String> aggregatedStats, Map<String,
String> metadata) {
+ for (DataTable.MetadataKey statKey : ADDITIVE_STATS_KEYS) {
+ String key = statKey.getName();
+ String existingValue = aggregatedStats.get(key);
+ String newValue = metadata.get(key);
+ if (newValue != null) {
+ long existingLong = existingValue != null ?
Long.parseLong(existingValue) : 0L;
+ long newLong = Long.parseLong(newValue);
+ aggregatedStats.put(key, Long.toString(existingLong + newLong));
+ }
+ }
}
private TimeSeriesBlock getNextBlockNoAggregation()
throws Throwable {
Map<Long, List<TimeSeries>> timeSeriesMap = new HashMap<>();
TimeBuckets timeBuckets = null;
+ Map<String, String> aggregatedStats = new HashMap<>();
Review Comment:
https://github.com/apache/pinot/issues/17219
##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/timeseries/TimeSeriesExchangeReceiveOperator.java:
##########
@@ -50,6 +51,20 @@
* different servers, we will simply append them to the list, creating a union.
*/
public class TimeSeriesExchangeReceiveOperator extends BaseTimeSeriesOperator {
+
+ private static final List<DataTable.MetadataKey> ADDITIVE_STATS_KEYS =
List.of(
Review Comment:
https://github.com/apache/pinot/issues/17219
--
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]