Jackie-Jiang commented on code in PR #17387:
URL: https://github.com/apache/pinot/pull/17387#discussion_r2632467648


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/readers/MultiValueResult.java:
##########
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.spi.data.readers;
+
+import java.util.BitSet;
+import javax.annotation.Nullable;
+
+
+/**
+ * Result wrapper for multi-value column reads that tracks element-level null 
validity.
+ *
+ * <p>This class addresses a limitation where bulk reads from columnar formats 
(like Arrow)
+ * don't check the validity bitmap for null elements. By returning both the 
values array
+ * and a validity BitSet, callers can properly handle null elements within 
multi-value columns.
+ *
+ * <p><b>BitSet Semantics:</b>
+ * <ul>
+ *   <li>Set bit (1) = valid/non-null element</li>
+ *   <li>Unset bit (0) = null element</li>
+ *   <li>Null validity BitSet = no nulls in the range (fast path)</li>
+ * </ul>
+ *
+ * <p><b>Usage Example:</b>
+ * <pre>{@code
+ * MultiValueResult<int[]> result = columnReader.nextIntMV();
+ * int[] values = result.getValues();
+ *
+ * if (result.hasNulls()) {
+ *   for (int i = 0; i < values.length; i++) {
+ *     if (result.isNull(i)) {
+ *       // Handle null element - values[i] contains default value (0 for int)
+ *     } else {
+ *       // Use values[i]
+ *     }
+ *   }
+ * } else {
+ *   // Fast path: no nulls, use values array directly
+ * }
+ * }</pre>
+ *
+ * @param <T> The array type (int[], long[], float[], double[])
+ */
+public class MultiValueResult<T> {
+  private final T _values;
+  @Nullable
+  private final BitSet _validity;

Review Comment:
   Consider naming it `nulls` for clarity



##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/readers/ColumnReader.java:
##########
@@ -57,7 +57,7 @@
  *   } catch (Exception e) {
  *    // Handle exception / log
  *    continue;
-*    }
+ *    }

Review Comment:
   (nit) Fix indentation



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