[common] Introduce BitmapFileIndexMetaV2.#5028
Conversation
paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndexMetaV2.java
Show resolved
Hide resolved
paimon-common/src/main/java/org/apache/paimon/fileindex/bitmap/BitmapFileIndex.java
Show resolved
Hide resolved
Tan-JiaLiang
left a comment
There was a problem hiding this comment.
@hang8929201 Thanks for your patience!
+1 cc @JingsongLi
|
+1 |
|
I found another question that needs to be discussed. Should the index version default to v1 or v2? @Tan-JiaLiang @JingsongLi |
I don't have a clear idea, although it may cause compatibility issues, bitmap should not be used too much. Maintaining the default version to 1 is a relatively conservative choice. |
| public static final String VERSION = "version"; | ||
| public static final String INDEX_BLOCK_SIZE = "index-block-size"; | ||
| public static final String ENABLE_BUFFERED_INPUT = "enable-buffered-input"; | ||
| public static final String ENABLE_NEXT_OFFSET_TO_SIZE = "enable-next-offset-to-size"; |
There was a problem hiding this comment.
What is enable next offset to size? Under what circumstances can it not be size?
There was a problem hiding this comment.
This parameter is just a switch for the benchmark test.
| * | ... | | ||
| * +-------------------------------------------------+----------------- | ||
| * | ||
| * index block format: |
There was a problem hiding this comment.
Maybe we should have ability to compress index block?
There was a problem hiding this comment.
I feel that it is usually more appropriate to compress the data block, our 'data block' is the roaring bitmap, which is relatively well compressed. The index block is relatively small and has high query performance requirements. I guess there is no need to compress it. Maybe in the future when there is a bad case in the business, we will design a compressed format.
| Options options; | ||
|
|
||
| void tryDeserialize() { | ||
| if (entryList == null) { |
There was a problem hiding this comment.
Maybe you can take a look to https://cwiki.apache.org/confluence/display/PAIMON/PIP-25%3A+Introduce+a+key-value+file+format+for+paimon+primary+key+table
Here just something like LevelDB sst block, we can store length to avoid deserialize all entries.
There was a problem hiding this comment.
Sorry, I don't quite understand what you mean. The purpose of designing secondary indexes is to read only part of the entries.
| bitmapOffsets, | ||
| offsetRef[0]); | ||
| } else { | ||
| throw new RuntimeException("invalid version: " + version); |
There was a problem hiding this comment.
When the writer is upgraded to the latest version and the default index version is v2, if the reader is not upgraded, an error will be reported here. Is it more appropriate to use the v1 format by default or force users to upgrade the paimon version by reporting an error? @Tan-JiaLiang @JingsongLi
| public static final String VERSION = "version"; | ||
| public static final String INDEX_BLOCK_SIZE = "index-block-size"; | ||
| public static final String ENABLE_BUFFERED_INPUT = "enable-buffered-input"; | ||
| public static final String ENABLE_NEXT_OFFSET_TO_SIZE = "enable-next-offset-to-size"; |
There was a problem hiding this comment.
This parameter is just a switch for the benchmark test.
| * | ... | | ||
| * +-------------------------------------------------+----------------- | ||
| * | ||
| * index block format: |
There was a problem hiding this comment.
I feel that it is usually more appropriate to compress the data block, our 'data block' is the roaring bitmap, which is relatively well compressed. The index block is relatively small and has high query performance requirements. I guess there is no need to compress it. Maybe in the future when there is a bad case in the business, we will design a compressed format.
| Options options; | ||
|
|
||
| void tryDeserialize() { | ||
| if (entryList == null) { |
There was a problem hiding this comment.
Sorry, I don't quite understand what you mean. The purpose of designing secondary indexes is to read only part of the entries.
Purpose
When the bitmap-indexed column cardinality is high, using the first version of the bitmap index format will take a lot of time to read the entire dictionary. But in fact we don't need a full dictionary when dealing with a small number of predicates, the performance of predicate hits on the bitmap can be improved by creating a secondary index on the dictionary.
https://docs.google.com/document/d/11dJlGlSX3dwYKKrPN0DQ2XQTsx6d9wI6DTBIiiBwomM/edit?tab=t.0
performance
cardinality 1000:

cardinality 10000:

cardinality 30000:

cardinality 50000:

cardinality 80000:

cardinality 100000:

Tests
org.apache.paimon.fileindex.bitmapindex.TestBitmapFileIndex
org.apache.paimon.spark.SparkFileIndexITCase
org.apache.paimon.benchmark.bitmap.BitmapIndexBenchmark
API and Format
Documentation
docs/content/concepts/spec/fileindex.md