saurabhd336 commented on code in PR #11729: URL: https://github.com/apache/pinot/pull/11729#discussion_r1354125407
########## pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/reader/ForwardIndexReader.java: ########## @@ -916,4 +919,67 @@ default byte[][] getBytesMV(int docId, T context) { default int getNumValuesMV(int docId, T context) { throw new UnsupportedOperationException(); } + + /** + * This class represents the buffer byte ranges accessed while reading a given docId. + * See {@link ValueRangeProvider} for more details. + */ + @AllArgsConstructor + @EqualsAndHashCode + @Getter + class ValueRange { + private final long _offset; + private final int _sizeInBytes; + + public static ValueRange newByteRange(long offset, int sizeInBytes) { + return new ValueRange(offset, sizeInBytes); + } + + @Override + public String toString() { + return "Range{" + "_offset=" + _offset + ", _size=" + _sizeInBytes + '}'; + } + } + + /** + * An interface that enables the caller to get byte ranges accessed while reading a given docId. + * This can be used to eventually allow prefetching of exact byte ranges during query processing, + * if the docIds to be fetched are known beforehand. + * + * This interface will be implemented by all the forward index readers. + */ + interface ValueRangeProvider<T extends ForwardIndexReaderContext> { + /** + * Returns a list of {@link ValueRange} that represents all the distinct + * buffer byte ranges (absolute offset, sizeInBytes) that are accessed when reading the given (@param docId} + * @param docId to find the range for + * @param context Reader context + * @param ranges List of {@link ValueRange} to which the applicable value ranges will be added + */ + void recordDocIdByteRanges(int docId, T context, List<ValueRange> ranges); Review Comment: This method is not supposed to be used if value is fixed length type. Most implementations throw unsupported exception if using this on a fixed offset type fwd index -- 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