Jackie-Jiang commented on a change in pull request #8403:
URL: https://github.com/apache/pinot/pull/8403#discussion_r834633655



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/GapfillProcessor.java
##########
@@ -466,11 +466,30 @@ private Object getFillValue(int columnIndex, String 
columnName, Object key, Colu
     for (Object[] row : rows) {
       long timeBucket = 
_dateTimeFormatter.fromFormatToMillis(String.valueOf(row[_timeBucketColumnIndex]));
       int index = findGapfillBucketIndex(timeBucket);
-      if (bucketedItems[index] == null) {
-        bucketedItems[index] = new ArrayList<>();
+      if (index >= _numOfTimeBuckets) {
+        // the data will not be used for gapfill, skip it
+        continue;
+      }
+      Key key = constructGroupKeys(row);
+      _groupByKeys.add(key);
+      if (index < 0) {
+        // the data can potentially be used for previous value
+        if (_previousByGroupKey.containsKey(key)) {

Review comment:
       Can be optimized by using `_previousByGroupKey.compute(key, ...)`




-- 
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]

Reply via email to