Skip to content

Commit a6789fd

Browse files
authored
planner: fix incorrect estRows with global index and json column (#55842) (#55924)
close #55818
1 parent 5165e3a commit a6789fd

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

pkg/statistics/table.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,11 @@ func (coll *HistColl) GetScaledRealtimeAndModifyCnt(idxStats *Index) (realtimeCn
596596
if analyzeRowCount <= 0 {
597597
return coll.RealtimeCount, coll.ModifyCount
598598
}
599-
scale := idxStats.TotalRowCount() / analyzeRowCount
599+
idxTotalRowCount := idxStats.TotalRowCount()
600+
if idxTotalRowCount <= 0 {
601+
return coll.RealtimeCount, coll.ModifyCount
602+
}
603+
scale := idxTotalRowCount / analyzeRowCount
600604
return int64(float64(coll.RealtimeCount) * scale), int64(float64(coll.ModifyCount) * scale)
601605
}
602606

tests/integrationtest/r/planner/core/issuetest/planner_issue.result

Lines changed: 49 additions & 0 deletions
Large diffs are not rendered by default.

tests/integrationtest/t/planner/core/issuetest/planner_issue.test

Lines changed: 43 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)