Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lance format Lance EncodingFuzzTests

From Leeroopedia


Knowledge Sources
Domains Encoding, Testing
Last Updated 2026-02-08 19:33 GMT

Overview

EncodingFuzzTests provides comprehensive property-based fuzz testing for Lance 2.1 encoding, covering 16 encoding permutations across data types, structures, and compression modes using proptest.

Description

This module implements property-based testing to ensure correct round-trip behavior across all supported encoding configurations. Tests are generated from the Cartesian product of:

  • Encoding type: Miniblock or FullZip
  • Data structure: Primitive, List, or FixedSizeList (with variable dimensions 1-100)
  • Data width: Fixed-width (Int8, Int16, Int32, Int64, UInt8-UInt64, Float16, Float32, Float64, FixedBinary) or Variable-width (String, Binary, LargeString, LargeBinary)
  • Nullable: true or false

Invalid combinations are filtered out (e.g., FSL with variable-width types). The EncodingTestConfig struct builds appropriate Arrow Field and DataType definitions, and lance_datagen generates random test data. Each test verifies round-trip correctness using check_round_trip_encoding_of_data.

Usage

These tests are run as part of the Lance test suite to verify encoding correctness across all supported type and encoding combinations. Run with cargo test -p lance-encoding fuzz_tests.

Code Reference

Source Location Repository: lance-format/lance, File: rust/lance-encoding/src/encodings/fuzz_tests.rs, Lines: 1-546
Signature
#[derive(Debug, Clone)]
struct EncodingTestConfig {
    encoding_type: EncodingType,
    data_structure: DataStructure,
    data_width: DataWidth,
    nullable: bool,
}

#[derive(Debug, Clone, PartialEq)]
enum EncodingType {
    Miniblock,
    FullZip,
}

#[derive(Debug, Clone, PartialEq)]
enum DataStructure {
    Primitive,
    List,
    FixedSizeList(i32),
}

fn encoding_config_strategy() -> impl Strategy<Value = EncodingTestConfig>;
Import use lance_encoding::encodings::fuzz_tests; (test-only module)

I/O Contract

Direction Type Description
Input EncodingTestConfig Configuration specifying encoding type, data shape, and nullability
Input Generated RecordBatch Random test data from lance_datagen
Output Round-trip verification Asserts encoded-then-decoded data matches the original

Usage Examples

// Fuzz tests are run via proptest:
// cargo test -p lance-encoding fuzz_tests

// The test framework generates random configs like:
// EncodingTestConfig {
//     encoding_type: Miniblock,
//     data_structure: List,
//     data_width: Fixed(Int32),
//     nullable: true,
// }
// Then verifies round-trip encoding correctness.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment