enhance: Check ANN field loaded in proxy (#36172)

Related to #35415

Currently ANN field is loaded in Parital load is not performed in proxy,
this cause error message not clear and no error returned when collection
is empty

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2024-09-11 17:43:06 +08:00 committed by GitHub
parent e7ea1d7a04
commit 700a443e85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ import (
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
"github.com/milvus-io/milvus/internal/proto/planpb"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/merr"
"github.com/milvus-io/milvus/pkg/util/typeutil"
)
@ -124,6 +125,10 @@ func CreateSearchPlan(schema *typeutil.SchemaHelper, exprStr string, vectorField
log.Info("CreateSearchPlan failed", zap.Error(err))
return nil, err
}
// plan ok with schema, check ann field
if !schema.IsFieldLoaded(vectorField.GetFieldID()) {
return nil, merr.WrapErrParameterInvalidMsg("ann field \"%s\" not loaded", vectorFieldName)
}
fieldID := vectorField.FieldID
dataType := vectorField.DataType