shenyu0127 commented on code in PR #10598:
URL: https://github.com/apache/pinot/pull/10598#discussion_r1177060631


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/GreatestTransformFunction.java:
##########
@@ -44,6 +47,35 @@ public int[] transformToIntValuesSV(ValueBlock valueBlock) {
     return _intValuesSV;
   }
 
+  @Override
+  public Pair<int[], RoaringBitmap> transformToIntValuesSVWithNull(ValueBlock 
valueBlock) {
+    int numDocs = valueBlock.getNumDocs();
+    initIntValuesSV(numDocs);
+    Pair<int[], RoaringBitmap> values = 
_arguments.get(0).transformToIntValuesSVWithNull(valueBlock);
+    System.arraycopy(values.getLeft(), 0, _intValuesSV, 0, numDocs);
+    RoaringBitmap nullBitmap = values.getRight();
+    for (int i = 1; i < _arguments.size(); i++) {
+      values = _arguments.get(i).transformToIntValuesSVWithNull(valueBlock);
+      RoaringBitmap curNull = values.getRight();
+      for (int j = 0; j < numDocs & j < values.getLeft().length; j++) {
+        // Ignore null values.
+        if (curNull == null || !curNull.contains(j)) {
+          if (nullBitmap != null && nullBitmap.contains(j)) {
+            _intValuesSV[j] = values.getLeft()[j];
+          } else {
+            _intValuesSV[j] = Math.max(_intValuesSV[j], values.getLeft()[j]);
+          }
+        }
+      }

Review Comment:
   nit:
   ```
   for (int j = 0; j < numDocs & j < values.getLeft().length; j++) {
     if (nullBitmap != null && nullBitmap.contains(j)) {
       _intValuesSV[j] = values.getLeft()[j];
     } else {
       _intValuesSV[j] = Math.max(_intValuesSV[j], values.getLeft()[j]);
     }
   }
   ```



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to