planner: bug fix for compareCandidates (#64525)

ref pingcap/tidb#64378
This commit is contained in:
tpp
2025-11-18 03:29:35 -08:00
committed by GitHub
parent 88177db856
commit 52cb3dc3b4

View File

@ -918,7 +918,7 @@ func compareCandidates(sctx base.PlanContext, statsTbl *statistics.Table, prop *
if riskResult > 0 && leftDidNotLose && totalSum >= 0 && predicateResult > 1 {
return 1, lhsPseudo // left wins - also return whether it has statistics (pseudo) or not
}
if riskResult < 0 && rightDidNotLose && totalSum <= 0 && predicateResult < 1 {
if riskResult < 0 && rightDidNotLose && totalSum <= 0 && predicateResult < -1 {
return -1, rhsPseudo // right wins - also return whether it has statistics (pseudo) or not
}
return 0, false // No winner (0). Do not return the pseudo result