Skip to content

Commit b0a4c07

Browse files
committed
always add bestHist to bestStat
1 parent a2ed59d commit b0a4c07

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sql/analyzer/costed_index_scan.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,13 @@ func getCostedIndexScan(ctx *sql.Context, statsProv sql.StatsProvider, rt sql.Ta
309309
retFilters = b.leftover
310310
}
311311

312-
var bestStat sql.Statistic
312+
bestStat, err := c.bestStat.WithHistogram(c.bestHist)
313+
if err != nil {
314+
return nil, nil, nil, err
315+
}
313316
if c.bestStat.FuncDeps().HasMax1Row() {
314317
bestStat = c.bestStat.WithRowCount(1).WithDistinctCount(1)
315318
} else {
316-
bestStat, err = c.bestStat.WithHistogram(c.bestHist)
317-
if err != nil {
318-
return nil, nil, nil, err
319-
}
320319
bestStat = stats.UpdateCounts(bestStat)
321320
}
322321

0 commit comments

Comments
 (0)