From 700a443e85da46b58707aea3b7ddff3570ddd4cf Mon Sep 17 00:00:00 2001 From: congqixia Date: Wed, 11 Sep 2024 17:43:06 +0800 Subject: [PATCH] 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 --- internal/parser/planparserv2/plan_parser_v2.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/parser/planparserv2/plan_parser_v2.go b/internal/parser/planparserv2/plan_parser_v2.go index ac57bdbbc7..b6123141d5 100644 --- a/internal/parser/planparserv2/plan_parser_v2.go +++ b/internal/parser/planparserv2/plan_parser_v2.go @@ -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