Skip to content

Commit e77692e

Browse files
committed
fix maxAddedRows
1 parent e7b3d0a commit e77692e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/statistics/histogram.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,7 @@ func (hg *Histogram) OutOfRangeRowCount(
11911191
// but deleted from the other, resulting in qualifying out of range rows even though
11921192
// realtimeRowCount is less than histogram count
11931193
addedRows := hg.AbsRowCountDifference(realtimeRowCount)
1194+
maxAddedRows := addedRows
11941195
totalPercent := min(leftPercent*0.5+rightPercent*0.5, 1.0)
11951196

11961197
// maxTotalPercent is the maximum out of range percentage that is used for MaxEst.
@@ -1221,9 +1222,8 @@ func (hg *Histogram) OutOfRangeRowCount(
12211222
}
12221223
// Use outOfRangeBetweenRate as a divisor to get a small percentage of the approximate
12231224
// modifyCount (since outOfRangeBetweenRate has a default value of 100).
1224-
addedRows = max(addedRows, float64(realtimeRowCount)/outOfRangeBetweenRate)
1225+
maxAddedRows = max(maxAddedRows, float64(realtimeRowCount)/outOfRangeBetweenRate)
12251226
}
1226-
maxAddedRows := addedRows
12271227
if maxTotalPercent > 0 {
12281228
// Always apply maxTotalPercent to maxAddedRows (matching old behavior where addedRows was always scaled)
12291229
maxAddedRows *= maxTotalPercent

0 commit comments

Comments
 (0)