yashmayya commented on code in PR #17348:
URL: https://github.com/apache/pinot/pull/17348#discussion_r2608706052


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/window/value/LagValueWindowFunction.java:
##########
@@ -78,7 +78,9 @@ public List<Object> processRows(List<Object[]> rows) {
     int numRows = rows.size();
     Object[] result = new Object[numRows];
     if (_defaultValue != null) {
-      Arrays.fill(result, 0, _offset, _defaultValue);
+      // We only fill up to numRows to handle the case where the offset
+      // is larger than numRows

Review Comment:
   This comment is a little confusing, isn't `numRows` the total size of the 
result array?



##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/window/value/LagValueWindowFunction.java:
##########
@@ -78,7 +78,9 @@ public List<Object> processRows(List<Object[]> rows) {
     int numRows = rows.size();
     Object[] result = new Object[numRows];
     if (_defaultValue != null) {
-      Arrays.fill(result, 0, _offset, _defaultValue);
+      // We only fill up to numRows to handle the case where the offset
+      // is larger than numRows

Review Comment:
   Also aren't we doing some additional unnecessary work here by filling _all_ 
the values? Shouldn't it be `Math.min(_offset, numRows)` instead?



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