walterddr commented on code in PR #10845: URL: https://github.com/apache/pinot/pull/10845#discussion_r1248017898
########## pinot-common/src/main/java/org/apache/pinot/common/datablock/DataBlockUtils.java: ########## @@ -268,4 +269,381 @@ private static Object[] extractRowFromDataBlock(DataBlock dataBlock, int rowId, } return row; } + + /** + * Given a datablock and the column index, extracts the integer values for the column. Prefer using this function over + * extractRowFromDatablock if the desired datatype is known to prevent autoboxing to Object and later unboxing to the + * desired type. + * + * @return int array of values in the column + */ + public static int[] extractIntRowsForColumn(DataBlock dataBlock, int columnIndex) { + DataSchema dataSchema = dataBlock.getDataSchema(); + DataSchema.ColumnDataType[] columnDataTypes = dataSchema.getColumnDataTypes(); + + // Get null bitmap for the column. + RoaringBitmap nullBitmap = extractNullBitmaps(dataBlock)[columnIndex]; + int numRows = dataBlock.getNumberOfRows(); + + int[] rows = new int[numRows]; + switch (columnDataTypes[columnIndex]) { + case INT: + case BOOLEAN: + for (int rowId = 0; rowId < numRows; rowId++) { + if (nullBitmap != null && nullBitmap.contains(rowId)) { + continue; + } Review Comment: nit: consider switching from a per-row nullbitmap check to a global if-else then follow by 2 switch-case, one dealing with null and one without -- 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