pub struct BloomFilterPropertiesBuilder {
fpp: Option<f64>,
ndv: Option<u64>,
}Expand description
Builder for BloomFilterProperties.
Use BloomFilterProperties::builder or BloomFilterPropertiesBuilder::new
as the entry point.
Fields§
§fpp: Option<f64>§ndv: Option<u64>Implementations§
Source§impl BloomFilterPropertiesBuilder
impl BloomFilterPropertiesBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Returns a new builder with no fields set.
Equivalent to BloomFilterProperties::builder.
Sourcepub fn with_fpp(self, fpp: f64) -> Self
pub fn with_fpp(self, fpp: f64) -> Self
Sets the target false positive probability.
The value must be in (0.0, 1.0) exclusively; this is validated at
build time by Self::build / Self::try_build. When unset, the
default is 0.05 (5%, see DEFAULT_BLOOM_FILTER_FPP).
Sourcepub fn with_max_ndv(self, ndv: u64) -> Self
pub fn with_max_ndv(self, ndv: u64) -> Self
Sets the maximum expected number of distinct values used to size the bloom filter before folding.
When unset, the default is 1_048_576 (see DEFAULT_BLOOM_FILTER_NDV),
which at the default fpp of 5% reserves roughly 1 MiB per column for the
filter bitset, derived as follows:
ndv = 1,048,576, fpp = 0.05
0.05^(1/8) ≈ 0.6877
1 - 0.6877 ≈ 0.3123
ln(0.3123) ≈ -1.164
num_bits = -8 * 1,048,576 / -1.164 ≈ 7,206,000 bits
≈ 900,750 bytes (~900 KB)
next_power_of_two(900 KB) = 1 MiB (= 1,048,576 bytes)Sourcepub fn build(self) -> BloomFilterProperties
pub fn build(self) -> BloomFilterProperties
Builds BloomFilterProperties.
Panics if the configured fpp is not in (0.0, 1.0) exclusive.
Use Self::try_build for a non-panicking alternative.
Sourcepub fn try_build(self) -> Result<BloomFilterProperties>
pub fn try_build(self) -> Result<BloomFilterProperties>
Builds BloomFilterProperties, returning an error instead of
panicking when the configured fpp is not in (0.0, 1.0) exclusive.
Trait Implementations§
Source§impl Clone for BloomFilterPropertiesBuilder
impl Clone for BloomFilterPropertiesBuilder
Source§fn clone(&self) -> BloomFilterPropertiesBuilder
fn clone(&self) -> BloomFilterPropertiesBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more