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

sessionctx: enable list partition by default #34954

Merged
merged 3 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions executor/partition_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,12 +899,12 @@ func TestGlobalStatsAndSQLBinding(t *testing.T) {
partition p2 values less than (600),
partition p3 values less than (800),
partition p4 values less than (1001))`)
tk.MustExec(`create table tlist(a int, b int, key(a)) partition by list (a) (
tk.MustExec(`create table tlist (a int, b int, key(a)) partition by list (a) (
partition p0 values in (0, 1, 2, 3, 4, 5, 6, 7, 8, 9),
partition p0 values in (10, 11, 12, 13, 14, 15, 16, 17, 18, 19),
partition p0 values in (20, 21, 22, 23, 24, 25, 26, 27, 28, 29),
partition p0 values in (30, 31, 32, 33, 34, 35, 36, 37, 38, 39),
partition p0 values in (40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50))`)
partition p1 values in (10, 11, 12, 13, 14, 15, 16, 17, 18, 19),
partition p2 values in (20, 21, 22, 23, 24, 25, 26, 27, 28, 29),
partition p3 values in (30, 31, 32, 33, 34, 35, 36, 37, 38, 39),
partition p4 values in (40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50))`)

// construct some special data distribution
vals := make([]string, 0, 1000)
Expand Down Expand Up @@ -3019,6 +3019,8 @@ func TestIssue21731(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("drop table if exists p, t")
tk.MustExec("set @@tidb_enable_list_partition = OFF")
// Notice that this does not really test the issue #21731
tk.MustExec("create table t (a int, b int, unique index idx(a)) partition by list columns(b) (partition p0 values in (1), partition p1 values in (2));")
}

Expand Down
1 change: 1 addition & 0 deletions planner/core/integration_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,7 @@ func TestIssue27070(t *testing.T) {
tk := testkit.NewTestKit(t, store)
tk.MustExec("create database issue_27070")
tk.MustExec("use issue_27070")
tk.MustExec("set @@tidb_enable_list_partition = OFF")
tk.MustExec(`create table if not exists t (id int, create_date date NOT NULL DEFAULT '2000-01-01', PRIMARY KEY (id,create_date) ) PARTITION BY list COLUMNS(create_date) ( PARTITION p20210506 VALUES IN ("20210507"), PARTITION p20210507 VALUES IN ("20210508") )`)
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 8200 Unsupported partition type LIST, treat as normal table"))
}
Expand Down
2 changes: 1 addition & 1 deletion planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ func TestPartitionTableDynamicModeUnderNewCollation(t *testing.T) {
tk.MustQuery("select * from strrange where a in ('a', 'y')").Sort().Check(testkit.Rows("A 1", "Y 1", "a 1", "y 1"))

// list partition and partitioned by utf8mb4_general_ci
tk.MustExec(`create table strlist(a varchar(10) charset utf8mb4 collate utf8mb4_general_ci, b int) partition by list(a) (
tk.MustExec(`create table strlist(a varchar(10) charset utf8mb4 collate utf8mb4_general_ci, b int) partition by list columns (a) (
partition p0 values in ('a', 'b'),
partition p1 values in ('c', 'd'),
partition p2 values in ('e', 'f'))`)
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ var defaultSysVars = []*SysVar{
s.EnableTablePartition = val
return nil
}},
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEnableListTablePartition, Value: Off, Type: TypeBool, SetSession: func(s *SessionVars, val string) error {
{Scope: ScopeGlobal | ScopeSession, Name: TiDBEnableListTablePartition, Value: On, Type: TypeBool, SetSession: func(s *SessionVars, val string) error {
morgo marked this conversation as resolved.
Show resolved Hide resolved
s.EnableListTablePartition = TiDBOptOn(val)
return nil
}},
Expand Down