Schema 格式规范
本文系统定义了 Lance 表的 schema 规范:逻辑类型体系、字段 ID 分配规则、字段元数据语义,以及与 Apache Arrow 类型系统的映射关系。 核心要点:schema 以字符串逻辑类型表达类型语义,并覆盖 primitive、decimal、time/timestamp、complex、extensi…
Reprint Notice(转载提示):本文转载自 https://lance.org/format/table/schema/。 原文标题:Schema Format Specification。 原文语言:English。本文为中文翻译版本,英文原文已作为 content_en 保留。Schema 格式规范概述 该 Schema 描述了 Lance 表的结构,包括所有字段、它们的数据类型和元数据。 Schema 使用逻辑类型系统,其中数据类型表示为映射到 Apache Arrow 数据类型的字符串。 Schema 中的每个字段都有一个唯一的标识符(字段 ID),可实现稳健的模式演变和版本跟踪。 注意 目前正在通过讨论简化逻辑类型 #5864。 提议的更改包括合并特定于编码的变体(例如 large_string 和 string、large_binary 和 binary) 通过运行时优化将其转换为单一逻辑类型。此外,#5817 建议添加 string_view 和 binary_view 类型。本文档描述了当前的实现。数据类型 Lance 支持映射到 Apache Arrow 类型的一组全面的数据类型。 数据类型在架构中表示为字符串,并且可以分为几个类别。原始类型 | Logical Type | Arrow Type | Description | |---|---|---| | null | Null | Null type (no values) | | bool | Boolean | Boolean (true/false) | | int8 | Int8 | Signed 8-bit integer | | uint8 | UInt8 | Unsigned 8-bit integer | | int16 | Int16 | Signed 16-bit integer | | uint16 | UInt16 | Unsigned 16-bit integer | | int32 | Int32 | Signed 32-bit integer | | uint32 | UInt32 | Unsigned 32-bit integer | | int64 | Int64 | Signed 64-bit integer | | uint64 | UInt64 | Unsigned 64-bit integer |浮点类型 | Logical Type | Arrow Type | Description | |---|---|---| | halffloat | Float16 | IEEE 754 half-precision floating point (16-bit) | | float | Float32 | IEEE 754 single-precision floating point (32-bit) | | double | Float64 | IEEE 754 double-precision floating point (64-bit) |字符串和二进制类型 | Logical Type | Arrow Type | Description | |---|---|---| | string | Utf8 | Variable-length UTF-8 encoded string | | binary | Binary | Variable-length binary data | | large_string | LargeUtf8 | Variable-length UTF-8 string (supports large offsets) | | large_binary | LargeBinary | Variable-length binary data (supports large offsets) |小数类型 小数类型支持任意精度的数值。格式为:decimal:<bit_width>:<precision>:<scale> | Logical Type | Arrow Type | Precision | Example | |---|---|---|---| | decimal:128:P:S | Decimal128 | Up to 38 digits | decimal:128:10:2 (10 total digits, 2 after decimal) | | decimal:256:P:S | Decimal256 | Up to 76 digits | decimal:256:20:5 |精度 (P):总位数(Decimal128 为 1-38,Decimal25…
正在初始化 WebAssembly 引擎…
首次编译原生模块可能需要数秒
就绪后,页面交互将以接近原生的速度运行