2
SET @@session.storage_engine = 'ndbcluster';
4
#------------------------------------------------------------------------
5
# There are several testcases disabled because of the open bugs
8
# The expected results suffer from the following bugs
9
# harmless #17455, #19305
10
# which cannot be suppressed because of technical reasons.
11
#------------------------------------------------------------------------
13
#------------------------------------------------------------------------
14
# 0. Setting of auxiliary variables + Creation of an auxiliary tables
15
# needed in many testcases
16
#------------------------------------------------------------------------
17
SELECT @max_row DIV 2 INTO @max_row_div2;
18
SELECT @max_row DIV 3 INTO @max_row_div3;
19
SELECT @max_row DIV 4 INTO @max_row_div4;
20
SET @max_int_4 = 2147483647;
21
DROP TABLE IF EXISTS t0_template;
22
CREATE TABLE t0_template (
27
f_charbig VARCHAR(1000) ,
30
# Logging of <max_row> INSERTs into t0_template suppressed
31
DROP TABLE IF EXISTS t0_definition;
32
CREATE TABLE t0_definition (
34
create_command VARBINARY(5000),
35
file_list VARBINARY(5000),
38
DROP TABLE IF EXISTS t0_aux;
39
CREATE TABLE t0_aux ( f_int1 INTEGER,
43
f_charbig VARCHAR(1000) )
46
SET @@session.sql_mode= '';
47
# End of basic preparations needed for all tests
48
#-----------------------------------------------
50
#========================================================================
51
# Calculation of "exotic" results within the partition function
52
# outside of SIGNED BIGINT value range, 0, NULL
53
# column used in partitioning function has type CHAR
54
#========================================================================
55
# 1. HASH(<check value>)
56
DROP TABLE IF EXISTS t1;
62
f_charbig VARCHAR(1000)
64
PARTITION BY HASH(CAST(f_char1 AS SIGNED INTEGER) * CAST(5.0E+18 AS SIGNED INTEGER)) PARTITIONS 8;
65
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
66
VALUES(2147483646,2147483646,'2147483646','2147483646','#2147483646#');
67
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '2147483646';
70
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
71
VALUES(-2147483646,-2147483646,'-2147483646','-2147483646','#-2147483646#');
72
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '-2147483646';
75
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
76
VALUES(0,0,'0','0','#0#');
77
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '0';
80
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
81
VALUES(NULL,NULL,NULL,NULL,NULL);
82
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 IS NULL;
86
# 2. RANGE(<check value>)
92
f_charbig VARCHAR(1000)
94
PARTITION BY RANGE(CAST(f_char1 AS SIGNED INTEGER) * CAST(5.0E+18 AS SIGNED INTEGER))
95
(PARTITION p0 VALUES LESS THAN (0),
96
PARTITION p1 VALUES LESS THAN (1000000),
97
PARTITION p2 VALUES LESS THAN MAXVALUE);
98
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
99
VALUES(2147483646,2147483646,'2147483646','2147483646','#2147483646#');
100
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '2147483646';
103
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
104
VALUES(-2147483646,-2147483646,'-2147483646','-2147483646','#-2147483646#');
105
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '-2147483646';
108
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
109
VALUES(0,0,'0','0','#0#');
110
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 = '0';
113
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
114
VALUES(NULL,NULL,NULL,NULL,NULL);
115
SELECT COUNT(*) = 1 FROM t1 WHERE f_char1 IS NULL;
119
# 4. Partition by RANGE(...) subpartition by HASH(<check value>)
125
f_charbig VARCHAR(1000)
127
PARTITION BY RANGE(CAST(f_char1 AS SIGNED INTEGER))
128
SUBPARTITION BY HASH(CAST(f_char2 AS SIGNED INTEGER) * CAST(5.0E+18 AS SIGNED INTEGER)) SUBPARTITIONS 4
129
(PARTITION p0 VALUES LESS THAN (0),
130
PARTITION p1 VALUES LESS THAN MAXVALUE);
131
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
132
VALUES(2147483646,2147483646,'1','2147483646','#2147483646#');
133
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '2147483646';
136
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
137
VALUES(-2147483646,-2147483646,'-1','-2147483646','#-2147483646#');
138
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '-2147483646';
141
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
142
VALUES(0,0,'0','0','#0#');
143
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '0';
146
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
147
VALUES(NULL,NULL,NULL,NULL,NULL);
148
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 IS NULL;
152
# 5. Partition by LIST(...) subpartition by HASH(<check value>)
158
f_charbig VARCHAR(1000)
160
PARTITION BY LIST(CAST(f_char1 AS SIGNED INTEGER))
161
SUBPARTITION BY HASH(CAST(f_char2 AS SIGNED INTEGER) * CAST(5.0E+18 AS SIGNED INTEGER)) SUBPARTITIONS 4
162
(PARTITION p0 VALUES IN (NULL),
163
PARTITION p1 VALUES IN (1));
164
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
165
VALUES(2147483646,2147483646,'1','2147483646','#2147483646#');
166
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '2147483646';
169
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
170
VALUES(-2147483646,-2147483646,'1','-2147483646','#-2147483646#');
171
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '-2147483646';
174
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
175
VALUES(0,0,'1','0','#0#');
176
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 = '0';
179
INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig)
180
VALUES(NULL,NULL,NULL,NULL,NULL);
181
SELECT COUNT(*) = 1 FROM t1 WHERE f_char2 IS NULL;
185
DROP VIEW IF EXISTS v1;
186
DROP TABLE IF EXISTS t1;
187
DROP TABLE IF EXISTS t0_aux;
188
DROP TABLE IF EXISTS t0_definition;
189
DROP TABLE IF EXISTS t0_template;