Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
leaves12138 committed Jun 17, 2024
1 parent ec8d614 commit 879def1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,10 @@ private FileIndexReader getFileIndexReader(
indexType,
FileIndexCommon.getFieldType(fields, columnName),
new Options())
.createReader(seekableInputStream, startAndLength);
.createReader(
seekableInputStream,
startAndLength.getLeft(),
startAndLength.getRight());
}

private byte[] getBytesWithStartAndLength(Pair<Integer, Integer> startAndLength) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.paimon.fs.SeekableInputStream;
import org.apache.paimon.options.Options;
import org.apache.paimon.types.DataType;
import org.apache.paimon.utils.Pair;

import static org.apache.paimon.fileindex.bloomfilter.BloomFilterFileIndex.BLOOM_FILTER;

Expand All @@ -31,8 +30,7 @@ public interface FileIndexer {

FileIndexWriter createWriter();

FileIndexReader createReader(
SeekableInputStream inputStream, Pair<Integer, Integer> startAndLength);
FileIndexReader createReader(SeekableInputStream inputStream, int start, int length);

static FileIndexer create(String type, DataType dataType, Options options) {
switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.apache.paimon.utils.BloomFilter64;
import org.apache.paimon.utils.BloomFilter64.BitSet;
import org.apache.paimon.utils.IOUtils;
import org.apache.paimon.utils.Pair;

import org.apache.hadoop.util.bloom.HashFunction;

Expand Down Expand Up @@ -72,11 +71,10 @@ public FileIndexWriter createWriter() {
}

@Override
public FileIndexReader createReader(
SeekableInputStream inputStream, Pair<Integer, Integer> startAndLength) {
public FileIndexReader createReader(SeekableInputStream inputStream, int start, int length) {
try {
inputStream.seek(startAndLength.getLeft());
byte[] serializedBytes = new byte[startAndLength.getRight()];
inputStream.seek(start);
byte[] serializedBytes = new byte[length];
IOUtils.readFully(inputStream, serializedBytes);
return new Reader(dataType, serializedBytes);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.paimon.fs.ByteArraySeekableStream;
import org.apache.paimon.options.Options;
import org.apache.paimon.types.DataTypes;
import org.apache.paimon.utils.Pair;

import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -65,8 +64,7 @@ public void testAddFindByRandom() {
byte[] serializedBytes = writer.serializedBytes();
FileIndexReader reader =
filter.createReader(
new ByteArraySeekableStream(serializedBytes),
Pair.of(0, serializedBytes.length));
new ByteArraySeekableStream(serializedBytes), 0, serializedBytes.length);

for (byte[] bytes : testData) {
Assertions.assertThat(reader.visitEqual(null, bytes)).isTrue();
Expand Down Expand Up @@ -109,8 +107,7 @@ public void testAddFindByRandomLong() {
byte[] serializedBytes = writer.serializedBytes();
FileIndexReader reader =
filter.createReader(
new ByteArraySeekableStream(serializedBytes),
Pair.of(0, serializedBytes.length));
new ByteArraySeekableStream(serializedBytes), 0, serializedBytes.length);

for (Long value : testData) {
Assertions.assertThat(reader.visitEqual(null, value)).isTrue();
Expand Down

0 comments on commit 879def1

Please sign in to comment.