MCPcopy Create free account
hub / github.com/apache/paimon-rust / read_null_bitmap

Function read_null_bitmap

crates/paimon/src/btree/reader.rs:370–388  ·  view source on GitHub ↗

Read null bitmap from a FileRead at the given handle.

(
    reader: &dyn FileRead,
    handle: &BlockHandle,
)

Source from the content-addressed store, hash-verified

368
369/// Read null bitmap from a FileRead at the given handle.
370async fn read_null_bitmap(
371 reader: &dyn FileRead,
372 handle: &BlockHandle,
373) -> io::Result<RoaringTreemap> {
374 let offset = handle.offset;
375 let size = handle.size as u64;
376 // Read bitmap bytes + CRC (4 bytes)
377 let bytes = reader
378 .read(offset..offset + size + 4)
379 .await
380 .map_err(|e| io::Error::other(e.to_string()))?;
381 let bitmap_bytes = &bytes[..size as usize];
382 let crc_bytes = &bytes[size as usize..];
383
384 verify_null_bitmap_crc(bitmap_bytes, crc_bytes)?;
385
386 RoaringTreemap::deserialize_from(bitmap_bytes)
387 .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))
388}
389
390fn verify_null_bitmap_crc(bitmap_bytes: &[u8], crc_bytes: &[u8]) -> io::Result<()> {
391 let expected_crc = u32::from_le_bytes([crc_bytes[0], crc_bytes[1], crc_bytes[2], crc_bytes[3]]);

Callers 1

openMethod · 0.85

Calls 2

verify_null_bitmap_crcFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected