You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug, including details regarding any error messages, version, and platform.
Arrow C++ 25.0.1 on macOS arm64 throws ParquetException: Given length of bitset is illegal when reading a column Bloom filter written by parquet-go v0.25.1.
To reproduce, write one row group with an INT32 column named Value containing 0 through 63 and enable parquet.SplitBlockFilter(10, "Value"). This produces a 96-byte bitset (three 32-byte blocks).
auto reader = parquet::ParquetFileReader::OpenFile("sample.parquet", false);
auto filter = reader->GetBloomFilterReader().RowGroup(0)->GetColumnBloomFilter(0);
The second call throws. The reader should return a 96-byte filter that reports all 64 inserted values as present. The Parquet format permits three blocks, but the bitset overload of BlockSplitBloomFilter::Init requires its length to be a power of two. Parquet Bloom filter specification
Hi! @raulcd
I traced this in the C++ Parquet Bloom filter implementation and wanted to confirm the fix before opening a PR.
In cpp/src/parquet/bloom_filter.cc, BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) currently rejects any size that isn't a power of two ((num_bytes & (num_bytes - 1)) != 0), throwing "Given length of bitset is illegal".
However, FindHash, InsertHashImpl, and NumBlocks() already use fastrange (((hash >> 32) * NumBlocks()) >> 32), which works for any valid number of 32-byte blocks (num_bytes % kBytesPerFilterBlock == 0), not just powers of two.
My plan is to:
Update BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) to require num_bytes % kBytesPerFilterBlock == 0 within [kMinimumBloomFilterBytes, kMaximumBloomFilterBytes] instead of requiring a power of two (keeping the writer-side Init(uint32_t num_bytes) unchanged).
Update cpp/src/parquet/bloom_filter_test.cc to test initializing/deserializing and querying a 96-byte (3-block) Bloom filter, while still rejecting sizes that aren't multiples of 32 bytes.
Does this approach look good? If so, could you please assign this issue to me?
Hi! @raulcd I traced this in the C++ Parquet Bloom filter implementation and wanted to confirm the fix before opening a PR.
In cpp/src/parquet/bloom_filter.cc, BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) currently rejects any size that isn't a power of two ((num_bytes & (num_bytes - 1)) != 0), throwing "Given length of bitset is illegal".
However, FindHash, InsertHashImpl, and NumBlocks() already use fastrange (((hash >> 32) * NumBlocks()) >> 32), which works for any valid number of 32-byte blocks (num_bytes % kBytesPerFilterBlock == 0), not just powers of two.
My plan is to:
Update BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) to require num_bytes % kBytesPerFilterBlock == 0 within [kMinimumBloomFilterBytes, kMaximumBloomFilterBytes] instead of requiring a power of two (keeping the writer-side Init(uint32_t num_bytes) unchanged).
Update cpp/src/parquet/bloom_filter_test.cc to test initializing/deserializing and querying a 96-byte (3-block) Bloom filter, while still rejecting sizes that aren't multiples of 32 bytes.
Does this approach look good? If so, could you please assign this issue to me?
Hi @ansh0014 , thanks for your interest in this issue, do you mind to review #55825, sorry I didn't link the PR to this issue.
Hi! @raulcd I traced this in the C++ Parquet Bloom filter implementation and wanted to confirm the fix before opening a PR.
In cpp/src/parquet/bloom_filter.cc, BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) currently rejects any size that isn't a power of two ((num_bytes & (num_bytes - 1)) != 0), throwing "Given length of bitset is illegal".
However, FindHash, InsertHashImpl, and NumBlocks() already use fastrange (((hash >> 32) * NumBlocks()) >> 32), which works for any valid number of 32-byte blocks (num_bytes % kBytesPerFilterBlock == 0), not just powers of two.
My plan is to:
Update BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes) to require num_bytes % kBytesPerFilterBlock == 0 within [kMinimumBloomFilterBytes, kMaximumBloomFilterBytes] instead of requiring a power of two (keeping the writer-side Init(uint32_t num_bytes) unchanged).
Update cpp/src/parquet/bloom_filter_test.cc to test initializing/deserializing and querying a 96-byte (3-block) Bloom filter, while still rejecting sizes that aren't multiples of 32 bytes.
Does this approach look good? If so, could you please assign this issue to me?
Hi @ansh0014 , thanks for your interest in this issue, do you mind to review #55825, sorry I didn't link the PR to this issue.
The change in BlockSplitBloomFilter::Init(const uint8_t*, uint32_t) to check num_bytes % kBytesPerFilterBlock == 0 makes total sense since FindHash and InsertHashImpl already use fastrange with NumBlocks(). Also great catch updating NumFoldsForTargetFpp and Fold to handle non-power-of-two even block counts (like 6 -> 3 blocks), and the parquet-go 96-byte test + 6-block fold test cover it well.
Activity
ansh0014 commentedon Nov 30, 2026
Hi! @raulcd
I traced this in the C++ Parquet Bloom filter implementation and wanted to confirm the fix before opening a PR.
In
cpp/src/parquet/bloom_filter.cc,BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes)currently rejects any size that isn't a power of two ((num_bytes & (num_bytes - 1)) != 0), throwing"Given length of bitset is illegal".However,
FindHash,InsertHashImpl, andNumBlocks()already usefastrange(((hash >> 32) * NumBlocks()) >> 32), which works for any valid number of 32-byte blocks (num_bytes % kBytesPerFilterBlock == 0), not just powers of two.My plan is to:
BlockSplitBloomFilter::Init(const uint8_t* bitset, uint32_t num_bytes)to requirenum_bytes % kBytesPerFilterBlock == 0within[kMinimumBloomFilterBytes, kMaximumBloomFilterBytes]instead of requiring a power of two (keeping the writer-sideInit(uint32_t num_bytes)unchanged).cpp/src/parquet/bloom_filter_test.ccto test initializing/deserializing and querying a 96-byte (3-block) Bloom filter, while still rejecting sizes that aren't multiples of 32 bytes.Does this approach look good? If so, could you please assign this issue to me?
zhjwpku commentedon Nov 30, 2026
Hi @ansh0014 , thanks for your interest in this issue, do you mind to review #55825, sorry I didn't link the PR to this issue.
ansh0014 commentedon Nov 30, 2026
Sure, I took a look at #55825!
The change in
BlockSplitBloomFilter::Init(const uint8_t*, uint32_t)to checknum_bytes % kBytesPerFilterBlock == 0makes total sense sinceFindHashandInsertHashImplalready usefastrangewithNumBlocks(). Also great catch updatingNumFoldsForTargetFppandFoldto handle non-power-of-two even block counts (like 6 -> 3 blocks), and theparquet-go96-byte test + 6-block fold test cover it well.Everything in the PR looks solid to me!