Describe collection by collection ID (#9471)

Signed-off-by: dragondriver <jiquan.long@zilliz.com>
This commit is contained in:
dragondriver 2021-10-09 16:10:56 +08:00 committed by GitHub
parent 28a90f9e7a
commit 302ca04d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -2636,10 +2636,11 @@ func (dct *describeCollectionTask) PreExecute(ctx context.Context) error {
dct.Base.MsgType = commonpb.MsgType_DescribeCollection
dct.Base.SourceID = Params.ProxyID
if err := ValidateCollectionName(dct.CollectionName); err != nil {
return err
if dct.CollectionID != 0 && len(dct.CollectionName) == 0 {
return nil
}
return nil
return ValidateCollectionName(dct.CollectionName)
}
func (dct *describeCollectionTask) Execute(ctx context.Context) error {

View File

@ -1311,7 +1311,14 @@ func TestDescribeCollectionTask(t *testing.T) {
err = task.PreExecute(ctx)
assert.NotNil(t, err)
// describe collection with id
task.CollectionID = 1
task.CollectionName = ""
err = task.PreExecute(ctx)
assert.NoError(t, err)
rc.Stop()
task.CollectionID = 0
task.CollectionName = collectionName
err = task.PreExecute(ctx)
assert.Nil(t, err)