| 378 | } |
| 379 | |
| 380 | void BlockSplitBloomFilter::FoldToTargetFpp(double target_fpp) { |
| 381 | const auto num_bits = static_cast<int64_t>(num_bytes_) * 8; |
| 382 | const auto total_set_bits = |
| 383 | ::arrow::internal::CountSetBits(data_->data(), /*bit_offset=*/0, num_bits); |
| 384 | if (total_set_bits == 0) { |
| 385 | num_bytes_ = kMinimumBloomFilterBytes; |
| 386 | return; |
| 387 | } |
| 388 | |
| 389 | const double avg_fill = static_cast<double>(total_set_bits) / num_bits; |
| 390 | const uint32_t num_folds = NumFoldsForTargetFpp(target_fpp, avg_fill); |
| 391 | if (num_folds > 0) { |
| 392 | Fold(num_folds); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | uint32_t BlockSplitBloomFilter::NumFoldsForTargetFpp(double target_fpp, |
| 397 | double avg_fill) const { |
no test coverage detected