From c25eeef018c20deba2ff8066217f7cd0c1e18315 Mon Sep 17 00:00:00 2001 From: Jingsong Date: Mon, 11 Nov 2024 15:56:17 +0800 Subject: [PATCH] [core] Rename BitmapIndexResultLazy to BitmapIndexResult --- .../fileindex/bitmap/BitmapFileIndex.java | 4 +- ...ResultLazy.java => BitmapIndexResult.java} | 23 ++-- .../bsi/BitSliceIndexBitmapFileIndex.java | 18 +-- .../bitmapindex/TestBitmapFileIndex.java | 34 +++--- .../bsi/BitSliceIndexBitmapFileIndexTest.java | 115 ++++++++---------- .../org/apache/orc/impl/RecordReaderImpl.java | 6 +- .../parquet/hadoop/ParquetFileReader.java | 6 +- .../paimon/spark/SparkFileIndexITCase.java | 12 +- 8 files changed, 104 insertions(+), 114 deletions(-) rename paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/{BitmapIndexResultLazy.java => BitmapIndexResult.java} (66%) diff --git a/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndex.java b/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndex.java index 22375e763f79..4020302c565c 100644 --- a/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndex.java +++ b/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndex.java @@ -188,7 +188,7 @@ public FileIndexResult visitNotEqual(FieldRef fieldRef, Object literal) { @Override public FileIndexResult visitIn(FieldRef fieldRef, List literals) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { readInternalMeta(fieldRef.type()); return getInListResultBitmap(literals); @@ -197,7 +197,7 @@ public FileIndexResult visitIn(FieldRef fieldRef, List literals) { @Override public FileIndexResult visitNotIn(FieldRef fieldRef, List literals) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { readInternalMeta(fieldRef.type()); RoaringBitmap32 bitmap = getInListResultBitmap(literals); diff --git a/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResultLazy.java b/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResult.java similarity index 66% rename from paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResultLazy.java rename to paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResult.java index 15210e856627..8d572ff254fc 100644 --- a/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResultLazy.java +++ b/paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapIndexResult.java @@ -25,32 +25,31 @@ import java.util.function.Supplier; /** bitmap file index result. */ -public class BitmapIndexResultLazy extends LazyField implements FileIndexResult { +public class BitmapIndexResult extends LazyField implements FileIndexResult { - public BitmapIndexResultLazy(Supplier supplier) { + public BitmapIndexResult(Supplier supplier) { super(supplier); } + @Override public boolean remain() { return !get().isEmpty(); } + @Override public FileIndexResult and(FileIndexResult fileIndexResult) { - if (fileIndexResult instanceof BitmapIndexResultLazy) { - return new BitmapIndexResultLazy( - () -> - RoaringBitmap32.and( - get(), ((BitmapIndexResultLazy) fileIndexResult).get())); + if (fileIndexResult instanceof BitmapIndexResult) { + return new BitmapIndexResult( + () -> RoaringBitmap32.and(get(), ((BitmapIndexResult) fileIndexResult).get())); } return FileIndexResult.super.and(fileIndexResult); } + @Override public FileIndexResult or(FileIndexResult fileIndexResult) { - if (fileIndexResult instanceof BitmapIndexResultLazy) { - return new BitmapIndexResultLazy( - () -> - RoaringBitmap32.or( - get(), ((BitmapIndexResultLazy) fileIndexResult).get())); + if (fileIndexResult instanceof BitmapIndexResult) { + return new BitmapIndexResult( + () -> RoaringBitmap32.or(get(), ((BitmapIndexResult) fileIndexResult).get())); } return FileIndexResult.super.and(fileIndexResult); } diff --git a/paimon-common/src/main/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndex.java b/paimon-common/src/main/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndex.java index 8d0e054dd6d6..df6b8d897ca1 100644 --- a/paimon-common/src/main/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndex.java +++ b/paimon-common/src/main/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndex.java @@ -24,7 +24,7 @@ import org.apache.paimon.fileindex.FileIndexResult; import org.apache.paimon.fileindex.FileIndexWriter; import org.apache.paimon.fileindex.FileIndexer; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.fs.SeekableInputStream; import org.apache.paimon.options.Options; import org.apache.paimon.predicate.FieldRef; @@ -208,7 +208,7 @@ public Reader( @Override public FileIndexResult visitIsNull(FieldRef fieldRef) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { RoaringBitmap32 bitmap = RoaringBitmap32.or(positive.isNotNull(), negative.isNotNull()); @@ -219,7 +219,7 @@ public FileIndexResult visitIsNull(FieldRef fieldRef) { @Override public FileIndexResult visitIsNotNull(FieldRef fieldRef) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> RoaringBitmap32.or(positive.isNotNull(), negative.isNotNull())); } @@ -235,7 +235,7 @@ public FileIndexResult visitNotEqual(FieldRef fieldRef, Object literal) { @Override public FileIndexResult visitIn(FieldRef fieldRef, List literals) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> literals.stream() .map(valueMapper) @@ -254,7 +254,7 @@ public FileIndexResult visitIn(FieldRef fieldRef, List literals) { @Override public FileIndexResult visitNotIn(FieldRef fieldRef, List literals) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { RoaringBitmap32 ebm = RoaringBitmap32.or(positive.isNotNull(), negative.isNotNull()); @@ -278,7 +278,7 @@ public FileIndexResult visitNotIn(FieldRef fieldRef, List literals) { @Override public FileIndexResult visitLessThan(FieldRef fieldRef, Object literal) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { Long value = valueMapper.apply(literal); if (value < 0) { @@ -291,7 +291,7 @@ public FileIndexResult visitLessThan(FieldRef fieldRef, Object literal) { @Override public FileIndexResult visitLessOrEqual(FieldRef fieldRef, Object literal) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { Long value = valueMapper.apply(literal); if (value < 0) { @@ -304,7 +304,7 @@ public FileIndexResult visitLessOrEqual(FieldRef fieldRef, Object literal) { @Override public FileIndexResult visitGreaterThan(FieldRef fieldRef, Object literal) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { Long value = valueMapper.apply(literal); if (value < 0) { @@ -318,7 +318,7 @@ public FileIndexResult visitGreaterThan(FieldRef fieldRef, Object literal) { @Override public FileIndexResult visitGreaterOrEqual(FieldRef fieldRef, Object literal) { - return new BitmapIndexResultLazy( + return new BitmapIndexResult( () -> { Long value = valueMapper.apply(literal); if (value < 0) { diff --git a/paimon-common/src/test/java/org/apache/paimon/fileindex/bitmapindex/TestBitmapFileIndex.java b/paimon-common/src/test/java/org/apache/paimon/fileindex/bitmapindex/TestBitmapFileIndex.java index 84e2af304f7d..ba94f3c077dd 100644 --- a/paimon-common/src/test/java/org/apache/paimon/fileindex/bitmapindex/TestBitmapFileIndex.java +++ b/paimon-common/src/test/java/org/apache/paimon/fileindex/bitmapindex/TestBitmapFileIndex.java @@ -22,7 +22,7 @@ import org.apache.paimon.fileindex.FileIndexReader; import org.apache.paimon.fileindex.FileIndexWriter; import org.apache.paimon.fileindex.bitmap.BitmapFileIndex; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.fs.ByteArraySeekableStream; import org.apache.paimon.predicate.FieldRef; import org.apache.paimon.types.IntType; @@ -63,21 +63,21 @@ public void testBitmapIndex1() { ByteArraySeekableStream seekableStream = new ByteArraySeekableStream(bytes); FileIndexReader reader = bitmapFileIndex.createReader(seekableStream, 0, bytes.length); - BitmapIndexResultLazy result1 = - (BitmapIndexResultLazy) reader.visitEqual(fieldRef, BinaryString.fromString("a")); + BitmapIndexResult result1 = + (BitmapIndexResult) reader.visitEqual(fieldRef, BinaryString.fromString("a")); assert result1.get().equals(RoaringBitmap32.bitmapOf(0, 4)); - BitmapIndexResultLazy result2 = - (BitmapIndexResultLazy) reader.visitEqual(fieldRef, BinaryString.fromString("b")); + BitmapIndexResult result2 = + (BitmapIndexResult) reader.visitEqual(fieldRef, BinaryString.fromString("b")); assert result2.get().equals(RoaringBitmap32.bitmapOf(2)); - BitmapIndexResultLazy result3 = (BitmapIndexResultLazy) reader.visitIsNull(fieldRef); + BitmapIndexResult result3 = (BitmapIndexResult) reader.visitIsNull(fieldRef); assert result3.get().equals(RoaringBitmap32.bitmapOf(1, 3)); - BitmapIndexResultLazy result4 = (BitmapIndexResultLazy) result1.and(result2); + BitmapIndexResult result4 = (BitmapIndexResult) result1.and(result2); assert result4.get().equals(RoaringBitmap32.bitmapOf()); - BitmapIndexResultLazy result5 = (BitmapIndexResultLazy) result1.or(result2); + BitmapIndexResult result5 = (BitmapIndexResult) result1.or(result2); assert result5.get().equals(RoaringBitmap32.bitmapOf(0, 2, 4)); } @@ -95,21 +95,21 @@ public void testBitmapIndex2() { ByteArraySeekableStream seekableStream = new ByteArraySeekableStream(bytes); FileIndexReader reader = bitmapFileIndex.createReader(seekableStream, 0, bytes.length); - BitmapIndexResultLazy result1 = (BitmapIndexResultLazy) reader.visitEqual(fieldRef, 1); + BitmapIndexResult result1 = (BitmapIndexResult) reader.visitEqual(fieldRef, 1); assert result1.get().equals(RoaringBitmap32.bitmapOf(1)); - BitmapIndexResultLazy result2 = (BitmapIndexResultLazy) reader.visitIsNull(fieldRef); + BitmapIndexResult result2 = (BitmapIndexResult) reader.visitIsNull(fieldRef); assert result2.get().equals(RoaringBitmap32.bitmapOf(2)); - BitmapIndexResultLazy result3 = (BitmapIndexResultLazy) reader.visitIsNotNull(fieldRef); + BitmapIndexResult result3 = (BitmapIndexResult) reader.visitIsNotNull(fieldRef); assert result3.get().equals(RoaringBitmap32.bitmapOf(0, 1)); - BitmapIndexResultLazy result4 = - (BitmapIndexResultLazy) reader.visitNotIn(fieldRef, Arrays.asList(1, 2)); + BitmapIndexResult result4 = + (BitmapIndexResult) reader.visitNotIn(fieldRef, Arrays.asList(1, 2)); assert result4.get().equals(RoaringBitmap32.bitmapOf(0, 2)); - BitmapIndexResultLazy result5 = - (BitmapIndexResultLazy) reader.visitNotIn(fieldRef, Arrays.asList(1, 0)); + BitmapIndexResult result5 = + (BitmapIndexResult) reader.visitNotIn(fieldRef, Arrays.asList(1, 0)); assert result5.get().equals(RoaringBitmap32.bitmapOf(2)); } @@ -131,11 +131,11 @@ public void testBitmapIndex3() { ByteArraySeekableStream seekableStream = new ByteArraySeekableStream(bytes); FileIndexReader reader = bitmapFileIndex.createReader(seekableStream, 0, bytes.length); - BitmapIndexResultLazy result1 = (BitmapIndexResultLazy) reader.visitEqual(fieldRef, 1); + BitmapIndexResult result1 = (BitmapIndexResult) reader.visitEqual(fieldRef, 1); assert result1.get().equals(RoaringBitmap32.bitmapOf(0, 2, 4)); // test read singleton bitmap - BitmapIndexResultLazy result2 = (BitmapIndexResultLazy) reader.visitIsNull(fieldRef); + BitmapIndexResult result2 = (BitmapIndexResult) reader.visitIsNull(fieldRef); assert result2.get().equals(RoaringBitmap32.bitmapOf(6)); } } diff --git a/paimon-common/src/test/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndexTest.java b/paimon-common/src/test/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndexTest.java index 594ac40b9e1d..cd73f2b2a27d 100644 --- a/paimon-common/src/test/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndexTest.java +++ b/paimon-common/src/test/java/org/apache/paimon/fileindex/bsi/BitSliceIndexBitmapFileIndexTest.java @@ -20,7 +20,7 @@ import org.apache.paimon.fileindex.FileIndexReader; import org.apache.paimon.fileindex.FileIndexWriter; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.fs.ByteArraySeekableStream; import org.apache.paimon.predicate.FieldRef; import org.apache.paimon.types.IntType; @@ -52,61 +52,58 @@ public void testBitSliceIndexMix() { FileIndexReader reader = bsiFileIndex.createReader(stream, 0, bytes.length); // test eq - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4)); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, 100)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, 100)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); // test neq - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 3, 4, 5, 8, 9)); - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 5, 7, 8, 9)); - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, 100)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, 100)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 7, 8, 9)); // test in - assertThat( - ((BitmapIndexResultLazy) - reader.visitIn(fieldRef, Arrays.asList(-1, 1, 2, 3))) - .get()) + assertThat(((BitmapIndexResult) reader.visitIn(fieldRef, Arrays.asList(-1, 1, 2, 3))).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 5, 7)); // test not in assertThat( - ((BitmapIndexResultLazy) + ((BitmapIndexResult) reader.visitNotIn(fieldRef, Arrays.asList(-1, 1, 2, 3))) .get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4, 8, 9)); // test null - assertThat(((BitmapIndexResultLazy) reader.visitIsNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(2, 6, 10)); // test is not null - assertThat(((BitmapIndexResultLazy) reader.visitIsNotNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNotNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 7, 8, 9)); // test lt - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 3, 4, 5, 8)); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 7, 8)); - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4)); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4, 5)); // test gt - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 5, 7, 8, 9)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 7, 8, 9)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(9)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 7, 9)); } @@ -127,61 +124,58 @@ public void testBitSliceIndexPositiveOnly() { FileIndexReader reader = bsiFileIndex.createReader(stream, 0, bytes.length); // test eq - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, 0)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, 0)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1)); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); // test neq - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, 2)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, 2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, 3)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, 3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 4, 5, 6, 7)); // test in - assertThat( - ((BitmapIndexResultLazy) - reader.visitIn(fieldRef, Arrays.asList(-1, 1, 2, 3))) - .get()) + assertThat(((BitmapIndexResult) reader.visitIn(fieldRef, Arrays.asList(-1, 1, 2, 3))).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3)); // test not in assertThat( - ((BitmapIndexResultLazy) + ((BitmapIndexResult) reader.visitNotIn(fieldRef, Arrays.asList(-1, 1, 2, 3))) .get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 4, 5, 6, 7)); // test null - assertThat(((BitmapIndexResultLazy) reader.visitIsNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(2, 8)); // test is not null - assertThat(((BitmapIndexResultLazy) reader.visitIsNotNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNotNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 6, 7)); // test lt - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, 3)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, 3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, 3)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, 3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); // test gt - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4, 5, 6)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 4, 5, 6)); } @@ -202,59 +196,58 @@ public void testBitSliceIndexNegativeOnly() { FileIndexReader reader = bsiFileIndex.createReader(stream, 0, bytes.length); // test eq - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); - assertThat(((BitmapIndexResultLazy) reader.visitEqual(fieldRef, -1)).get()) + assertThat(((BitmapIndexResult) reader.visitEqual(fieldRef, -1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 7)); // test neq - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, -2)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, -2)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitNotEqual(fieldRef, -3)).get()) + assertThat(((BitmapIndexResult) reader.visitNotEqual(fieldRef, -3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 4, 5, 6, 7)); // test in assertThat( - ((BitmapIndexResultLazy) - reader.visitIn(fieldRef, Arrays.asList(-1, -4, -2, 3))) + ((BitmapIndexResult) reader.visitIn(fieldRef, Arrays.asList(-1, -4, -2, 3))) .get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 4, 7)); // test not in assertThat( - ((BitmapIndexResultLazy) + ((BitmapIndexResult) reader.visitNotIn(fieldRef, Arrays.asList(-1, -4, -2, 3))) .get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 5, 6)); // test null - assertThat(((BitmapIndexResultLazy) reader.visitIsNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(0, 2, 8)); // test is not null - assertThat(((BitmapIndexResultLazy) reader.visitIsNotNull(fieldRef)).get()) + assertThat(((BitmapIndexResult) reader.visitIsNotNull(fieldRef)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 4, 5, 6, 7)); // test lt - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, -3)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, -3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(4, 5, 6)); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, -3)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, -3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(3, 4, 5, 6)); - assertThat(((BitmapIndexResultLazy) reader.visitLessThan(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessThan(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 4, 5, 6, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitLessOrEqual(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitLessOrEqual(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 4, 5, 6, 7)); // test gt - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, -3)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, -3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, -3)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, -3)).get()) .isEqualTo(RoaringBitmap32.bitmapOf(1, 3, 7)); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterThan(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterThan(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); - assertThat(((BitmapIndexResultLazy) reader.visitGreaterOrEqual(fieldRef, 1)).get()) + assertThat(((BitmapIndexResult) reader.visitGreaterOrEqual(fieldRef, 1)).get()) .isEqualTo(RoaringBitmap32.bitmapOf()); } } diff --git a/paimon-format/src/main/java/org/apache/orc/impl/RecordReaderImpl.java b/paimon-format/src/main/java/org/apache/orc/impl/RecordReaderImpl.java index dffa8ad778fc..6c3af4e50043 100644 --- a/paimon-format/src/main/java/org/apache/orc/impl/RecordReaderImpl.java +++ b/paimon-format/src/main/java/org/apache/orc/impl/RecordReaderImpl.java @@ -19,7 +19,7 @@ package org.apache.orc.impl; import org.apache.paimon.fileindex.FileIndexResult; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.utils.RoaringBitmap32; import org.apache.commons.lang3.ArrayUtils; @@ -1288,8 +1288,8 @@ public boolean[] pickRowGroups( SearchArgument.TruthValue[] exceptionAnswer = new SearchArgument.TruthValue[leafValues.length]; RoaringBitmap32 bitmap = null; - if (fileIndexResult instanceof BitmapIndexResultLazy) { - bitmap = ((BitmapIndexResultLazy) fileIndexResult).get(); + if (fileIndexResult instanceof BitmapIndexResult) { + bitmap = ((BitmapIndexResult) fileIndexResult).get(); } for (int rowGroup = 0; rowGroup < result.length; ++rowGroup) { for (int pred = 0; pred < leafValues.length; ++pred) { diff --git a/paimon-format/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java b/paimon-format/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java index 91860436be0a..e3fc118ad674 100644 --- a/paimon-format/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java +++ b/paimon-format/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java @@ -19,7 +19,7 @@ package org.apache.parquet.hadoop; import org.apache.paimon.fileindex.FileIndexResult; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.format.parquet.ParquetInputFile; import org.apache.paimon.format.parquet.ParquetInputStream; import org.apache.paimon.fs.FileRange; @@ -359,8 +359,8 @@ private List filterRowGroups(List blocks) throws I } blocks = RowGroupFilter.filterRowGroups(levels, recordFilter, blocks, this); } - if (fileIndexResult instanceof BitmapIndexResultLazy) { - RoaringBitmap32 bitmap = ((BitmapIndexResultLazy) fileIndexResult).get(); + if (fileIndexResult instanceof BitmapIndexResult) { + RoaringBitmap32 bitmap = ((BitmapIndexResult) fileIndexResult).get(); blocks = blocks.stream() .filter( diff --git a/paimon-spark/paimon-spark-common/src/test/java/org/apache/paimon/spark/SparkFileIndexITCase.java b/paimon-spark/paimon-spark-common/src/test/java/org/apache/paimon/spark/SparkFileIndexITCase.java index bb8e84bd5191..7da8f2e6b7fe 100644 --- a/paimon-spark/paimon-spark-common/src/test/java/org/apache/paimon/spark/SparkFileIndexITCase.java +++ b/paimon-spark/paimon-spark-common/src/test/java/org/apache/paimon/spark/SparkFileIndexITCase.java @@ -27,7 +27,7 @@ import org.apache.paimon.fileindex.FileIndexFormat; import org.apache.paimon.fileindex.FileIndexReader; import org.apache.paimon.fileindex.FileIndexResult; -import org.apache.paimon.fileindex.bitmap.BitmapIndexResultLazy; +import org.apache.paimon.fileindex.bitmap.BitmapIndexResult; import org.apache.paimon.fs.FileIO; import org.apache.paimon.fs.Path; import org.apache.paimon.fs.local.LocalFileIO; @@ -115,9 +115,8 @@ public void testReadWriteTableWithBitmapIndex() throws Catalog.TableNotExistExce fileIndexReader -> { FileIndexResult fileIndexResult = fileIndexReader.visitEqual(new FieldRef(0, "", new IntType()), 3); - assert fileIndexResult instanceof BitmapIndexResultLazy; - RoaringBitmap32 roaringBitmap32 = - ((BitmapIndexResultLazy) fileIndexResult).get(); + assert fileIndexResult instanceof BitmapIndexResult; + RoaringBitmap32 roaringBitmap32 = ((BitmapIndexResult) fileIndexResult).get(); assert roaringBitmap32.equals(RoaringBitmap32.bitmapOf(3)); }); } @@ -141,9 +140,8 @@ public void testReadWriteTableWithBitSliceIndex() throws Catalog.TableNotExistEx FileIndexResult fileIndexResult = fileIndexReader.visitGreaterOrEqual( new FieldRef(0, "", new IntType()), 3); - assertThat(fileIndexResult).isInstanceOf(BitmapIndexResultLazy.class); - RoaringBitmap32 roaringBitmap32 = - ((BitmapIndexResultLazy) fileIndexResult).get(); + assertThat(fileIndexResult).isInstanceOf(BitmapIndexResult.class); + RoaringBitmap32 roaringBitmap32 = ((BitmapIndexResult) fileIndexResult).get(); assertThat(roaringBitmap32).isEqualTo(RoaringBitmap32.bitmapOf(3, 4, 5)); }); }