From cace3edf54e8d1c72e89cf544f7a589d3fcd5960 Mon Sep 17 00:00:00 2001 From: Mattias Jonsson Date: Wed, 19 May 2021 11:07:47 +0200 Subject: [PATCH] add test for partition range boundaries with BETWEEN queries. Rebased all test changes to resolve conflicts, no changes. --- executor/partition_table_test.go | 102 +- executor/testdata/executor_suite_in.json | 131 +++ executor/testdata/executor_suite_out.json | 1167 +++++++++++++++++++++ 3 files changed, 1372 insertions(+), 28 deletions(-) diff --git a/executor/partition_table_test.go b/executor/partition_table_test.go index cb5414d91815f..37fd76a053383 100644 --- a/executor/partition_table_test.go +++ b/executor/partition_table_test.go @@ -1453,6 +1453,38 @@ func (s *globalIndexSuite) TestIssue21731(c *C) { 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));") } +type testOutput struct { + SQL string + Plan []string + Res []string +} + +func (s *testSuiteWithData) verifyPartitionResult(tk *testkit.TestKit, input []string, output []testOutput) { + for i, tt := range input { + var isSelect bool = false + if strings.HasPrefix(strings.ToLower(tt), "select ") { + isSelect = true + } + s.testData.OnRecord(func() { + output[i].SQL = tt + if isSelect { + output[i].Plan = s.testData.ConvertRowsToStrings(tk.UsedPartitions(tt).Rows()) + output[i].Res = s.testData.ConvertRowsToStrings(tk.MustQuery(tt).Sort().Rows()) + } else { + // Just verify SELECT (also avoid double INSERTs during record) + output[i].Res = nil + output[i].Plan = nil + } + }) + if isSelect { + tk.UsedPartitions(tt).Check(testkit.Rows(output[i].Plan...)) + tk.MustQuery(tt).Sort().Check(testkit.Rows(output[i].Res...)) + } else { + tk.MustExec(tt) + } + } +} + func (s *testSuiteWithData) TestRangePartitionBoundariesEq(c *C) { tk := testkit.NewTestKit(c, s.store) @@ -1475,12 +1507,6 @@ PARTITION BY RANGE (a) ( s.verifyPartitionResult(tk, input, output) } -type testOutput struct { - SQL string - Plan []string - Res []string -} - func (s *testSuiteWithData) TestRangePartitionBoundariesNe(c *C) { tk := testkit.NewTestKit(c, s.store) @@ -1506,26 +1532,46 @@ PARTITION BY RANGE (a) ( s.verifyPartitionResult(tk, input, output) } -func (s *testSuiteWithData) verifyPartitionResult(tk *testkit.TestKit, input []string, output []testOutput) { - for i, tt := range input { - var isSelect bool = false - if strings.HasPrefix(strings.ToLower(tt), "select ") { - isSelect = true - } - s.testData.OnRecord(func() { - output[i].SQL = tt - if isSelect { - output[i].Plan = s.testData.ConvertRowsToStrings(tk.UsedPartitions(tt).Rows()) - output[i].Res = s.testData.ConvertRowsToStrings(tk.MustQuery(tt).Sort().Rows()) - } else { - // to avoid double execution of INSERT (and INSERT does not return anything) - output[i].Res = nil - output[i].Plan = nil - } - }) - if isSelect { - tk.UsedPartitions(tt).Check(testkit.Rows(output[i].Plan...)) - } - tk.MayQuery(tt).Sort().Check(testkit.Rows(output[i].Res...)) - } +func (s *testSuiteWithData) TestRangePartitionBoundariesBetweenM(c *C) { + tk := testkit.NewTestKit(c, s.store) + + tk.MustExec("CREATE DATABASE IF NOT EXISTS TestRangePartitionBoundariesBetweenM") + defer tk.MustExec("DROP DATABASE TestRangePartitionBoundariesBetweenM") + tk.MustExec("USE TestRangePartitionBoundariesBetweenM") + tk.MustExec("DROP TABLE IF EXISTS t") + tk.MustExec(`CREATE TABLE t +(a INT, b varchar(255)) +PARTITION BY RANGE (a) ( + PARTITION p0 VALUES LESS THAN (1000000), + PARTITION p1 VALUES LESS THAN (2000000), + PARTITION p2 VALUES LESS THAN (3000000))`) + + var input []string + var output []testOutput + s.testData.GetTestCases(c, &input, &output) + s.verifyPartitionResult(tk, input, output) +} + +func (s *testSuiteWithData) TestRangePartitionBoundariesBetweenS(c *C) { + tk := testkit.NewTestKit(c, s.store) + + tk.MustExec("CREATE DATABASE IF NOT EXISTS TestRangePartitionBoundariesBetweenS") + defer tk.MustExec("DROP DATABASE TestRangePartitionBoundariesBetweenS") + tk.MustExec("USE TestRangePartitionBoundariesBetweenS") + tk.MustExec("DROP TABLE IF EXISTS t") + tk.MustExec(`CREATE TABLE t +(a INT, b varchar(255)) +PARTITION BY RANGE (a) ( + PARTITION p0 VALUES LESS THAN (1), + PARTITION p1 VALUES LESS THAN (2), + PARTITION p2 VALUES LESS THAN (3), + PARTITION p3 VALUES LESS THAN (4), + PARTITION p4 VALUES LESS THAN (5), + PARTITION p5 VALUES LESS THAN (6), + PARTITION p6 VALUES LESS THAN (7))`) + + var input []string + var output []testOutput + s.testData.GetTestCases(c, &input, &output) + s.verifyPartitionResult(tk, input, output) } diff --git a/executor/testdata/executor_suite_in.json b/executor/testdata/executor_suite_in.json index fff3187717f0a..a8db9425a7078 100644 --- a/executor/testdata/executor_suite_in.json +++ b/executor/testdata/executor_suite_in.json @@ -142,5 +142,136 @@ "SELECT * FROM t WHERE a NOT IN (-2, -1, 0, 1, 2, 3, 4, 5, 6, 7)", "SELECT * FROM t WHERE 1 = 0 OR a = -1 OR a = 0 OR a = 1 OR a = 2 OR a = 3 OR a = 4 OR a = 5 OR a = 6 OR a = 7" ] + }, + { + "name": "TestRangePartitionBoundariesBetweenM", + "cases": [ + "INSERT INTO t VALUES (999998, '999998 Filler ...'), (999999, '999999 Filler ...'), (1000000, '1000000 Filler ...'), (1000001, '1000001 Filler ...'), (1000002, '1000002 Filler ...')", + "INSERT INTO t VALUES (1999998, '1999998 Filler ...'), (1999999, '1999999 Filler ...'), (2000000, '2000000 Filler ...'), (2000001, '2000001 Filler ...'), (2000002, '2000002 Filler ...')", + "INSERT INTO t VALUES (2999998, '2999998 Filler ...'), (2999999, '2999999 Filler ...')", + "INSERT INTO t VALUES (-2147483648, 'MIN_INT filler...'), (0, '0 Filler...')", + "ANALYZE TABLE t", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483649", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483648", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483647", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483646", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483638", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483650", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483649", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483648", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483647", + "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483646", + "SELECT * FROM t WHERE a BETWEEN 0 AND -1", + "SELECT * FROM t WHERE a BETWEEN 0 AND 0", + "SELECT * FROM t WHERE a BETWEEN 0 AND 1", + "SELECT * FROM t WHERE a BETWEEN 0 AND 2", + "SELECT * FROM t WHERE a BETWEEN 0 AND 10", + "SELECT * FROM t WHERE a BETWEEN 0 AND 999998", + "SELECT * FROM t WHERE a BETWEEN 0 AND 999999", + "SELECT * FROM t WHERE a BETWEEN 0 AND 1000000", + "SELECT * FROM t WHERE a BETWEEN 0 AND 1000001", + "SELECT * FROM t WHERE a BETWEEN 0 AND 1000002", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 999997", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 999998", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 999999", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1000000", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1000008", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999996", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999997", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999998", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999999", + "SELECT * FROM t WHERE a BETWEEN 999998 AND 2000000", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 999998", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 999999", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000000", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000001", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000009", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999997", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999998", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999999", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 2000000", + "SELECT * FROM t WHERE a BETWEEN 999999 AND 2000001", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 999999", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000000", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000001", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000002", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000010", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1999998", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1999999", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000000", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000001", + "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000002", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000000", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000001", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000002", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000003", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000011", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1999999", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000000", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000001", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000002", + "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000003", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000001", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000002", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000003", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000004", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000012", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000000", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000001", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000002", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000003", + "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000004", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 2999999", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000000", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000001", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000002", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000010", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3999998", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3999999", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000000", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000001", + "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000002", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000000", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000001", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000002", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000003", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000011", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3999999", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000000", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000001", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000002", + "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000003" + ] + }, + { + "name": "TestRangePartitionBoundariesBetweenS", + "cases": [ + "INSERT INTO t VALUES (0, '0 Filler...')", + "INSERT INTO t VALUES (1, '1 Filler...')", + "INSERT INTO t VALUES (2, '2 Filler...')", + "INSERT INTO t VALUES (3, '3 Filler...')", + "INSERT INTO t VALUES (4, '4 Filler...')", + "INSERT INTO t VALUES (5, '5 Filler...')", + "INSERT INTO t VALUES (6, '6 Filler...')", + "ANALYZE TABLE t", + "SELECT * FROM t WHERE a BETWEEN 2 AND -1", + "SELECT * FROM t WHERE a BETWEEN -1 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 0", + "SELECT * FROM t WHERE a BETWEEN 0 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 1", + "SELECT * FROM t WHERE a BETWEEN 1 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 2", + "SELECT * FROM t WHERE a BETWEEN 2 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 3", + "SELECT * FROM t WHERE a BETWEEN 3 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 4", + "SELECT * FROM t WHERE a BETWEEN 4 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 5", + "SELECT * FROM t WHERE a BETWEEN 5 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 6", + "SELECT * FROM t WHERE a BETWEEN 6 AND 4", + "SELECT * FROM t WHERE a BETWEEN 2 AND 7", + "SELECT * FROM t WHERE a BETWEEN 7 AND 4" + ] } ] diff --git a/executor/testdata/executor_suite_out.json b/executor/testdata/executor_suite_out.json index caa5c4f948966..bd5fbdb486ac0 100644 --- a/executor/testdata/executor_suite_out.json +++ b/executor/testdata/executor_suite_out.json @@ -1395,5 +1395,1172 @@ ] } ] + }, + { + "Name": "TestRangePartitionBoundariesBetweenM", + "Cases": [ + { + "SQL": "INSERT INTO t VALUES (999998, '999998 Filler ...'), (999999, '999999 Filler ...'), (1000000, '1000000 Filler ...'), (1000001, '1000001 Filler ...'), (1000002, '1000002 Filler ...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (1999998, '1999998 Filler ...'), (1999999, '1999999 Filler ...'), (2000000, '2000000 Filler ...'), (2000001, '2000001 Filler ...'), (2000002, '2000002 Filler ...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (2999998, '2999998 Filler ...'), (2999999, '2999999 Filler ...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (-2147483648, 'MIN_INT filler...'), (0, '0 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "ANALYZE TABLE t", + "Plan": null, + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483649", + "Plan": [ + "p0" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483648", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483647", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483646", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2147483638", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483650", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483649", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483648", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483647", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -2147483648 AND -2146483646", + "Plan": [ + "p0" + ], + "Res": [ + "-2147483648 MIN_INT filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND -1", + "Plan": [ + "p0" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 0", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 1", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 2", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 10", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 999998", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler...", + "999998 999998 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 999999", + "Plan": [ + "p0" + ], + "Res": [ + "0 0 Filler...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 1000000", + "Plan": [ + "p0 p1" + ], + "Res": [ + "0 0 Filler...", + "1000000 1000000 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 1000001", + "Plan": [ + "p0 p1" + ], + "Res": [ + "0 0 Filler...", + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 1000002", + "Plan": [ + "p0 p1" + ], + "Res": [ + "0 0 Filler...", + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 999997", + "Plan": [ + "p0" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 999998", + "Plan": [ + "p0" + ], + "Res": [ + "999998 999998 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 999999", + "Plan": [ + "p0" + ], + "Res": [ + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1000000", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1000008", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999996", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999997", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999998", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 1999999", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999998 AND 2000000", + "Plan": [ + "all" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "999998 999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 999998", + "Plan": [ + "p0" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 999999", + "Plan": [ + "p0" + ], + "Res": [ + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000000", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000001", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1000009", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999997", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999998", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 1999999", + "Plan": [ + "p0 p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 2000000", + "Plan": [ + "all" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 999999 AND 2000001", + "Plan": [ + "all" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "999999 999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 999999", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000000", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000001", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000002", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1000010", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1999998", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 1999999", + "Plan": [ + "p1" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000000", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000001", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000000 AND 2000002", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000000 1000000 Filler ...", + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000000", + "Plan": [ + "p1" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000001", + "Plan": [ + "p1" + ], + "Res": [ + "1000001 1000001 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000002", + "Plan": [ + "p1" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000003", + "Plan": [ + "p1" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1000011", + "Plan": [ + "p1" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 1999999", + "Plan": [ + "p1" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000000", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000001", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000002", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000001 AND 2000003", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000001 1000001 Filler ...", + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000001", + "Plan": [ + "p1" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000002", + "Plan": [ + "p1" + ], + "Res": [ + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000003", + "Plan": [ + "p1" + ], + "Res": [ + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000004", + "Plan": [ + "p1" + ], + "Res": [ + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 1000012", + "Plan": [ + "p1" + ], + "Res": [ + "1000002 1000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000000", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000001", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000002", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000003", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1000002 AND 2000004", + "Plan": [ + "p1 p2" + ], + "Res": [ + "1000002 1000002 Filler ...", + "1999998 1999998 Filler ...", + "1999999 1999999 Filler ...", + "2000000 2000000 Filler ...", + "2000001 2000001 Filler ...", + "2000002 2000002 Filler ..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 2999999", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000000", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000001", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000002", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3000010", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3999998", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 3999999", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000000", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000001", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000000 AND 4000002", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000000", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000001", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000002", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000003", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3000011", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 3999999", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000000", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000001", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000002", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3000001 AND 4000003", + "Plan": [ + "dual" + ], + "Res": null + } + ] + }, + { + "Name": "TestRangePartitionBoundariesBetweenS", + "Cases": [ + { + "SQL": "INSERT INTO t VALUES (0, '0 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (1, '1 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (2, '2 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (3, '3 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (4, '4 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (5, '5 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "INSERT INTO t VALUES (6, '6 Filler...')", + "Plan": null, + "Res": null + }, + { + "SQL": "ANALYZE TABLE t", + "Plan": null, + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND -1", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN -1 AND 4", + "Plan": [ + "p0 p1 p2 p3 p4" + ], + "Res": [ + "0 0 Filler...", + "1 1 Filler...", + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 0", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 0 AND 4", + "Plan": [ + "p0 p1 p2 p3 p4" + ], + "Res": [ + "0 0 Filler...", + "1 1 Filler...", + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 1", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 1 AND 4", + "Plan": [ + "p1 p2 p3 p4" + ], + "Res": [ + "1 1 Filler...", + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 2", + "Plan": [ + "p2" + ], + "Res": [ + "2 2 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 4", + "Plan": [ + "p2 p3 p4" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 3", + "Plan": [ + "p2 p3" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 3 AND 4", + "Plan": [ + "p3 p4" + ], + "Res": [ + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 4", + "Plan": [ + "p2 p3 p4" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 4 AND 4", + "Plan": [ + "p4" + ], + "Res": [ + "4 4 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 5", + "Plan": [ + "p2 p3 p4 p5" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler...", + "5 5 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 5 AND 4", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 6", + "Plan": [ + "p2 p3 p4 p5 p6" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler...", + "5 5 Filler...", + "6 6 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 6 AND 4", + "Plan": [ + "dual" + ], + "Res": null + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 2 AND 7", + "Plan": [ + "p2 p3 p4 p5 p6" + ], + "Res": [ + "2 2 Filler...", + "3 3 Filler...", + "4 4 Filler...", + "5 5 Filler...", + "6 6 Filler..." + ] + }, + { + "SQL": "SELECT * FROM t WHERE a BETWEEN 7 AND 4", + "Plan": [ + "dual" + ], + "Res": null + } + ] } ]