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

importer: generate int data by histogram #5795

Merged
merged 8 commits into from Feb 6, 2018

Conversation

hanfei1991
Copy link
Member

pending to support more types.

for _, idxInfo := range table.tblInfo.Indices {
offset := idxInfo.Columns[0].Offset
if hist, ok := statsInfo.Indices[idxInfo.ID]; ok {
log.Warnf("index offset %d", offset)
Copy link
Member

Choose a reason for hiding this comment

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

Why log warning?

index *model.IndexInfo
}

func (h *histogram) getRandomBoundIdx() int {
Copy link
Member

Choose a reason for hiding this comment

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

Please add comments about the difference between odd and even index.

@hanfei1991
Copy link
Member Author

@coocood PTAL

@coocood
Copy link
Member

coocood commented Feb 6, 2018

LGTM

Copy link
Contributor

@WangXiangUSTC WangXiangUSTC left a comment

Choose a reason for hiding this comment

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

rest LGTM

// When the cnt falls in the middle of bucket, we return the idx of lower bound which is an even number.
// When the cnt falls in the end of bucket, we return the upper bound which is odd.
func (h *histogram) getRandomBoundIdx() int {
cnt := h.Buckets[len(h.Buckets)-1].Count
Copy link
Contributor

Choose a reason for hiding this comment

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

is that possible len(h.Buckets) = 0 ? this may cause panic

@hanfei1991
Copy link
Member Author

@WangXiangUSTC fixed by checking len of buckets after decoding stats file. PTAL

@WangXiangUSTC
Copy link
Contributor

LGTM

@hanfei1991 hanfei1991 merged commit 8578ad2 into pingcap:master Feb 6, 2018
@hanfei1991 hanfei1991 deleted the gen_by_stats branch February 6, 2018 10:15
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