更新时间:2026-07-09 GMT+08:00
分享

Lance表支持的数据类型介绍

表1 Lance支持的数据类型

Lance数据类型

说明

null

空类型(无值)

bool

布尔值(true/false)

int8, int16, int32, int64

有符号8位、16位、32位、64位整数

uint8, uint16, uint32, uint64

无符号8位、16位、32位、64位整数

halffloat

IEEE 754半精度浮点数(16位)

float

IEEE 754单精度浮点数(32位)

double

IEEE 754双精度浮点数(64位)

string

变长UTF-8编码字符串

large_string

变长UTF-8字符串(支持大偏移量)

binary

变长二进制数据

large_binary

变长二进制数据(支持大偏移量)

decimal:128:p:s

decimal:<位宽>:<精度>:<标度>。精度(p)为总位数(Decimal128最多38位),小数位数(s)为小数点后的位数(0 ≤ S ≤ P)

decimal:256:p:s

decimal:<位宽>:<精度>:<标度>。精度(p)为总位数(Decimal256最多76位),小数位数(s)为小数点后的位数(0 ≤ S ≤ P)

date32:day

日期(自纪元以来的天数)

date64:ms

日期(自纪元以来的毫秒数)

time32:s, time32:ms

时间(自午夜以来的秒数), 时间(自午夜以来的毫秒数)

time64:us, time64:ns

时间(自午夜以来的微秒数), 时间(自午夜以来的纳秒数)

timestamp:unit:tz

timestamp:<单位>:<时区>,单位可选s(秒)、ms(毫秒)、us(微秒)、ns(纳秒)。时区为IANA时区字符串(如UTC、America/New_York)或-表示无时区

duration:s, duration:ms, duration:us, duration:ns

时长(秒), 时长(毫秒),时长(微秒),时长(纳秒)

struct

嵌套类型

list 或 list.struct(如果元素为 Struct)

变长值列表,变长结构体值列表

large_list 或 large_list.struct

变长列表(支持大偏移量),变长结构体值列表(大偏移量)

fixed_size_list:type:size

特别适用于向量嵌入,如fixed_size_list:float:128 表示128 个浮点数的定长列表

fixed_size_binary:size

如fixed_size_binary:16用于MD5哈希,fixed_size_binary:32用于SHA-256哈希

dict:value_type:key_type:bool

字典值的类型

dict:<值类型>:<键类型>:<是否有序>,dict:string:int16:false 表示使用 int16 键的字典编码字符串

map

键值对(目前仅支持无序键)

相关文档