pub struct Sbbf(/* private fields */);Expand description
A split block Bloom filter.
The creation of this structure is based on the crate::file::properties::BloomFilterProperties
struct set via crate::file::properties::WriterProperties and is thus hidden by default.
Implementations§
Source§impl Sbbf
impl Sbbf
Sourcepub fn write<W: Write>(&self, writer: W) -> Result<(), ParquetError>
pub fn write<W: Write>(&self, writer: W) -> Result<(), ParquetError>
Write the bloom filter data (header and then bitset) to the output. This doesn’t
flush the writer in order to boost performance of bulk writing all blocks. Caller
must remember to flush the writer.
This method usually is used in conjunction with Self::from_bytes for serialization/deserialization.
Sourcepub fn read_from_column_chunk<R: ChunkReader>(
column_metadata: &ColumnChunkMetaData,
reader: &R,
) -> Result<Option<Self>, ParquetError>
pub fn read_from_column_chunk<R: ChunkReader>( column_metadata: &ColumnChunkMetaData, reader: &R, ) -> Result<Option<Self>, ParquetError>
Read a new bloom filter from the given offset in the given reader.
Sourcepub fn insert<T: AsBytes + ?Sized>(&mut self, value: &T)
pub fn insert<T: AsBytes + ?Sized>(&mut self, value: &T)
Insert an AsBytes value into the filter
Sourcepub fn check<T: AsBytes>(&self, value: &T) -> bool
pub fn check<T: AsBytes>(&self, value: &T) -> bool
Check if an AsBytes value is probably present or definitely absent in the filter
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ParquetError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ParquetError>
Reads a Sbff from Thrift encoded bytes
§Examples
// In a real application, you would read serialized bloom filter bytes from a cache.
// This example demonstrates the deserialization process.
// Assuming you have bloom filter bytes from a Parquet file:
let bloom_filter = Sbbf::from_bytes(&serialized_bytes)?;
// Now you can use the bloom filter to check for values
if bloom_filter.check(&"some_value") {
println!("Value might be present (or false positive)");
} else {
println!("Value is definitely not present");
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sbbf
impl RefUnwindSafe for Sbbf
impl Send for Sbbf
impl Sync for Sbbf
impl Unpin for Sbbf
impl UnwindSafe for Sbbf
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more