Skip to main content

check_dictionary

Function check_dictionary 

Source
pub fn check_dictionary(
    keys: &[u8],
    key_type: &DataType,
    len: u64,
    dictionary_len: u64,
    path: &str,
) -> Result<()>
Expand description

Checks that every key is a slot in the dictionary.

The case worth naming is a key equal to the dictionary’s length, which is in range for the arithmetic and one past the end of the data, and is what an off by one in a decoder produces.

§Errors

Returns a violation of Invariant::DictionaryIndex for a key that is negative or not less than dictionary_len, of Invariant::BufferLength if the keys buffer is short, and of Invariant::Unsupported if the key type is not an integer.