parquet · API

parquet.bloom

Split-block bloom filters — might_contain for equality predicates.

Parquet's bloom filter is the "split block" design: the bit set is a sequence of 32-byte blocks of eight 32-bit words, a value picks one block from the top 32 bits of its XXH64 hash, and eight salts turn the bottom 32 bits into one bit per word. A value is definitely absent if any of those eight bits is clear.

var bf = read_bloom_filter(Span(file_bytes), cm)
if bf and not bf.value().might_contain_string("alice"):
    ...  # this row group cannot contain it

Structs

BloomFilter

struct BloomFilter

One column chunk's split-block bloom filter bit set.

Implements Copyable, Defaultable, Movable

Fields
bits: List[UInt8]

__init__

def __init__(out self)
def __init__(out self, var bits: List[UInt8])

num_blocks

def num_blocks(self) -> Int

might_contain_hash

def might_contain_hash(self, hash: UInt64) -> Bool

might_contain_bytes

def might_contain_bytes(self, data: Span[UInt8]) -> Bool

might_contain_string

def might_contain_string(self, text: StringSpan) -> Bool

might_contain_i32

def might_contain_i32(self, v: Int32) -> Bool

might_contain_i64

def might_contain_i64(self, v: Int64) -> Bool

might_contain_f32

def might_contain_f32(self, v: Float32) -> Bool

might_contain_f64

def might_contain_f64(self, v: Float64) -> Bool

might_contain

def might_contain(self, value: ScalarValue) -> Bool

Hash a ScalarValue the way Parquet's PLAIN encoding would.

Functions

read_bloom_filter

def read_bloom_filter(file: Span[UInt8], cm: ColumnMetaData) -> Optional[BloomFilter]

Read the bloom filter of one column chunk, or None if it has none.

Aliases

comptime BLOOM_BLOCK_BYTES = 32
comptime SALT0 = UInt32(1203114875)
comptime SALT1 = UInt32(1150766481)
comptime SALT2 = UInt32(2284105051)
comptime SALT3 = UInt32(2729912477)
comptime SALT4 = UInt32(1884591559)
comptime SALT5 = UInt32(770785867)
comptime SALT6 = UInt32(2667333959)
comptime SALT7 = UInt32(1550580529)