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 LegacyPhysicalDispatch

From Leeroopedia


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

Overview

The legacy physical dispatch module converts protobuf-encoded array descriptions into concrete physical page schedulers for the Lance v2.0 format.

Description

⚠️ DEPRECATED: This is legacy code from the Lance v1/v2.0 format, retained only for backward compatibility. See Lance_format_Lance_Warning_Deprecated_Legacy_Encodings.

This module is the central dispatch point for the legacy (v2.0) Lance file format decoding pipeline. The decoder_from_array_encoding function takes a protobuf ArrayEncoding message and recursively constructs the appropriate PageScheduler tree. It handles all v2.0 encoding variants: Nullable (dispatching to BasicPageScheduler with no-nulls, some-nulls, or all-nulls modes), Flat (dispatching to ValuePageScheduler or DenseBitmapScheduler based on bits-per-value), FixedSizeList, List (offsets), Binary, Fsst, Dictionary, FixedSizeBinary, PackedStruct, Bitpacked, and BitpackedForNonNeg. The get_buffer helper translates protobuf buffer descriptors into file positions using page, column, or file buffer types. The get_buffer_decoder helper creates value or bitmap schedulers from flat encoding descriptors with optional compression support.

Usage

Use this module when building the decoding pipeline from Lance v2.0 file metadata. decoder_from_array_encoding is called by PrimitiveFieldScheduler to create page-level schedulers from the protobuf encoding stored in page metadata. It is the bridge between serialized file metadata and the runtime decoding infrastructure.

Code Reference

Source Location

rust/lance-encoding/src/previous/encodings/physical.rs

Signature

pub fn decoder_from_array_encoding(
    encoding: &pb::ArrayEncoding,
    buffers: &PageBuffers,
    data_type: &DataType,
) -> Box<dyn PageScheduler>;

fn get_buffer(buffer_desc: &pb::Buffer, buffers: &PageBuffers) -> (u64, u64);

fn get_buffer_decoder(
    encoding: &pb::Flat,
    buffers: &PageBuffers,
) -> Box<dyn PageScheduler>;

Import

use lance_encoding::previous::encodings::physical::decoder_from_array_encoding;

I/O Contract

Input Type Description
encoding &pb::ArrayEncoding Protobuf array encoding descriptor from page metadata
buffers &PageBuffers Buffer position mappings (page, column, and file level)
data_type &DataType Arrow data type for the column being decoded
Output Type Description
scheduler Box<dyn PageScheduler> Concrete page scheduler for the specified encoding

Usage Examples

use lance_encoding::previous::encodings::physical::decoder_from_array_encoding;
use lance_encoding::decoder::{PageBuffers, ColumnBuffers, FileBuffers};
use lance_encoding::format::pb;
use arrow_schema::DataType;

// Given protobuf encoding from file metadata
let encoding: pb::ArrayEncoding = /* from page info */;
let buffers = PageBuffers {
    column_buffers: ColumnBuffers {
        file_buffers: FileBuffers {
            positions_and_sizes: &[(0, 4096)],
        },
        positions_and_sizes: &[(4096, 1024)],
    },
    positions_and_sizes: &[(5120, 512)],
};

// Create a page scheduler from the encoding
let scheduler = decoder_from_array_encoding(
    &encoding,
    &buffers,
    &DataType::Int32,
);

Related Pages

Page Connections

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