From 8b794f7fe1484cfad785c9c6c845061570b6e942 Mon Sep 17 00:00:00 2001 From: SimFG Date: Thu, 30 Nov 2023 00:26:09 +0800 Subject: [PATCH] Support the dynamic column Signed-off-by: SimFG --- client/insert.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/insert.go b/client/insert.go index fe24db40..bd4d3922 100644 --- a/client/insert.go +++ b/client/insert.go @@ -26,6 +26,8 @@ import ( "github.com/milvus-io/milvus-sdk-go/v2/entity" ) +const MetaFieldName = "$meta" + // Insert Index into collection with column-based format // collName is the collection name // partitionName is the partition to insert, if not specified(empty), default partition will be used @@ -159,6 +161,12 @@ func (c *GrpcClient) processInsertColumns(colSchema *entity.Schema, columns ...e } func (c *GrpcClient) mergeDynamicColumns(dynamicName string, rowSize int, columns []entity.Column) (*schemapb.FieldData, error) { + if len(columns) == 1 && columns[0].Name() == MetaFieldName { + data := columns[0].FieldData() + data.FieldName = dynamicName + return data, nil + } + values := make([][]byte, 0, rowSize) for i := 0; i < rowSize; i++ { m := make(map[string]interface{})