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

cmd/importer: support probability in building incremental column #10454

Merged
merged 7 commits into from
May 15, 2019

Conversation

eurekaka
Copy link
Contributor

@eurekaka eurekaka commented May 14, 2019

What problem does this PR solve?

Generate column values in incremental order mostly, but with some exceptions controlled by input parameter.

What is changed and how it works?

Support new rule probability=xxx which should be used together with incremental, to control the exceptions in overall incremental order.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
run script:
./bin/importer -t "create table t(a date comment '[[incremental=1;repeats=3;step=-1;probability=80]]');" -c 1 -n 10 -P 4000

check table rows:
mysql> select * from t;
+------------+
| a          |
+------------+
| 2019-05-14 |
| 2019-05-02 |
| 2019-05-13 |
| 2019-06-05 |
| 2019-05-13 |
| 2019-05-12 |
| 2019-05-12 |
| 2019-08-26 |
| 2019-05-11 |
| 2019-05-11 |
+------------+
10 rows in set (0.00 sec)

Code changes

N/A

Side effects

N/A

Related changes

N/A

@eurekaka eurekaka added type/enhancement The issue or PR belongs to an enhancement. component/tools labels May 14, 2019
@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

Merging #10454 into master will decrease coverage by 0.0043%.
The diff coverage is n/a.

@@               Coverage Diff                @@
##             master     #10454        +/-   ##
================================================
- Coverage   77.3086%   77.3043%   -0.0044%     
================================================
  Files           412        412                
  Lines         86575      86629        +54     
================================================
+ Hits          66930      66968        +38     
- Misses        14503      14512         +9     
- Partials       5142       5149         +7

cmd/importer/README.md Outdated Show resolved Hide resolved
d.minIntValue = min
d.maxIntValue = max
d.useRange = true
if d.step < 0 {
Copy link
Member

Choose a reason for hiding this comment

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

should we specially handle 0 step?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If step is 0, we can use range or set rule, instead of incremental?

Copy link
Member

Choose a reason for hiding this comment

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

@lamxTyler How do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

0 step also makes senses, for example, we only want constant data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but if we want constant data, we don't need to use incremental, a better way is using set?

Copy link
Member

Choose a reason for hiding this comment

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

I prefer to do this optimization in the future, for now, let's make it work.

cmd/importer/data.go Outdated Show resolved Hide resolved
@XuHuaiyu
Copy link
Contributor

please IGNORE this comment
/run-all-tests tidb-test=pr/814

@XuHuaiyu
Copy link
Contributor

/run-all-tests tidb-test=pr/814

@eurekaka eurekaka requested review from zz-jason and alivxxx May 14, 2019 09:28
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

@alivxxx alivxxx added the status/LGT1 Indicates that a PR has LGTM 1. label May 15, 2019
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 15, 2019
@zz-jason zz-jason merged commit 480c605 into pingcap:master May 15, 2019
@eurekaka eurekaka deleted the desc_rand branch May 15, 2019 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/tools status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants