schemapb 中 int8 和 int16 标量字段的表示

问题描述 投票:0回答:1

查看

schema.proto
中的 Proto 定义,我发现标量字段允许使用以下类型:

message ScalarField {
  oneof data {
    BoolArray bool_data = 1;
    IntArray int_data = 2;
    LongArray long_data = 3;
    FloatArray float_data = 4;
    DoubleArray double_data = 5;
    StringArray string_data = 6;
    BytesArray bytes_data = 7;
    ArrayArray array_data = 8;
    JSONArray json_data = 9;
  }
}

具体来说,在整数类型中,

Int
Long
是仅有的两种可用类型。然而,Milvus 还支持
Int8
Int16
类型,并且看起来这些也使用
IntArray
来表示。

Milvus 到底是如何在

int8
切片中存储
int16
[]int32
类型的?是否发生任何打包(即四个
int8
存储在单个
int32
索引中)或者每个
int8
int16
占用了全部 4 个字节的空间?

database vector-database milvus
1个回答
0
投票

proto 的数据类型仅支持 (u)int32 和 (u)int64: https://protobuf.dev/programming-guides/proto3/#scalar

因此,int8/int16 值在 RPC 层由 int32 传输。

在客户端应用程序中,您输入 int8 值,然后将值编码为 int32 值,并通过 RPC 通道传输。在服务器端,int32 值被解码为 int8 值并存储到存储中。

© www.soinside.com 2019 - 2024. All rights reserved.