Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce raw fwd index version V5 containing implicit num doc length, improving space efficiency #14105

Merged
merged 104 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
84987ed
Initial implementation of toggling explicit MV entry size for MVFixed…
jackluo923 Sep 27, 2024
d654fd9
Fixed uncovered code paths exposed via unit test
jackluo923 Oct 1, 2024
3d4b99b
Fix style issue
jackluo923 Oct 1, 2024
8c967b5
Refactored code to use new class versions.
jackluo923 Oct 2, 2024
c2359ec
Fixed style.
jackluo923 Oct 2, 2024
dd3410f
Refactored MultiValueFixedByteRawIndexCreatorTest.java
jackluo923 Oct 2, 2024
0c0df84
Fix style.
jackluo923 Oct 2, 2024
e7e091b
Modified existing unit test and extended it for MultiValueFixedByteRa…
jackluo923 Oct 2, 2024
153be16
Improved unit test for MultiValueFixedByteRawIndexCreatorTest and Mul…
jackluo923 Oct 2, 2024
0233905
Remove redundant blank line
jackluo923 Oct 2, 2024
69defe1
Adjusted comments content
jackluo923 Oct 2, 2024
e1173c0
Removed redundant constructor missed during refactoring.
jackluo923 Oct 3, 2024
34ac786
Upgrade MVFixedByteRawIndex reader and writer from V4 to V5, retain f…
jackluo923 Oct 8, 2024
b090676
Minor changes in MultiValueFixedByteRawIndexCreator
jackluo923 Oct 8, 2024
2ff1914
Fix minor style issue.
jackluo923 Oct 8, 2024
54b2709
Refactored FixByteChunkMVForwardIndexReader
jackluo923 Oct 8, 2024
318b826
Deleted FixByteChunkMVForwardIndexReaderV2
jackluo923 Oct 9, 2024
a9170b7
Deleted FixByteChunkMVForwardIndexReaderV2Test
jackluo923 Oct 9, 2024
d699c2a
Add VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
7137792
Add license to VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
6452c79
Improved unit test
jackluo923 Oct 9, 2024
9bfbd22
Refactored unit test
jackluo923 Oct 9, 2024
fac46c5
Add blank line
jackluo923 Oct 9, 2024
29a9fdb
Remove blank line
jackluo923 Oct 9, 2024
8abf7fe
Add blank line
jackluo923 Oct 10, 2024
1c877c6
Remove blank line
jackluo923 Oct 10, 2024
ce6870b
Rebase with lastest master
jackluo923 Sep 27, 2024
0d71f91
Fixed uncovered code paths exposed via unit test
jackluo923 Oct 1, 2024
736f23f
Fix style issue
jackluo923 Oct 1, 2024
f2faece
Refactored code to use new class versions.
jackluo923 Oct 2, 2024
01cbf56
Fixed style.
jackluo923 Oct 2, 2024
f8c2f24
Refactored MultiValueFixedByteRawIndexCreatorTest.java
jackluo923 Oct 2, 2024
a6ca351
Fix style.
jackluo923 Oct 2, 2024
61fee18
Modified existing unit test and extended it for MultiValueFixedByteRa…
jackluo923 Oct 2, 2024
500dae6
Improved unit test for MultiValueFixedByteRawIndexCreatorTest and Mul…
jackluo923 Oct 2, 2024
427bdb5
Remove redundant blank line
jackluo923 Oct 2, 2024
0cb705d
Adjusted comments content
jackluo923 Oct 2, 2024
1617ebd
Removed redundant constructor missed during refactoring.
jackluo923 Oct 3, 2024
813d360
Upgrade MVFixedByteRawIndex reader and writer from V4 to V5, retain f…
jackluo923 Oct 8, 2024
7a565e4
Fix minor style issue.
jackluo923 Oct 8, 2024
296959d
Deleted FixByteChunkMVForwardIndexReaderV2
jackluo923 Oct 9, 2024
0d7073b
Deleted FixByteChunkMVForwardIndexReaderV2Test
jackluo923 Oct 9, 2024
427af58
Add VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
6e8c3ae
Add license to VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
52976a7
Improved unit test
jackluo923 Oct 9, 2024
9bb453a
Refactored unit test
jackluo923 Oct 9, 2024
93d3100
Add blank line
jackluo923 Oct 9, 2024
79e91e9
Remove blank line
jackluo923 Oct 9, 2024
9a7676f
Add blank line
jackluo923 Oct 10, 2024
aa9eb74
Remove blank line
jackluo923 Oct 10, 2024
4ce5280
Refactored code to utilize changes from Extract common MV ser/de logi…
jackluo923 Oct 14, 2024
0d88f2f
Merge remote-tracking branch 'origin/master-improved-MV-fixed-byte-in…
jackluo923 Oct 14, 2024
ec1b628
Removed redundant RuntimeException from method signature
jackluo923 Oct 14, 2024
87dd327
Merge branch 'apache:master' into master-improved-MV-fixed-byte-index
jackluo923 Oct 15, 2024
e7f645c
Rebase with lastest master
jackluo923 Sep 27, 2024
5cb4575
Fixed uncovered code paths exposed via unit test
jackluo923 Oct 1, 2024
1ece331
Fix style issue
jackluo923 Oct 1, 2024
4c35683
Refactored code to use new class versions.
jackluo923 Oct 2, 2024
bd1da13
Fixed style.
jackluo923 Oct 2, 2024
2637e2d
Refactored MultiValueFixedByteRawIndexCreatorTest.java
jackluo923 Oct 2, 2024
731906e
Fix style.
jackluo923 Oct 2, 2024
171aaf4
Modified existing unit test and extended it for MultiValueFixedByteRa…
jackluo923 Oct 2, 2024
bca5eda
Improved unit test for MultiValueFixedByteRawIndexCreatorTest and Mul…
jackluo923 Oct 2, 2024
ce5eb7b
Remove redundant blank line
jackluo923 Oct 2, 2024
7274f4c
Adjusted comments content
jackluo923 Oct 2, 2024
ea29a13
Removed redundant constructor missed during refactoring.
jackluo923 Oct 3, 2024
256d774
Upgrade MVFixedByteRawIndex reader and writer from V4 to V5, retain f…
jackluo923 Oct 8, 2024
acfe864
Fix minor style issue.
jackluo923 Oct 8, 2024
a4751b6
Deleted FixByteChunkMVForwardIndexReaderV2
jackluo923 Oct 9, 2024
32062a1
Deleted FixByteChunkMVForwardIndexReaderV2Test
jackluo923 Oct 9, 2024
ef3f663
Add VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
38a8cb6
Add license to VarByteChunkV5Test unit test
jackluo923 Oct 9, 2024
b8dfacd
Improved unit test
jackluo923 Oct 9, 2024
bd9bdee
Refactored unit test
jackluo923 Oct 9, 2024
5b6e29e
Add blank line
jackluo923 Oct 9, 2024
597762f
Remove blank line
jackluo923 Oct 9, 2024
ff21345
Add blank line
jackluo923 Oct 10, 2024
cde2a6d
Remove blank line
jackluo923 Oct 10, 2024
d430d61
Refactored code to utilize changes from Extract common MV ser/de logi…
jackluo923 Oct 14, 2024
3f68f75
Rebased to latest
jackluo923 Oct 1, 2024
27328bf
Rebase to latest
jackluo923 Oct 1, 2024
79c6f66
Refactored code to use new class versions.
jackluo923 Oct 2, 2024
e9778d3
Fixed style.
jackluo923 Oct 2, 2024
b43f676
Refactored MultiValueFixedByteRawIndexCreatorTest.java
jackluo923 Oct 2, 2024
c6033b9
Fix style.
jackluo923 Oct 2, 2024
3f654e4
Modified existing unit test and extended it for MultiValueFixedByteRa…
jackluo923 Oct 2, 2024
12af1ce
Improved unit test for MultiValueFixedByteRawIndexCreatorTest and Mul…
jackluo923 Oct 2, 2024
063c5b4
Adjusted comments content
jackluo923 Oct 2, 2024
b8794f2
Upgrade MVFixedByteRawIndex reader and writer from V4 to V5, retain f…
jackluo923 Oct 8, 2024
9812e3e
Deleted FixByteChunkMVForwardIndexReaderV2
jackluo923 Oct 9, 2024
085aed6
Deleted FixByteChunkMVForwardIndexReaderV2Test
jackluo923 Oct 9, 2024
7e1d10c
Improved unit test
jackluo923 Oct 9, 2024
d06dda4
Refactored unit test
jackluo923 Oct 9, 2024
e9835c5
Add blank line
jackluo923 Oct 9, 2024
06c0b95
Remove blank line
jackluo923 Oct 9, 2024
07d6f75
Add blank line
jackluo923 Oct 10, 2024
680fc24
Remove blank line
jackluo923 Oct 10, 2024
1b22234
Removed redundant RuntimeException from method signature
jackluo923 Oct 14, 2024
cfbc9ee
Merge remote-tracking branch 'origin/master-improved-MV-fixed-byte-in…
jackluo923 Oct 15, 2024
0da0ca7
Updated javadoc for VarByteChunkForwardIndexWriterV5
jackluo923 Oct 16, 2024
89ec8af
Addressed code review comments to use `getVersion()` in forward index…
jackluo923 Oct 16, 2024
592967a
Addressed final minor code review suggestion.
jackluo923 Oct 16, 2024
44b0df8
Change getConcreteClassVersion back to getVersion
jackluo923 Oct 17, 2024
6fe4517
Adjusted member variable scope in VarByteChunkForwardIndexWriterV4
jackluo923 Oct 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class MultiValueFixedByteRawIndexCreator implements ForwardIndexCreator {

private final VarByteChunkWriter _indexWriter;
protected final VarByteChunkWriter _indexWriter;
private final DataType _valueType;

/**
Expand Down Expand Up @@ -75,8 +75,7 @@ public MultiValueFixedByteRawIndexCreator(File indexFile, ChunkCompressionType c
DataType valueType, int maxNumberOfMultiValueElements, boolean deriveNumDocsPerChunk, int writerVersion,
int targetMaxChunkSizeBytes, int targetDocsPerChunk)
throws IOException {
// Store the length followed by the values
int totalMaxLength = Integer.BYTES + (maxNumberOfMultiValueElements * valueType.getStoredType().size());
int totalMaxLength = computeTotalMaxLength(maxNumberOfMultiValueElements, valueType);
if (writerVersion < VarByteChunkForwardIndexWriterV4.VERSION) {
int numDocsPerChunk = deriveNumDocsPerChunk ? Math.max(targetMaxChunkSizeBytes / (totalMaxLength
+ VarByteChunkForwardIndexWriter.CHUNK_HEADER_ENTRY_ROW_OFFSET_SIZE), 1) : targetDocsPerChunk;
Expand All @@ -91,6 +90,10 @@ public MultiValueFixedByteRawIndexCreator(File indexFile, ChunkCompressionType c
_valueType = valueType;
}

protected int computeTotalMaxLength(int maxNumberOfMultiValueElements, DataType valueType) {
return Integer.BYTES + (maxNumberOfMultiValueElements * valueType.getStoredType().size());
}

@Override
public boolean isDictionaryEncoded() {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/**
* 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.segment.local.segment.creator.impl.fwd;

import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.apache.pinot.segment.spi.compression.ChunkCompressionType;
import org.apache.pinot.spi.data.FieldSpec.DataType;


/**
Same as MultiValueFixedByteRawIndexCreator, but without storing the number of elements for each row.
*/
public class MultiValueFixedByteRawIndexCreatorV2 extends MultiValueFixedByteRawIndexCreator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to add a new creator because creator is used to handle creation of different version of forward index. Instead, we want to add a new raw index version v5 for this new format

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/**
* Create a var-byte raw index creator for the given column
*
* @param baseIndexDir Index directory
* @param compressionType Type of compression to use
* @param column Name of column to index
* @param totalDocs Total number of documents to index
* @param valueType Type of the values
* @param deriveNumDocsPerChunk true if writer should auto-derive the number of rows per chunk
* @param writerVersion writer format version
* @param targetMaxChunkSizeBytes target max chunk size in bytes, applicable only for V4 or when
* deriveNumDocsPerChunk is true
*/
public MultiValueFixedByteRawIndexCreatorV2(File baseIndexDir, ChunkCompressionType compressionType, String column,
int totalDocs, DataType valueType, int maxNumberOfMultiValueElements, boolean deriveNumDocsPerChunk,
int writerVersion, int targetMaxChunkSizeBytes, int targetDocsPerChunk)
throws IOException {
super(baseIndexDir, compressionType, column, totalDocs, valueType, maxNumberOfMultiValueElements,
deriveNumDocsPerChunk, writerVersion, targetMaxChunkSizeBytes, targetDocsPerChunk);
}

public MultiValueFixedByteRawIndexCreatorV2(File indexFile, ChunkCompressionType compressionType, int totalDocs,
DataType valueType, int maxNumberOfMultiValueElements, boolean deriveNumDocsPerChunk, int writerVersion)
throws IOException {
super(indexFile, compressionType, totalDocs, valueType, maxNumberOfMultiValueElements, deriveNumDocsPerChunk,
writerVersion);
}

public MultiValueFixedByteRawIndexCreatorV2(File indexFile, ChunkCompressionType compressionType, int totalDocs,
DataType valueType, int maxNumberOfMultiValueElements, boolean deriveNumDocsPerChunk, int writerVersion,
int targetMaxChunkSizeBytes, int targetDocsPerChunk)
throws IOException {
super(indexFile, compressionType, totalDocs, valueType, maxNumberOfMultiValueElements, deriveNumDocsPerChunk,
writerVersion, targetMaxChunkSizeBytes, targetDocsPerChunk);
}

@Override
protected int computeTotalMaxLength(int maxNumberOfMultiValueElements, DataType valueType) {
return maxNumberOfMultiValueElements * valueType.getStoredType().size();
}

@Override
public void putIntMV(int[] values) {
byte[] bytes = new byte[values.length * Integer.BYTES];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
//write the content of each element
for (int value : values) {
byteBuffer.putInt(value);
}
_indexWriter.putBytes(bytes);
}

@Override
public void putLongMV(long[] values) {
byte[] bytes = new byte[values.length * Long.BYTES];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
//write the content of each element
for (long value : values) {
byteBuffer.putLong(value);
}
_indexWriter.putBytes(bytes);
}

@Override
public void putFloatMV(float[] values) {
byte[] bytes = new byte[values.length * Float.BYTES];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
//write the content of each element
for (float value : values) {
byteBuffer.putFloat(value);
}
_indexWriter.putBytes(bytes);
}

@Override
public void putDoubleMV(double[] values) {
byte[] bytes = new byte[values.length * Double.BYTES];
ByteBuffer byteBuffer = ByteBuffer.wrap(bytes);
//write the content of each element
for (double value : values) {
byteBuffer.putDouble(value);
}
_indexWriter.putBytes(bytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* LONG, FLOAT, DOUBLE).
* <p>For data layout, please refer to the documentation for {@link VarByteChunkForwardIndexWriter}
*/
public final class FixedByteChunkMVForwardIndexReader extends BaseChunkForwardIndexReader {
public class FixedByteChunkMVForwardIndexReader extends BaseChunkForwardIndexReader {
private static final int ROW_OFFSET_SIZE = VarByteChunkForwardIndexWriter.CHUNK_HEADER_ENTRY_ROW_OFFSET_SIZE;

private final int _maxChunkSize;
Expand All @@ -54,7 +54,7 @@ public ChunkReaderContext createContext() {
@Override
public int getIntMV(int docId, int[] valueBuffer, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getInt();
}
Expand All @@ -64,7 +64,7 @@ public int getIntMV(int docId, int[] valueBuffer, ChunkReaderContext context) {
@Override
public int[] getIntMV(int docId, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
int[] valueBuffer = new int[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getInt();
Expand All @@ -75,7 +75,7 @@ public int[] getIntMV(int docId, ChunkReaderContext context) {
@Override
public int getLongMV(int docId, long[] valueBuffer, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getLong();
}
Expand All @@ -85,7 +85,7 @@ public int getLongMV(int docId, long[] valueBuffer, ChunkReaderContext context)
@Override
public long[] getLongMV(int docId, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
long[] valueBuffer = new long[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getLong();
Expand All @@ -96,7 +96,7 @@ public long[] getLongMV(int docId, ChunkReaderContext context) {
@Override
public int getFloatMV(int docId, float[] valueBuffer, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getFloat();
}
Expand All @@ -106,7 +106,7 @@ public int getFloatMV(int docId, float[] valueBuffer, ChunkReaderContext context
@Override
public float[] getFloatMV(int docId, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
float[] valueBuffer = new float[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getFloat();
Expand All @@ -117,7 +117,7 @@ public float[] getFloatMV(int docId, ChunkReaderContext context) {
@Override
public int getDoubleMV(int docId, double[] valueBuffer, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getDouble();
}
Expand All @@ -127,7 +127,7 @@ public int getDoubleMV(int docId, double[] valueBuffer, ChunkReaderContext conte
@Override
public double[] getDoubleMV(int docId, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
int numValues = byteBuffer.getInt();
int numValues = getNumValuesMV(byteBuffer);
double[] valueBuffer = new double[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getDouble();
Expand All @@ -141,7 +141,11 @@ public int getNumValuesMV(int docId, ChunkReaderContext context) {
return byteBuffer.getInt();
}

private ByteBuffer slice(int docId, ChunkReaderContext context) {
protected int getNumValuesMV(ByteBuffer byteBuffer) {
return byteBuffer.getInt();
}

protected ByteBuffer slice(int docId, ChunkReaderContext context) {
if (_isCompressed) {
return sliceBytesCompressed(docId, context);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* 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.segment.local.segment.index.readers.forward;

import java.nio.ByteBuffer;
import org.apache.pinot.segment.spi.memory.PinotDataBuffer;
import org.apache.pinot.spi.data.FieldSpec.DataType;


/**
Same as FixedByteChunkMVForwardIndexReader, but the number of elements for each row is inferred
*/
public final class FixedByteChunkMVForwardIndexReaderV2 extends FixedByteChunkMVForwardIndexReader {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it V5 to be consistent with index version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


public FixedByteChunkMVForwardIndexReaderV2(PinotDataBuffer dataBuffer, DataType storedType) {
super(dataBuffer, storedType);
}

@Override
public int getNumValuesMV(int docId, ChunkReaderContext context) {
ByteBuffer byteBuffer = slice(docId, context);
jackluo923 marked this conversation as resolved.
Show resolved Hide resolved
return getNumValuesMV(byteBuffer);
}

@Override
protected int getNumValuesMV(ByteBuffer byteBuffer) {
return byteBuffer.remaining() / _storedType.size();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class VarByteChunkForwardIndexReaderV4
private static final Logger LOGGER = LoggerFactory.getLogger(VarByteChunkForwardIndexReaderV4.class);
private static final int METADATA_ENTRY_SIZE = 8;

private final FieldSpec.DataType _storedType;
protected final FieldSpec.DataType _storedType;
private final int _targetDecompressedChunkSize;
private final ChunkDecompressor _chunkDecompressor;
private final ChunkCompressionType _chunkCompressionType;
Expand Down Expand Up @@ -121,10 +121,14 @@ public byte[] getBytes(int docId, ReaderContext context) {
return context.getValue(docId);
}

protected int getNumFixedByteValuesMV(ByteBuffer byteBuffer) {
return byteBuffer.getInt();
}

@Override
public int getIntMV(int docId, int[] valueBuffer, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getInt();
}
Expand All @@ -134,7 +138,7 @@ public int getIntMV(int docId, int[] valueBuffer, VarByteChunkForwardIndexReader
@Override
public int[] getIntMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
int[] valueBuffer = new int[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getInt();
Expand All @@ -145,7 +149,7 @@ public int[] getIntMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContext
@Override
public int getLongMV(int docId, long[] valueBuffer, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getLong();
}
Expand All @@ -155,7 +159,7 @@ public int getLongMV(int docId, long[] valueBuffer, VarByteChunkForwardIndexRead
@Override
public long[] getLongMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
long[] valueBuffer = new long[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getLong();
Expand All @@ -166,7 +170,7 @@ public long[] getLongMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContex
@Override
public int getFloatMV(int docId, float[] valueBuffer, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getFloat();
}
Expand All @@ -176,7 +180,7 @@ public int getFloatMV(int docId, float[] valueBuffer, VarByteChunkForwardIndexRe
@Override
public float[] getFloatMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
float[] valueBuffer = new float[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getFloat();
Expand All @@ -187,7 +191,7 @@ public float[] getFloatMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderCont
@Override
public int getDoubleMV(int docId, double[] valueBuffer, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getDouble();
}
Expand All @@ -197,7 +201,7 @@ public int getDoubleMV(int docId, double[] valueBuffer, VarByteChunkForwardIndex
@Override
public double[] getDoubleMV(int docId, VarByteChunkForwardIndexReaderV4.ReaderContext context) {
ByteBuffer byteBuffer = ByteBuffer.wrap(context.getValue(docId));
int numValues = byteBuffer.getInt();
int numValues = getNumFixedByteValuesMV(byteBuffer);
double[] valueBuffer = new double[numValues];
for (int i = 0; i < numValues; i++) {
valueBuffer[i] = byteBuffer.getFloat();
Expand Down
Loading
Loading