Skip to content

Commit

Permalink
Support the dynamic column
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <[email protected]>
  • Loading branch information
SimFG committed Nov 29, 2023
1 parent d1df1d6 commit 382433e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions client/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -89,6 +91,7 @@ func (c *GrpcClient) processInsertColumns(colSchema *entity.Schema, columns ...e
mNameField := make(map[string]*entity.Field)
for _, field := range colSchema.Fields {
mNameField[field.Name] = field
println("field name:", field.Name)
}
mNameColumn := make(map[string]entity.Column)
var dynamicColumns []entity.Column
Expand Down Expand Up @@ -159,6 +162,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

Check warning on line 168 in client/insert.go

View check run for this annotation

Codecov / codecov/patch

client/insert.go#L166-L168

Added lines #L166 - L168 were not covered by tests
}

values := make([][]byte, 0, rowSize)
for i := 0; i < rowSize; i++ {
m := make(map[string]interface{})
Expand Down

0 comments on commit 382433e

Please sign in to comment.