siddharthteotia commented on a change in pull request #8138:
URL: https://github.com/apache/pinot/pull/8138#discussion_r800105762



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunction.java
##########
@@ -185,21 +188,29 @@ public TransformResultMetadata getResultMetadata() {
    * index(1 to N) of matched WHEN clause, 0 means nothing matched, so go to 
ELSE.
    */
   private int[] getSelectedArray(ProjectionBlock projectionBlock) {
-    if (_selectedResults == null) {
-      _selectedResults = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
+    int numDocs = projectionBlock.getNumDocs();
+    if (_selectedResults == null || _selectedResults.length < numDocs) {
+      _selectedResults = new int[numDocs];
     } else {
-      Arrays.fill(_selectedResults, 0);
+      Arrays.fill(_selectedResults, 0, numDocs, 0);
+      Arrays.fill(_selections, false);
     }
     int numWhenStatements = _whenStatements.size();
-    for (int i = 0; i < numWhenStatements; i++) {
+    for (int i = numWhenStatements - 1; i >= 0; i--) {

Review comment:
       Why loop needs to be reversed




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