Forbid counting entities with pagination (#23375)

Signed-off-by: longjiquan <jiquan.long@zilliz.com>
pull/23387/head
Jiquan Long 2023-04-12 14:22:34 +08:00 committed by GitHub
parent 496f596e92
commit a940df94c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -332,6 +332,11 @@ func (t *queryTask) PreExecute(ctx context.Context) error {
return err
}
// count with pagination
if t.plan.GetQuery().GetIsCount() && t.queryParams.limit != typeutil.Unlimited {
return fmt.Errorf("count entities with pagination is not allowed")
}
if t.plan.GetQuery().GetIsCount() {
t.RetrieveRequest.IsCount = true
}