Skip to content

Commit 7611266

Browse files
committed
correct example to pass the validation
1 parent 51029ec commit 7611266

File tree

1 file changed

+12
-17
lines changed
  • parquet/src/bloom_filter

1 file changed

+12
-17
lines changed

parquet/src/bloom_filter/mod.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -432,26 +432,21 @@ impl Sbbf {
432432
///
433433
/// # Examples
434434
///
435-
/// ```
435+
/// ```no_run
436436
/// # use parquet::errors::Result;
437437
/// # use parquet::bloom_filter::Sbbf;
438438
/// # fn main() -> Result<()> {
439-
/// // Create a bloom filter with a 32-byte bitset
440-
/// let bitset_bytes = vec![0u8; 32];
441-
/// let mut original = Sbbf::new(&bitset_bytes);
442-
/// // Insert some values
443-
/// original.insert(&"hello");
444-
/// original.insert(&"world");
445-
/// // Serialize the filter (header + bitset) to bytes
446-
/// let mut serialized = Vec::new();
447-
/// original.write(&mut serialized)?;
448-
/// // Deserialize back using from_bytes
449-
/// let reconstructed = Sbbf::from_bytes(&serialized)?;
450-
/// // Verify the reconstructed filter has the same properties
451-
/// assert_eq!(reconstructed.0.len(), original.0.len());
452-
/// assert!(reconstructed.check(&"hello"));
453-
/// assert!(reconstructed.check(&"world"));
454-
/// assert!(!reconstructed.check(&"missing"));
439+
/// // In a real application, you would read serialized bloom filter bytes from a cache.
440+
/// // This example demonstrates the deserialization process.
441+
/// // Assuming you have bloom filter bytes from a Parquet file:
442+
/// # let serialized_bytes: Vec<u8> = vec![];
443+
/// let bloom_filter = Sbbf::from_bytes(&serialized_bytes)?;
444+
/// // Now you can use the bloom filter to check for values
445+
/// if bloom_filter.check(&"some_value") {
446+
/// println!("Value might be present (or false positive)");
447+
/// } else {
448+
/// println!("Value is definitely not present");
449+
/// }
455450
/// # Ok(())
456451
/// # }
457452
/// ```

0 commit comments

Comments
 (0)