Skip to main content

check

Function check 

Source
pub fn check<B: AsRef<[u8]>>(
    schema: &Schema,
    rows: u64,
    nodes: &[Node],
    buffers: &[B],
) -> Result<()>
Expand description

Checks one batch against the schema it claims to be.

Everything here is a bounds question. If this returns Ok then every offset in the batch is inside the buffer it indexes, every buffer is long enough for the number of slots its array claims, and every array is long enough for the parent that points into it, so the arrays can be read without a read going anywhere it should not.

What it deliberately does not check is whether the values mean anything. A Utf8 column whose bytes are not valid UTF-8 is refused later by Arrow, and it is refused there rather than here because character encoding is a correctness property and not a bounds property: reading a badly encoded string cannot leave the buffer. Splitting it that way keeps the fuzzed surface the one with the silent failure mode.

ยงErrors

Returns the first violation found, naming the rule and the path.