saurabhd336 commented on code in PR #11729:
URL: https://github.com/apache/pinot/pull/11729#discussion_r1349929829
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/FixedByteChunkSVForwardIndexReader.java:
##########
@@ -91,4 +95,34 @@ public double getDouble(int docId, ChunkReaderContext
context) {
return _rawData.getDouble(docId * Double.BYTES);
}
}
+
+ @Override
+ public List<ValueRange> getDocIdRange(int docId, ChunkReaderContext context,
@Nullable List<ValueRange> ranges) {
+ if (!_isCompressed) {
+ // If uncompressed, should use fixed offset
+ throw new IllegalStateException("Operation not supported since the
forward index is fixed length type");
+ }
+
+ if (ranges == null) {
+ ranges = new ArrayList<>();
+ }
+ recordDocIdRanges(docId, context, ranges);
+
+ return ranges;
+ }
+
+ @Override
+ public boolean isFixedLengthType() {
+ return !_isCompressed;
+ }
+
+ @Override
+ public long getBaseOffset() {
+ return _rawDataStart;
+ }
+
+ @Override
+ public int getDocLength() {
+ return _storedType.size();
Review Comment:
Good point. Added
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/forward/FixedBytePower2ChunkSVForwardIndexReader.java:
##########
@@ -111,4 +115,43 @@ protected ByteBuffer getChunkBuffer(int docId,
ChunkReaderContext context) {
}
return decompressChunk(chunkId, context);
}
+
+ protected void recordDocIdRanges(int docId, ChunkReaderContext context,
List<ValueRange> ranges) {
+ int chunkId = docId >>> _shift;
+ if (context.getChunkId() == chunkId) {
+ ranges.addAll(context.getRanges());
+ return;
+ }
+ recordChunkRanges(chunkId, context, ranges);
+ }
+
+ @Override
+ public List<ValueRange> getDocIdRange(int docId, ChunkReaderContext context,
@Nullable List<ValueRange> ranges) {
+ if (ranges == null) {
+ ranges = new ArrayList<>();
+ }
+ if (_isCompressed) {
+ recordDocIdRanges(docId, context, ranges);
+ } else {
+ // If uncompressed, should use fixed offset
+ throw new IllegalStateException("Operation not supported since the
forward index is of fixed length type");
+ }
+
+ return ranges;
+ }
+
+ @Override
+ public boolean isFixedLengthType() {
+ return !_isCompressed;
+ }
+
+ @Override
+ public long getBaseOffset() {
+ return _rawDataStart;
+ }
+
+ @Override
+ public int getDocLength() {
+ return _storedType.size();
+ }
Review Comment:
Ack
--
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]