Skip to content
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

Merged
merged 5 commits into from Nov 28, 2017

Conversation

winoros
Copy link
Member

@winoros winoros commented Nov 28, 2017

We don't need this method.
PTAL @hanfei1991 @coocood @lamxTyler

@@ -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)
Copy link
Member Author

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)
Copy link
Member Author

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.

@winoros
Copy link
Member Author

winoros commented Nov 28, 2017

/run-integration-common-test

@@ -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)
Copy link
Contributor

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.

Copy link
Member

@hanfei1991 hanfei1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hanfei1991 hanfei1991 merged commit 62b4b0f into pingcap:master Nov 28, 2017
@winoros winoros deleted the remove-method branch December 25, 2017 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants