diff --git a/pkg/planner/core/find_best_task.go b/pkg/planner/core/find_best_task.go index db5575dd4b..ea8564e325 100644 --- a/pkg/planner/core/find_best_task.go +++ b/pkg/planner/core/find_best_task.go @@ -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