From 7ed63c79ce33cc39c9af845ab30d0b96192d5f7d Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Mon, 4 Jan 2021 11:41:19 +0800 Subject: [PATCH] Remove system field of describle_collection in proxy Signed-off-by: zhenshan.cao --- internal/master/collection_task.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/internal/master/collection_task.go b/internal/master/collection_task.go index ced3f9f93a..fbf4e7a281 100644 --- a/internal/master/collection_task.go +++ b/internal/master/collection_task.go @@ -215,6 +215,21 @@ func (t *describeCollectionTask) Ts() (Timestamp, error) { return t.req.Timestamp, nil } +func (t *describeCollectionTask) filterSchema() error { + // remove system field + var newFields []*schemapb.FieldSchema + for _, fieldMeta := range t.description.Schema.Fields { + fieldID := fieldMeta.FieldID + // todo not hardcode + if fieldID < 100 { + continue + } + newFields = append(newFields, fieldMeta) + } + t.description.Schema.Fields = newFields + return nil +} + func (t *describeCollectionTask) Execute() error { if t.req == nil { return errors.New("null request") @@ -225,10 +240,9 @@ func (t *describeCollectionTask) Execute() error { if err != nil { return err } - - t.description.Schema = collection.Schema - - return nil + cloneSchema := proto.Clone(collection.Schema) + t.description.Schema = cloneSchema.(*schemapb.CollectionSchema) + return t.filterSchema() }