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

ddl: check only the range type partition #7599

Merged
merged 7 commits into from
Sep 6, 2018

Conversation

ciscoxll
Copy link
Contributor

@ciscoxll ciscoxll commented Sep 4, 2018

What problem does this PR solve?

What is changed and how it works?

  • Only range type partition is now supported.
  • Other partition types only implement the parser so they will not be checked.
  • Add some tests for different partition types.

Check List

Tests

  • Unit test

@tiancaiamao @zimulala @crazycs520 PTAL .

@winkyao
Copy link
Contributor

winkyao commented Sep 4, 2018

Please fix conlicts。

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

reset LGTM

@ciscoxll ciscoxll force-pushed the check-range-partition branch from 19d3082 to 0a586a8 Compare September 4, 2018 09:13
@ciscoxll
Copy link
Contributor Author

ciscoxll commented Sep 4, 2018

@winkyao PTAL.

@ciscoxll
Copy link
Contributor Author

ciscoxll commented Sep 5, 2018

@tiancaiamao @zimulala @crazycs520 PTAL .

@ciscoxll ciscoxll changed the title ddl:restrict the check partition function to check only the rang partition ddl:restrict the check partition function to check only the range partition Sep 5, 2018
ddl/db_test.go Outdated
@@ -1711,6 +1711,54 @@ func (s *testDBSuite) TestCreateTableWithPartition(c *C) {
partition p3 values less than (18446744073709551000 + 1),
partition p4 values less than (18446744073709551000 + 10)
);`)

// Support partitioned by range columns later "ERROR HY000: Field 'a' is of a not allowed type for this type of partitioning".
Copy link
Member

Choose a reason for hiding this comment

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

What is the relationship between the comment and the following case?

(partition p0 values less than (0));`)
}

func (s *testDBSuite) TestCreateTableWithHashPartition(c *C) {
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this test case?

Copy link
Contributor

Choose a reason for hiding this comment

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

Check grammar compatibility for different table partition type? @shenli

ddl/ddl_api.go Outdated
}
if pi != nil && pi.Type == model.PartitionTypeRange {
// Check partition by range.
if s.Partition.ColumnNames == nil {
Copy link
Member

Choose a reason for hiding this comment

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

From the title, I can tell there is only one constraint on the checking "restrict the check partition function to check only the rang partition". But I find another constraint here.

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao added status/LGT1 Indicates that a PR has LGTM 1. and removed status/WIP labels Sep 5, 2018
@tiancaiamao
Copy link
Contributor

/run-all-tests

@ciscoxll ciscoxll changed the title ddl:restrict the check partition function to check only the range partition ddl:checks only the range type partition Sep 6, 2018
@ciscoxll ciscoxll force-pushed the check-range-partition branch from bed6b62 to 3a48f55 Compare September 6, 2018 06:28
@ciscoxll
Copy link
Contributor Author

ciscoxll commented Sep 6, 2018

@CaitinChen PTAL.

@ciscoxll ciscoxll changed the title ddl:checks only the range type partition ddl:check only the range type partition Sep 6, 2018
ddl/db_test.go Outdated
@@ -1711,6 +1711,55 @@ func (s *testDBSuite) TestCreateTableWithPartition(c *C) {
partition p3 values less than (18446744073709551000 + 1),
partition p4 values less than (18446744073709551000 + 10)
);`)

// Only range type partition are now supported, range columns partition only implement parser so do not check.
Copy link
Contributor

Choose a reason for hiding this comment

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

Only range type partition is now supported. Range columns partition only implements the parser, so it will not be checked.

ddl/db_test.go Outdated
@@ -1711,6 +1711,55 @@ func (s *testDBSuite) TestCreateTableWithPartition(c *C) {
partition p3 values less than (18446744073709551000 + 1),
partition p4 values less than (18446744073709551000 + 10)
);`)

// Only range type partition are now supported, range columns partition only implement parser so do not check.
// So executing the following sql can be executed successfully.
Copy link
Contributor

Choose a reason for hiding this comment

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

So the following SQL statements can be executed successfully.

ddl/ddl_api.go Outdated
return errors.Trace(err)
}
if pi != nil && pi.Type == model.PartitionTypeRange {
// Only range type partition are now supported.
Copy link
Contributor

Choose a reason for hiding this comment

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

Only range type partition is now supported.

ddl/ddl_api.go Outdated
}
if pi != nil && pi.Type == model.PartitionTypeRange {
// Only range type partition are now supported.
// Range columns partition only implement parser so do not check.
Copy link
Contributor

Choose a reason for hiding this comment

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

Range columns partition only implements the parser, so it will not be checked.

@CaitinChen
Copy link
Contributor

CaitinChen commented Sep 6, 2018

What is changed and how it works?

Only range type partition is now supported.
Other partition types only implement the parser so they will not be checked.
Add some tests for different partition types.

@ciscoxll
Copy link
Contributor Author

ciscoxll commented Sep 6, 2018

@CaitinChen Thanks for your guidance.

@CaitinChen
Copy link
Contributor

@ciscoxll My pleasure

@ciscoxll
Copy link
Contributor Author

ciscoxll commented Sep 6, 2018

@shenli PTAL.

@coocood
Copy link
Member

coocood commented Sep 6, 2018

LGTM

@coocood coocood added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 6, 2018
@shenli
Copy link
Member

shenli commented Sep 6, 2018

/run-all-tests

Copy link
Member

@shenli shenli left a comment

Choose a reason for hiding this comment

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

LGTM

@ciscoxll ciscoxll added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT2 Indicates that a PR has LGTM 2. labels Sep 6, 2018
@shenli shenli changed the title ddl:check only the range type partition ddl: check only the range type partition Sep 6, 2018
@ciscoxll ciscoxll merged commit 7c6c279 into pingcap:master Sep 6, 2018
@ciscoxll ciscoxll deleted the check-range-partition branch September 6, 2018 08:55
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
@you06 you06 added the sig/sql-infra SIG: SQL Infra label Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. sig/sql-infra SIG: SQL Infra status/LGT3 The PR has already had 3 LGTM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants