Skip to content

Commit 0a5a6fa

Browse files
Update find_best_task.go
Adjustment to 7.5 codebase
1 parent f65b438 commit 0a5a6fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/planner/core/find_best_task.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ func compareIndexBack(lhs, rhs *candidatePath) (int, bool) {
741741

742742
// compareCandidates is the core of skyline pruning, which is used to decide which candidate path is better.
743743
// The return value is 1 if lhs is better, -1 if rhs is better, 0 if they are equivalent or not comparable.
744-
func compareCandidates(sctx base.PlanContext, statsTbl *statistics.Table, prop *property.PhysicalProperty, lhs, rhs *candidatePath) int {
744+
func compareCandidates(sctx base.PlanContext, prop *property.PhysicalProperty, lhs, rhs *candidatePath) int {
745745
// Due to #50125, full scan on MVIndex has been disabled, so MVIndex path might lead to 'can't find a proper plan' error at the end.
746746
// Avoid MVIndex path to exclude all other paths and leading to 'can't find a proper plan' error, see #49438 for an example.
747747
if isMVIndexPath(lhs.path) || isMVIndexPath(rhs.path) {
@@ -752,11 +752,11 @@ func compareCandidates(sctx base.PlanContext, statsTbl *statistics.Table, prop *
752752
// has the same or higher number of equal/IN predicates.
753753
lhsHasStatistics := statsTbl.Pseudo
754754
if statsTbl != nil && lhs.path.Index != nil {
755-
lhsHasStatistics = statsTbl.ColAndIdxExistenceMap.HasAnalyzed(lhs.path.Index.ID, true)
755+
lhsHasStatistics = lhs.path.Index.IsAnalyzed()
756756
}
757757
rhsHasStatistics := statsTbl.Pseudo
758758
if statsTbl != nil && rhs.path.Index != nil {
759-
rhsHasStatistics = statsTbl.ColAndIdxExistenceMap.HasAnalyzed(rhs.path.Index.ID, true)
759+
rhsHasStatistics = rhs.path.Index.IsAnalyzed()
760760
}
761761
if !lhs.path.IsTablePath() && !rhs.path.IsTablePath() && // Not a table scan
762762
(lhsHasStatistics || rhsHasStatistics) && // At least one index has statistics
@@ -942,7 +942,7 @@ func (ds *DataSource) skylinePruning(prop *property.PhysicalProperty) []*candida
942942
if candidates[i].path.StoreType == kv.TiFlash {
943943
continue
944944
}
945-
result := compareCandidates(ds.SCtx(), ds.StatisticTable, prop, candidates[i], currentCandidate)
945+
result := compareCandidates(ds.SCtx(), prop, candidates[i], currentCandidate)
946946
if result == 1 {
947947
pruned = true
948948
// We can break here because the current candidate cannot prune others anymore.

0 commit comments

Comments
 (0)