ansh0014 commented on issue #55824: URL: https://github.com/apache/arrow/issues/55824#issuecomment-7285360906
> > Hi! [@raulcd](https://github.com/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: > > > > 1. 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). > > 2. 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](https://github.com/ansh0014) , thanks for your interest in this issue, do you mind to review [#55825](https://github.com/apache/arrow/pull/55825), sorry I didn't link the PR to this issue. Sure, I took a look at #55825! 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. Everything in the PR looks solid to me! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
