Skip to content

Commit

Permalink
planner: do not set AnnQuery when TopK = MaxUint32 (#57307)
Browse files Browse the repository at this point in the history
ref #54245
  • Loading branch information
Lloyd-Pottiger authored Nov 29, 2024
1 parent 5753106 commit cbf34b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/planner/core/plan_to_pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package core

import (
"fmt"
"math"

"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/expression"
Expand Down Expand Up @@ -273,7 +274,7 @@ func (p *PhysicalTableScan) ToPB(ctx *base.BuildPBContext, storeType kv.StoreTyp
tsExec.PushedDownFilterConditions = conditions
}

if p.AnnIndexExtra != nil && p.AnnIndexExtra.PushDownQueryInfo != nil {
if p.AnnIndexExtra != nil && p.AnnIndexExtra.PushDownQueryInfo != nil && p.AnnIndexExtra.PushDownQueryInfo.TopK != math.MaxUint32 {
annQueryCopy := *p.AnnIndexExtra.PushDownQueryInfo
tsExec.AnnQuery = &annQueryCopy
}
Expand Down Expand Up @@ -318,7 +319,7 @@ func (p *PhysicalTableScan) partitionTableScanToPBForFlash(ctx *base.BuildPBCont

ptsExec.Desc = p.Desc

if p.AnnIndexExtra != nil && p.AnnIndexExtra.PushDownQueryInfo != nil {
if p.AnnIndexExtra != nil && p.AnnIndexExtra.PushDownQueryInfo != nil && p.AnnIndexExtra.PushDownQueryInfo.TopK != math.MaxUint32 {
annQueryCopy := *p.AnnIndexExtra.PushDownQueryInfo
ptsExec.AnnQuery = &annQueryCopy
}
Expand Down

0 comments on commit cbf34b0

Please sign in to comment.