New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ranger, stats: remove Align method of IndexRange. #5240
Conversation
f1d62a1
to
a17d6e2
Compare
@@ -631,12 +631,12 @@ func (s *testStatisticsSuite) TestIndexRanges(c *C) { | |||
ran[0].HighVal[0] = types.NewIntDatum(2000) | |||
count, err = tbl.GetRowCountByIndexRanges(sc, 0, ran) | |||
c.Assert(err, IsNil) | |||
c.Assert(int(count), Equals, 999) | |||
c.Assert(int(count), Equals, 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the real count is 1000.
ran[0].LowVal[0] = types.NewIntDatum(1001) | ||
ran[0].HighVal[0] = types.NewIntDatum(1990) | ||
count, err = tbl.GetRowCountByIndexRanges(sc, 0, ran) | ||
c.Assert(err, IsNil) | ||
c.Assert(int(count), Equals, 988) | ||
c.Assert(int(count), Equals, 989) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the real count is 990.
/run-integration-common-test |
statistics/histogram.go
Outdated
@@ -581,7 +582,7 @@ func (idx *Index) equalRowCount(sc *stmtctx.StatementContext, b []byte) (float64 | |||
func (idx *Index) getRowCount(sc *stmtctx.StatementContext, indexRanges []*ranger.IndexRange) (float64, error) { | |||
totalCount := float64(0) | |||
for _, indexRange := range indexRanges { | |||
indexRange.Align(len(idx.Info.Columns)) | |||
isPoint := len(indexRange.LowVal) == len(indexRange.HighVal) && len(indexRange.LowVal) == len(idx.Info.Columns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is isPoint
a little miss leading? Maybe isFullRange
is better. Also, you can put this declaration near where it is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We don't need this method.
PTAL @hanfei1991 @coocood @lamxTyler