1
-------------------------------------------------------------------------
2
--- abs(col1) in partition with coltype int
3
-------------------------------------------------------------------------
4
drop table if exists t1 ;
5
drop table if exists t2 ;
6
drop table if exists t3 ;
7
drop table if exists t4 ;
8
drop table if exists t5 ;
9
drop table if exists t6 ;
10
-------------------------------------------------------------------------
11
--- Create tables with abs(col1)
12
-------------------------------------------------------------------------
13
create table t1 (col1 int) engine='NDB'
14
partition by range(abs(col1))
15
(partition p0 values less than (15),
16
partition p1 values less than maxvalue);
17
create table t2 (col1 int) engine='NDB'
18
partition by list(abs(col1))
19
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
20
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
21
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
22
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
23
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
24
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
26
create table t3 (col1 int) engine='NDB'
27
partition by hash(abs(col1));
28
create table t4 (colint int, col1 int) engine='NDB'
29
partition by range(colint)
30
subpartition by hash(abs(col1)) subpartitions 2
31
(partition p0 values less than (15),
32
partition p1 values less than maxvalue);
33
create table t5 (colint int, col1 int) engine='NDB'
34
partition by list(colint)
35
subpartition by hash(abs(col1)) subpartitions 2
36
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
37
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
38
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
39
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
40
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
41
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
43
create table t6 (colint int, col1 int) engine='NDB'
44
partition by range(colint)
45
(partition p0 values less than (abs(15)),
46
partition p1 values less than maxvalue);
47
-------------------------------------------------------------------------
48
--- Access tables with abs(col1)
49
-------------------------------------------------------------------------
50
insert into t1 values (5 );
51
insert into t1 values (13 );
52
insert into t2 values (5 );
53
insert into t2 values (13 );
54
insert into t2 values (17 );
55
insert into t3 values (5 );
56
insert into t3 values (13 );
57
insert into t3 values (17 );
58
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t4;
59
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t5;
60
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_int.in' into table t6;
61
select abs(col1) from t1 order by col1;
65
select * from t1 order by col1;
69
select * from t2 order by col1;
74
select * from t3 order by col1;
79
select * from t4 order by colint;
126
select * from t5 order by colint;
173
select * from t6 order by colint;
220
update t1 set col1=15 where col1=5 ;
221
update t2 set col1=15 where col1=5 ;
222
update t3 set col1=15 where col1=5 ;
223
update t4 set col1=15 where col1=5 ;
224
update t5 set col1=15 where col1=5 ;
225
update t6 set col1=15 where col1=5 ;
226
select * from t1 order by col1;
230
select * from t2 order by col1;
235
select * from t3 order by col1;
240
select * from t4 order by colint;
287
select * from t5 order by colint;
334
select * from t6 order by colint;
381
-------------------------------------------------------------------------
382
--- Alter tables with abs(col1)
383
-------------------------------------------------------------------------
384
drop table if exists t11 ;
385
drop table if exists t22 ;
386
drop table if exists t33 ;
387
drop table if exists t44 ;
388
drop table if exists t55 ;
389
drop table if exists t66 ;
390
create table t11 engine='NDB' as select * from t1;
391
create table t22 engine='NDB' as select * from t2;
392
create table t33 engine='NDB' as select * from t3;
393
create table t44 engine='NDB' as select * from t4;
394
create table t55 engine='NDB' as select * from t5;
395
create table t66 engine='NDB' as select * from t6;
397
partition by range(abs(col1))
398
(partition p0 values less than (15),
399
partition p1 values less than maxvalue);
401
partition by list(abs(col1))
402
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
403
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
404
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
405
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
406
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
407
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
410
partition by hash(abs(col1));
412
partition by range(colint)
413
subpartition by hash(abs(col1)) subpartitions 2
414
(partition p0 values less than (15),
415
partition p1 values less than maxvalue);
417
partition by list(colint)
418
subpartition by hash(abs(col1)) subpartitions 2
419
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
420
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
421
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
422
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
423
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
424
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
427
partition by range(colint)
428
(partition p0 values less than (abs(15)),
429
partition p1 values less than maxvalue);
430
select * from t11 order by col1;
434
select * from t22 order by col1;
439
select * from t33 order by col1;
444
select * from t44 order by colint;
491
select * from t55 order by colint;
538
select * from t66 order by colint;
585
---------------------------
586
---- some alter table begin
587
---------------------------
589
reorganize partition p0,p1 into
590
(partition s1 values less than maxvalue);
591
select * from t11 order by col1;
596
reorganize partition s1 into
597
(partition p0 values less than (15),
598
partition p1 values less than maxvalue);
599
select * from t11 order by col1;
604
partition by list(colint)
605
subpartition by hash(abs(col1)) subpartitions 5
606
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
607
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
608
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
609
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
610
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
611
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
613
show create table t55;
615
t55 CREATE TABLE `t55` (
616
`colint` int(11) DEFAULT NULL,
617
`col1` int(11) DEFAULT NULL
618
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (abs(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
619
select * from t55 order by colint;
667
reorganize partition p0,p1 into
668
(partition s1 values less than maxvalue);
669
select * from t66 order by colint;
717
reorganize partition s1 into
718
(partition p0 values less than (abs(15)),
719
partition p1 values less than maxvalue);
720
select * from t66 order by colint;
768
reorganize partition p0,p1 into
769
(partition s1 values less than maxvalue);
770
select * from t66 order by colint;
818
reorganize partition s1 into
819
(partition p0 values less than (abs(15)),
820
partition p1 values less than maxvalue);
821
select * from t66 order by colint;
868
-------------------------------------------------------------------------
869
--- Delete rows and partitions of tables with abs(col1)
870
-------------------------------------------------------------------------
871
delete from t1 where col1=13 ;
872
delete from t2 where col1=13 ;
873
delete from t3 where col1=13 ;
874
delete from t4 where col1=13 ;
875
delete from t5 where col1=13 ;
876
delete from t6 where col1=13 ;
877
select * from t1 order by col1;
880
select * from t2 order by col1;
884
select * from t3 order by col1;
888
select * from t4 order by colint;
934
select * from t5 order by colint;
980
insert into t1 values (13 );
981
insert into t2 values (13 );
982
insert into t3 values (13 );
983
insert into t4 values (60,13 );
984
insert into t5 values (60,13 );
985
insert into t6 values (60,13 );
986
select * from t1 order by col1;
990
select * from t2 order by col1;
995
select * from t3 order by col1;
1000
select * from t4 order by colint;
1047
select * from t5 order by colint;
1094
select * from t6 order by colint;
1141
alter table t1 drop partition p0;
1142
alter table t2 drop partition p0;
1143
alter table t4 drop partition p0;
1144
alter table t5 drop partition p0;
1145
alter table t6 drop partition p0;
1146
select * from t1 order by col1;
1149
select * from t2 order by col1;
1154
select * from t3 order by col1;
1159
select * from t4 order by colint;
1193
select * from t5 order by colint;
1231
select * from t6 order by colint;
1265
-------------------------------------------------------------------------
1266
--- Delete rows and partitions of tables with abs(col1)
1267
-------------------------------------------------------------------------
1268
delete from t11 where col1=13 ;
1269
delete from t22 where col1=13 ;
1270
delete from t33 where col1=13 ;
1271
delete from t44 where col1=13 ;
1272
delete from t55 where col1=13 ;
1273
delete from t66 where col1=13 ;
1274
select * from t11 order by col1;
1277
select * from t22 order by col1;
1281
select * from t33 order by col1;
1285
select * from t44 order by colint;
1331
select * from t55 order by colint;
1377
insert into t11 values (13 );
1378
insert into t22 values (13 );
1379
insert into t33 values (13 );
1380
insert into t44 values (60,13 );
1381
insert into t55 values (60,13 );
1382
insert into t66 values (60,13 );
1383
select * from t11 order by col1;
1387
select * from t22 order by col1;
1392
select * from t33 order by col1;
1397
select * from t44 order by colint;
1444
select * from t55 order by colint;
1491
select * from t66 order by colint;
1538
alter table t11 drop partition p0;
1539
alter table t22 drop partition p0;
1540
alter table t44 drop partition p0;
1541
alter table t55 drop partition p0;
1542
alter table t66 drop partition p0;
1543
select * from t11 order by col1;
1546
select * from t22 order by col1;
1551
select * from t33 order by col1;
1556
select * from t44 order by colint;
1590
select * from t55 order by colint;
1628
select * from t66 order by colint;
1662
-------------------------
1663
---- some alter table end
1664
-------------------------
1665
drop table if exists t1 ;
1666
drop table if exists t2 ;
1667
drop table if exists t3 ;
1668
drop table if exists t4 ;
1669
drop table if exists t5 ;
1670
drop table if exists t6 ;
1671
drop table if exists t11 ;
1672
drop table if exists t22 ;
1673
drop table if exists t33 ;
1674
drop table if exists t44 ;
1675
drop table if exists t55 ;
1676
drop table if exists t66 ;
1677
-------------------------------------------------------------------------
1678
--- ascii(col1) in partition with coltype char(1)
1679
-------------------------------------------------------------------------
1680
drop table if exists t1 ;
1681
drop table if exists t2 ;
1682
drop table if exists t3 ;
1683
drop table if exists t4 ;
1684
drop table if exists t5 ;
1685
drop table if exists t6 ;
1686
-------------------------------------------------------------------------
1687
--- Create tables with ascii(col1)
1688
-------------------------------------------------------------------------
1689
create table t1 (col1 char(1)) engine='NDB'
1690
partition by range(ascii(col1))
1691
(partition p0 values less than (15),
1692
partition p1 values less than maxvalue);
1693
create table t2 (col1 char(1)) engine='NDB'
1694
partition by list(ascii(col1))
1695
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
1696
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1697
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1698
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1699
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1700
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1702
create table t3 (col1 char(1)) engine='NDB'
1703
partition by hash(ascii(col1));
1704
create table t4 (colint int, col1 char(1)) engine='NDB'
1705
partition by range(colint)
1706
subpartition by hash(ascii(col1)) subpartitions 2
1707
(partition p0 values less than (15),
1708
partition p1 values less than maxvalue);
1709
create table t5 (colint int, col1 char(1)) engine='NDB'
1710
partition by list(colint)
1711
subpartition by hash(ascii(col1)) subpartitions 2
1712
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
1713
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1714
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1715
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1716
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1717
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1719
create table t6 (colint int, col1 char(1)) engine='NDB'
1720
partition by range(colint)
1721
(partition p0 values less than (ascii('5')),
1722
partition p1 values less than maxvalue);
1723
-------------------------------------------------------------------------
1724
--- Access tables with ascii(col1)
1725
-------------------------------------------------------------------------
1726
insert into t1 values ('1');
1727
insert into t1 values ('9');
1728
insert into t2 values ('1');
1729
insert into t2 values ('9');
1730
insert into t2 values ('3');
1731
insert into t3 values ('1');
1732
insert into t3 values ('9');
1733
insert into t3 values ('3');
1734
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
1735
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
1736
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
1737
select ascii(col1) from t1 order by col1;
1741
select * from t1 order by col1;
1745
select * from t2 order by col1;
1750
select * from t3 order by col1;
1755
select * from t4 order by colint;
1761
select * from t5 order by colint;
1767
select * from t6 order by colint;
1773
update t1 set col1='8' where col1='1';
1774
update t2 set col1='8' where col1='1';
1775
update t3 set col1='8' where col1='1';
1776
update t4 set col1='8' where col1='1';
1777
update t5 set col1='8' where col1='1';
1778
update t6 set col1='8' where col1='1';
1779
select * from t1 order by col1;
1783
select * from t2 order by col1;
1788
select * from t3 order by col1;
1793
select * from t4 order by colint;
1799
select * from t5 order by colint;
1805
select * from t6 order by colint;
1811
-------------------------------------------------------------------------
1812
--- Alter tables with ascii(col1)
1813
-------------------------------------------------------------------------
1814
drop table if exists t11 ;
1815
drop table if exists t22 ;
1816
drop table if exists t33 ;
1817
drop table if exists t44 ;
1818
drop table if exists t55 ;
1819
drop table if exists t66 ;
1820
create table t11 engine='NDB' as select * from t1;
1821
create table t22 engine='NDB' as select * from t2;
1822
create table t33 engine='NDB' as select * from t3;
1823
create table t44 engine='NDB' as select * from t4;
1824
create table t55 engine='NDB' as select * from t5;
1825
create table t66 engine='NDB' as select * from t6;
1827
partition by range(ascii(col1))
1828
(partition p0 values less than (15),
1829
partition p1 values less than maxvalue);
1831
partition by list(ascii(col1))
1832
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
1833
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1834
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1835
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1836
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1837
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1840
partition by hash(ascii(col1));
1842
partition by range(colint)
1843
subpartition by hash(ascii(col1)) subpartitions 2
1844
(partition p0 values less than (15),
1845
partition p1 values less than maxvalue);
1847
partition by list(colint)
1848
subpartition by hash(ascii(col1)) subpartitions 2
1849
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
1850
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1851
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1852
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1853
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1854
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1857
partition by range(colint)
1858
(partition p0 values less than (ascii('5')),
1859
partition p1 values less than maxvalue);
1860
select * from t11 order by col1;
1864
select * from t22 order by col1;
1869
select * from t33 order by col1;
1874
select * from t44 order by colint;
1880
select * from t55 order by colint;
1886
select * from t66 order by colint;
1892
---------------------------
1893
---- some alter table begin
1894
---------------------------
1896
reorganize partition p0,p1 into
1897
(partition s1 values less than maxvalue);
1898
select * from t11 order by col1;
1903
reorganize partition s1 into
1904
(partition p0 values less than (15),
1905
partition p1 values less than maxvalue);
1906
select * from t11 order by col1;
1911
partition by list(colint)
1912
subpartition by hash(ascii(col1)) subpartitions 5
1913
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
1914
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
1915
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
1916
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
1917
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
1918
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
1920
show create table t55;
1922
t55 CREATE TABLE `t55` (
1923
`colint` int(11) DEFAULT NULL,
1924
`col1` char(1) DEFAULT NULL
1925
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ascii(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
1926
select * from t55 order by colint;
1933
reorganize partition p0,p1 into
1934
(partition s1 values less than maxvalue);
1935
select * from t66 order by colint;
1942
reorganize partition s1 into
1943
(partition p0 values less than (ascii('5')),
1944
partition p1 values less than maxvalue);
1945
select * from t66 order by colint;
1952
reorganize partition p0,p1 into
1953
(partition s1 values less than maxvalue);
1954
select * from t66 order by colint;
1961
reorganize partition s1 into
1962
(partition p0 values less than (ascii('5')),
1963
partition p1 values less than maxvalue);
1964
select * from t66 order by colint;
1970
-------------------------------------------------------------------------
1971
--- Delete rows and partitions of tables with ascii(col1)
1972
-------------------------------------------------------------------------
1973
delete from t1 where col1='9';
1974
delete from t2 where col1='9';
1975
delete from t3 where col1='9';
1976
delete from t4 where col1='9';
1977
delete from t5 where col1='9';
1978
delete from t6 where col1='9';
1979
select * from t1 order by col1;
1982
select * from t2 order by col1;
1986
select * from t3 order by col1;
1990
select * from t4 order by colint;
1995
select * from t5 order by colint;
2000
insert into t1 values ('9');
2001
insert into t2 values ('9');
2002
insert into t3 values ('9');
2003
insert into t4 values (60,'9');
2004
insert into t5 values (60,'9');
2005
insert into t6 values (60,'9');
2006
select * from t1 order by col1;
2010
select * from t2 order by col1;
2015
select * from t3 order by col1;
2020
select * from t4 order by colint;
2026
select * from t5 order by colint;
2032
select * from t6 order by colint;
2038
alter table t1 drop partition p0;
2039
alter table t2 drop partition p0;
2040
alter table t4 drop partition p0;
2041
alter table t5 drop partition p0;
2042
alter table t6 drop partition p0;
2043
select * from t1 order by col1;
2047
select * from t2 order by col1;
2052
select * from t3 order by col1;
2057
select * from t4 order by colint;
2060
select * from t5 order by colint;
2063
select * from t6 order by colint;
2066
-------------------------------------------------------------------------
2067
--- Delete rows and partitions of tables with ascii(col1)
2068
-------------------------------------------------------------------------
2069
delete from t11 where col1='9';
2070
delete from t22 where col1='9';
2071
delete from t33 where col1='9';
2072
delete from t44 where col1='9';
2073
delete from t55 where col1='9';
2074
delete from t66 where col1='9';
2075
select * from t11 order by col1;
2078
select * from t22 order by col1;
2082
select * from t33 order by col1;
2086
select * from t44 order by colint;
2091
select * from t55 order by colint;
2096
insert into t11 values ('9');
2097
insert into t22 values ('9');
2098
insert into t33 values ('9');
2099
insert into t44 values (60,'9');
2100
insert into t55 values (60,'9');
2101
insert into t66 values (60,'9');
2102
select * from t11 order by col1;
2106
select * from t22 order by col1;
2111
select * from t33 order by col1;
2116
select * from t44 order by colint;
2122
select * from t55 order by colint;
2128
select * from t66 order by colint;
2134
alter table t11 drop partition p0;
2135
alter table t22 drop partition p0;
2136
alter table t44 drop partition p0;
2137
alter table t55 drop partition p0;
2138
alter table t66 drop partition p0;
2139
select * from t11 order by col1;
2143
select * from t22 order by col1;
2148
select * from t33 order by col1;
2153
select * from t44 order by colint;
2156
select * from t55 order by colint;
2159
select * from t66 order by colint;
2162
-------------------------
2163
---- some alter table end
2164
-------------------------
2165
drop table if exists t1 ;
2166
drop table if exists t2 ;
2167
drop table if exists t3 ;
2168
drop table if exists t4 ;
2169
drop table if exists t5 ;
2170
drop table if exists t6 ;
2171
drop table if exists t11 ;
2172
drop table if exists t22 ;
2173
drop table if exists t33 ;
2174
drop table if exists t44 ;
2175
drop table if exists t55 ;
2176
drop table if exists t66 ;
2177
-------------------------------------------------------------------------
2178
--- cast(ceiling(col1) as signed integer) in partition with coltype float(7,4)
2179
-------------------------------------------------------------------------
2180
drop table if exists t1 ;
2181
drop table if exists t2 ;
2182
drop table if exists t3 ;
2183
drop table if exists t4 ;
2184
drop table if exists t5 ;
2185
drop table if exists t6 ;
2186
-------------------------------------------------------------------------
2187
--- Create tables with cast(ceiling(col1) as signed integer)
2188
-------------------------------------------------------------------------
2189
create table t1 (col1 float(7,4)) engine='NDB'
2190
partition by range(cast(ceiling(col1) as signed integer))
2191
(partition p0 values less than (15),
2192
partition p1 values less than maxvalue);
2193
create table t2 (col1 float(7,4)) engine='NDB'
2194
partition by list(cast(ceiling(col1) as signed integer))
2195
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2196
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2197
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2198
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2199
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2200
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2202
create table t3 (col1 float(7,4)) engine='NDB'
2203
partition by hash(cast(ceiling(col1) as signed integer));
2204
create table t4 (colint int, col1 float(7,4)) engine='NDB'
2205
partition by range(colint)
2206
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
2207
(partition p0 values less than (15),
2208
partition p1 values less than maxvalue);
2209
create table t5 (colint int, col1 float(7,4)) engine='NDB'
2210
partition by list(colint)
2211
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
2212
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2213
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2214
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2215
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2216
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2217
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2219
create table t6 (colint int, col1 float(7,4)) engine='NDB'
2220
partition by range(colint)
2221
(partition p0 values less than (cast(ceiling(15) as signed integer)),
2222
partition p1 values less than maxvalue);
2223
-------------------------------------------------------------------------
2224
--- Access tables with cast(ceiling(col1) as signed integer)
2225
-------------------------------------------------------------------------
2226
insert into t1 values (5.1230);
2227
insert into t1 values (13.345);
2228
insert into t2 values (5.1230);
2229
insert into t2 values (13.345);
2230
insert into t2 values (17.987);
2231
insert into t3 values (5.1230);
2232
insert into t3 values (13.345);
2233
insert into t3 values (17.987);
2234
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
2235
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
2236
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
2237
select cast(ceiling(col1) as signed integer) from t1 order by col1;
2238
cast(ceiling(col1) as signed integer)
2241
select * from t1 order by col1;
2245
select * from t2 order by col1;
2250
select * from t3 order by col1;
2255
select * from t4 order by colint;
2261
select * from t5 order by colint;
2267
select * from t6 order by colint;
2273
update t1 set col1=15.654 where col1=5.1230;
2274
update t2 set col1=15.654 where col1=5.1230;
2275
update t3 set col1=15.654 where col1=5.1230;
2276
update t4 set col1=15.654 where col1=5.1230;
2277
update t5 set col1=15.654 where col1=5.1230;
2278
update t6 set col1=15.654 where col1=5.1230;
2279
select * from t1 order by col1;
2283
select * from t2 order by col1;
2288
select * from t3 order by col1;
2293
select * from t4 order by colint;
2299
select * from t5 order by colint;
2305
select * from t6 order by colint;
2311
-------------------------------------------------------------------------
2312
--- Alter tables with cast(ceiling(col1) as signed integer)
2313
-------------------------------------------------------------------------
2314
drop table if exists t11 ;
2315
drop table if exists t22 ;
2316
drop table if exists t33 ;
2317
drop table if exists t44 ;
2318
drop table if exists t55 ;
2319
drop table if exists t66 ;
2320
create table t11 engine='NDB' as select * from t1;
2321
create table t22 engine='NDB' as select * from t2;
2322
create table t33 engine='NDB' as select * from t3;
2323
create table t44 engine='NDB' as select * from t4;
2324
create table t55 engine='NDB' as select * from t5;
2325
create table t66 engine='NDB' as select * from t6;
2327
partition by range(cast(ceiling(col1) as signed integer))
2328
(partition p0 values less than (15),
2329
partition p1 values less than maxvalue);
2331
partition by list(cast(ceiling(col1) as signed integer))
2332
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2333
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2334
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2335
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2336
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2337
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2340
partition by hash(cast(ceiling(col1) as signed integer));
2342
partition by range(colint)
2343
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
2344
(partition p0 values less than (15),
2345
partition p1 values less than maxvalue);
2347
partition by list(colint)
2348
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 2
2349
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2350
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2351
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2352
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2353
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2354
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2357
partition by range(colint)
2358
(partition p0 values less than (cast(ceiling(15) as signed integer)),
2359
partition p1 values less than maxvalue);
2360
select * from t11 order by col1;
2364
select * from t22 order by col1;
2369
select * from t33 order by col1;
2374
select * from t44 order by colint;
2380
select * from t55 order by colint;
2386
select * from t66 order by colint;
2392
---------------------------
2393
---- some alter table begin
2394
---------------------------
2396
reorganize partition p0,p1 into
2397
(partition s1 values less than maxvalue);
2398
select * from t11 order by col1;
2403
reorganize partition s1 into
2404
(partition p0 values less than (15),
2405
partition p1 values less than maxvalue);
2406
select * from t11 order by col1;
2411
partition by list(colint)
2412
subpartition by hash(cast(ceiling(col1) as signed integer)) subpartitions 5
2413
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2414
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2415
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2416
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2417
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2418
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2420
show create table t55;
2422
t55 CREATE TABLE `t55` (
2423
`colint` int(11) DEFAULT NULL,
2424
`col1` float(7,4) DEFAULT NULL
2425
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(ceiling(col1) as signed integer)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
2426
select * from t55 order by colint;
2433
reorganize partition p0,p1 into
2434
(partition s1 values less than maxvalue);
2435
select * from t66 order by colint;
2442
reorganize partition s1 into
2443
(partition p0 values less than (cast(ceiling(15) as signed integer)),
2444
partition p1 values less than maxvalue);
2445
select * from t66 order by colint;
2452
reorganize partition p0,p1 into
2453
(partition s1 values less than maxvalue);
2454
select * from t66 order by colint;
2461
reorganize partition s1 into
2462
(partition p0 values less than (cast(ceiling(15) as signed integer)),
2463
partition p1 values less than maxvalue);
2464
select * from t66 order by colint;
2470
-------------------------------------------------------------------------
2471
--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
2472
-------------------------------------------------------------------------
2473
delete from t1 where col1=13.345;
2474
delete from t2 where col1=13.345;
2475
delete from t3 where col1=13.345;
2476
delete from t4 where col1=13.345;
2477
delete from t5 where col1=13.345;
2478
delete from t6 where col1=13.345;
2479
select * from t1 order by col1;
2482
select * from t2 order by col1;
2486
select * from t3 order by col1;
2490
select * from t4 order by colint;
2495
select * from t5 order by colint;
2500
insert into t1 values (13.345);
2501
insert into t2 values (13.345);
2502
insert into t3 values (13.345);
2503
insert into t4 values (60,13.345);
2504
insert into t5 values (60,13.345);
2505
insert into t6 values (60,13.345);
2506
select * from t1 order by col1;
2510
select * from t2 order by col1;
2515
select * from t3 order by col1;
2520
select * from t4 order by colint;
2526
select * from t5 order by colint;
2532
select * from t6 order by colint;
2538
alter table t1 drop partition p0;
2539
alter table t2 drop partition p0;
2540
alter table t4 drop partition p0;
2541
alter table t5 drop partition p0;
2542
alter table t6 drop partition p0;
2543
select * from t1 order by col1;
2546
select * from t2 order by col1;
2551
select * from t3 order by col1;
2556
select * from t4 order by colint;
2559
select * from t5 order by colint;
2562
select * from t6 order by colint;
2565
-------------------------------------------------------------------------
2566
--- Delete rows and partitions of tables with cast(ceiling(col1) as signed integer)
2567
-------------------------------------------------------------------------
2568
delete from t11 where col1=13.345;
2569
delete from t22 where col1=13.345;
2570
delete from t33 where col1=13.345;
2571
delete from t44 where col1=13.345;
2572
delete from t55 where col1=13.345;
2573
delete from t66 where col1=13.345;
2574
select * from t11 order by col1;
2577
select * from t22 order by col1;
2581
select * from t33 order by col1;
2585
select * from t44 order by colint;
2590
select * from t55 order by colint;
2595
insert into t11 values (13.345);
2596
insert into t22 values (13.345);
2597
insert into t33 values (13.345);
2598
insert into t44 values (60,13.345);
2599
insert into t55 values (60,13.345);
2600
insert into t66 values (60,13.345);
2601
select * from t11 order by col1;
2605
select * from t22 order by col1;
2610
select * from t33 order by col1;
2615
select * from t44 order by colint;
2621
select * from t55 order by colint;
2627
select * from t66 order by colint;
2633
alter table t11 drop partition p0;
2634
alter table t22 drop partition p0;
2635
alter table t44 drop partition p0;
2636
alter table t55 drop partition p0;
2637
alter table t66 drop partition p0;
2638
select * from t11 order by col1;
2641
select * from t22 order by col1;
2646
select * from t33 order by col1;
2651
select * from t44 order by colint;
2654
select * from t55 order by colint;
2657
select * from t66 order by colint;
2660
-------------------------
2661
---- some alter table end
2662
-------------------------
2663
drop table if exists t1 ;
2664
drop table if exists t2 ;
2665
drop table if exists t3 ;
2666
drop table if exists t4 ;
2667
drop table if exists t5 ;
2668
drop table if exists t6 ;
2669
drop table if exists t11 ;
2670
drop table if exists t22 ;
2671
drop table if exists t33 ;
2672
drop table if exists t44 ;
2673
drop table if exists t55 ;
2674
drop table if exists t66 ;
2675
-------------------------------------------------------------------------
2676
--- cast(floor(col1) as signed) in partition with coltype float(7,4)
2677
-------------------------------------------------------------------------
2678
drop table if exists t1 ;
2679
drop table if exists t2 ;
2680
drop table if exists t3 ;
2681
drop table if exists t4 ;
2682
drop table if exists t5 ;
2683
drop table if exists t6 ;
2684
-------------------------------------------------------------------------
2685
--- Create tables with cast(floor(col1) as signed)
2686
-------------------------------------------------------------------------
2687
create table t1 (col1 float(7,4)) engine='NDB'
2688
partition by range(cast(floor(col1) as signed))
2689
(partition p0 values less than (15),
2690
partition p1 values less than maxvalue);
2691
create table t2 (col1 float(7,4)) engine='NDB'
2692
partition by list(cast(floor(col1) as signed))
2693
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2694
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2695
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2696
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2697
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2698
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2700
create table t3 (col1 float(7,4)) engine='NDB'
2701
partition by hash(cast(floor(col1) as signed));
2702
create table t4 (colint int, col1 float(7,4)) engine='NDB'
2703
partition by range(colint)
2704
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
2705
(partition p0 values less than (15),
2706
partition p1 values less than maxvalue);
2707
create table t5 (colint int, col1 float(7,4)) engine='NDB'
2708
partition by list(colint)
2709
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
2710
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2711
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2712
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2713
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2714
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2715
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2717
create table t6 (colint int, col1 float(7,4)) engine='NDB'
2718
partition by range(colint)
2719
(partition p0 values less than (cast(floor(15.123) as signed)),
2720
partition p1 values less than maxvalue);
2721
-------------------------------------------------------------------------
2722
--- Access tables with cast(floor(col1) as signed)
2723
-------------------------------------------------------------------------
2724
insert into t1 values (5.1230);
2725
insert into t1 values (13.345);
2726
insert into t2 values (5.1230);
2727
insert into t2 values (13.345);
2728
insert into t2 values (17.987);
2729
insert into t3 values (5.1230);
2730
insert into t3 values (13.345);
2731
insert into t3 values (17.987);
2732
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
2733
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
2734
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
2735
select cast(floor(col1) as signed) from t1 order by col1;
2736
cast(floor(col1) as signed)
2739
select * from t1 order by col1;
2743
select * from t2 order by col1;
2748
select * from t3 order by col1;
2753
select * from t4 order by colint;
2759
select * from t5 order by colint;
2765
select * from t6 order by colint;
2771
update t1 set col1=15.654 where col1=5.1230;
2772
update t2 set col1=15.654 where col1=5.1230;
2773
update t3 set col1=15.654 where col1=5.1230;
2774
update t4 set col1=15.654 where col1=5.1230;
2775
update t5 set col1=15.654 where col1=5.1230;
2776
update t6 set col1=15.654 where col1=5.1230;
2777
select * from t1 order by col1;
2781
select * from t2 order by col1;
2786
select * from t3 order by col1;
2791
select * from t4 order by colint;
2797
select * from t5 order by colint;
2803
select * from t6 order by colint;
2809
-------------------------------------------------------------------------
2810
--- Alter tables with cast(floor(col1) as signed)
2811
-------------------------------------------------------------------------
2812
drop table if exists t11 ;
2813
drop table if exists t22 ;
2814
drop table if exists t33 ;
2815
drop table if exists t44 ;
2816
drop table if exists t55 ;
2817
drop table if exists t66 ;
2818
create table t11 engine='NDB' as select * from t1;
2819
create table t22 engine='NDB' as select * from t2;
2820
create table t33 engine='NDB' as select * from t3;
2821
create table t44 engine='NDB' as select * from t4;
2822
create table t55 engine='NDB' as select * from t5;
2823
create table t66 engine='NDB' as select * from t6;
2825
partition by range(cast(floor(col1) as signed))
2826
(partition p0 values less than (15),
2827
partition p1 values less than maxvalue);
2829
partition by list(cast(floor(col1) as signed))
2830
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
2831
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2832
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2833
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2834
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2835
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2838
partition by hash(cast(floor(col1) as signed));
2840
partition by range(colint)
2841
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
2842
(partition p0 values less than (15),
2843
partition p1 values less than maxvalue);
2845
partition by list(colint)
2846
subpartition by hash(cast(floor(col1) as signed)) subpartitions 2
2847
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2848
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2849
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2850
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2851
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2852
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2855
partition by range(colint)
2856
(partition p0 values less than (cast(floor(15.123) as signed)),
2857
partition p1 values less than maxvalue);
2858
select * from t11 order by col1;
2862
select * from t22 order by col1;
2867
select * from t33 order by col1;
2872
select * from t44 order by colint;
2878
select * from t55 order by colint;
2884
select * from t66 order by colint;
2890
---------------------------
2891
---- some alter table begin
2892
---------------------------
2894
reorganize partition p0,p1 into
2895
(partition s1 values less than maxvalue);
2896
select * from t11 order by col1;
2901
reorganize partition s1 into
2902
(partition p0 values less than (15),
2903
partition p1 values less than maxvalue);
2904
select * from t11 order by col1;
2909
partition by list(colint)
2910
subpartition by hash(cast(floor(col1) as signed)) subpartitions 5
2911
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
2912
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
2913
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
2914
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
2915
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
2916
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
2918
show create table t55;
2920
t55 CREATE TABLE `t55` (
2921
`colint` int(11) DEFAULT NULL,
2922
`col1` float(7,4) DEFAULT NULL
2923
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(floor(col1) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
2924
select * from t55 order by colint;
2931
reorganize partition p0,p1 into
2932
(partition s1 values less than maxvalue);
2933
select * from t66 order by colint;
2940
reorganize partition s1 into
2941
(partition p0 values less than (cast(floor(15.123) as signed)),
2942
partition p1 values less than maxvalue);
2943
select * from t66 order by colint;
2950
reorganize partition p0,p1 into
2951
(partition s1 values less than maxvalue);
2952
select * from t66 order by colint;
2959
reorganize partition s1 into
2960
(partition p0 values less than (cast(floor(15.123) as signed)),
2961
partition p1 values less than maxvalue);
2962
select * from t66 order by colint;
2968
-------------------------------------------------------------------------
2969
--- Delete rows and partitions of tables with cast(floor(col1) as signed)
2970
-------------------------------------------------------------------------
2971
delete from t1 where col1=13.345;
2972
delete from t2 where col1=13.345;
2973
delete from t3 where col1=13.345;
2974
delete from t4 where col1=13.345;
2975
delete from t5 where col1=13.345;
2976
delete from t6 where col1=13.345;
2977
select * from t1 order by col1;
2980
select * from t2 order by col1;
2984
select * from t3 order by col1;
2988
select * from t4 order by colint;
2993
select * from t5 order by colint;
2998
insert into t1 values (13.345);
2999
insert into t2 values (13.345);
3000
insert into t3 values (13.345);
3001
insert into t4 values (60,13.345);
3002
insert into t5 values (60,13.345);
3003
insert into t6 values (60,13.345);
3004
select * from t1 order by col1;
3008
select * from t2 order by col1;
3013
select * from t3 order by col1;
3018
select * from t4 order by colint;
3024
select * from t5 order by colint;
3030
select * from t6 order by colint;
3036
alter table t1 drop partition p0;
3037
alter table t2 drop partition p0;
3038
alter table t4 drop partition p0;
3039
alter table t5 drop partition p0;
3040
alter table t6 drop partition p0;
3041
select * from t1 order by col1;
3044
select * from t2 order by col1;
3049
select * from t3 order by col1;
3054
select * from t4 order by colint;
3057
select * from t5 order by colint;
3060
select * from t6 order by colint;
3063
-------------------------------------------------------------------------
3064
--- Delete rows and partitions of tables with cast(floor(col1) as signed)
3065
-------------------------------------------------------------------------
3066
delete from t11 where col1=13.345;
3067
delete from t22 where col1=13.345;
3068
delete from t33 where col1=13.345;
3069
delete from t44 where col1=13.345;
3070
delete from t55 where col1=13.345;
3071
delete from t66 where col1=13.345;
3072
select * from t11 order by col1;
3075
select * from t22 order by col1;
3079
select * from t33 order by col1;
3083
select * from t44 order by colint;
3088
select * from t55 order by colint;
3093
insert into t11 values (13.345);
3094
insert into t22 values (13.345);
3095
insert into t33 values (13.345);
3096
insert into t44 values (60,13.345);
3097
insert into t55 values (60,13.345);
3098
insert into t66 values (60,13.345);
3099
select * from t11 order by col1;
3103
select * from t22 order by col1;
3108
select * from t33 order by col1;
3113
select * from t44 order by colint;
3119
select * from t55 order by colint;
3125
select * from t66 order by colint;
3131
alter table t11 drop partition p0;
3132
alter table t22 drop partition p0;
3133
alter table t44 drop partition p0;
3134
alter table t55 drop partition p0;
3135
alter table t66 drop partition p0;
3136
select * from t11 order by col1;
3139
select * from t22 order by col1;
3144
select * from t33 order by col1;
3149
select * from t44 order by colint;
3152
select * from t55 order by colint;
3155
select * from t66 order by colint;
3158
-------------------------
3159
---- some alter table end
3160
-------------------------
3161
drop table if exists t1 ;
3162
drop table if exists t2 ;
3163
drop table if exists t3 ;
3164
drop table if exists t4 ;
3165
drop table if exists t5 ;
3166
drop table if exists t6 ;
3167
drop table if exists t11 ;
3168
drop table if exists t22 ;
3169
drop table if exists t33 ;
3170
drop table if exists t44 ;
3171
drop table if exists t55 ;
3172
drop table if exists t66 ;
3173
-------------------------------------------------------------------------
3174
--- cast(mod(col1,10) as signed) in partition with coltype float(7,4)
3175
-------------------------------------------------------------------------
3176
drop table if exists t1 ;
3177
drop table if exists t2 ;
3178
drop table if exists t3 ;
3179
drop table if exists t4 ;
3180
drop table if exists t5 ;
3181
drop table if exists t6 ;
3182
-------------------------------------------------------------------------
3183
--- Create tables with cast(mod(col1,10) as signed)
3184
-------------------------------------------------------------------------
3185
create table t1 (col1 float(7,4)) engine='NDB'
3186
partition by range(cast(mod(col1,10) as signed))
3187
(partition p0 values less than (15),
3188
partition p1 values less than maxvalue);
3189
create table t2 (col1 float(7,4)) engine='NDB'
3190
partition by list(cast(mod(col1,10) as signed))
3191
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3192
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3193
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3194
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3195
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3196
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3198
create table t3 (col1 float(7,4)) engine='NDB'
3199
partition by hash(cast(mod(col1,10) as signed));
3200
create table t4 (colint int, col1 float(7,4)) engine='NDB'
3201
partition by range(colint)
3202
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
3203
(partition p0 values less than (15),
3204
partition p1 values less than maxvalue);
3205
create table t5 (colint int, col1 float(7,4)) engine='NDB'
3206
partition by list(colint)
3207
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
3208
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3209
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3210
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3211
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3212
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3213
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3215
create table t6 (colint int, col1 float(7,4)) engine='NDB'
3216
partition by range(colint)
3217
(partition p0 values less than (cast(mod(15,10) as signed)),
3218
partition p1 values less than maxvalue);
3219
-------------------------------------------------------------------------
3220
--- Access tables with cast(mod(col1,10) as signed)
3221
-------------------------------------------------------------------------
3222
insert into t1 values (5.0000);
3223
insert into t1 values (19);
3224
insert into t2 values (5.0000);
3225
insert into t2 values (19);
3226
insert into t2 values (17);
3227
insert into t3 values (5.0000);
3228
insert into t3 values (19);
3229
insert into t3 values (17);
3230
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t4;
3231
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t5;
3232
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_float.in' into table t6;
3233
select cast(mod(col1,10) as signed) from t1 order by col1;
3234
cast(mod(col1,10) as signed)
3237
select * from t1 order by col1;
3241
select * from t2 order by col1;
3246
select * from t3 order by col1;
3251
select * from t4 order by colint;
3257
select * from t5 order by colint;
3263
select * from t6 order by colint;
3269
update t1 set col1=15 where col1=5.0000;
3270
update t2 set col1=15 where col1=5.0000;
3271
update t3 set col1=15 where col1=5.0000;
3272
update t4 set col1=15 where col1=5.0000;
3273
update t5 set col1=15 where col1=5.0000;
3274
update t6 set col1=15 where col1=5.0000;
3275
select * from t1 order by col1;
3279
select * from t2 order by col1;
3284
select * from t3 order by col1;
3289
select * from t4 order by colint;
3295
select * from t5 order by colint;
3301
select * from t6 order by colint;
3307
-------------------------------------------------------------------------
3308
--- Alter tables with cast(mod(col1,10) as signed)
3309
-------------------------------------------------------------------------
3310
drop table if exists t11 ;
3311
drop table if exists t22 ;
3312
drop table if exists t33 ;
3313
drop table if exists t44 ;
3314
drop table if exists t55 ;
3315
drop table if exists t66 ;
3316
create table t11 engine='NDB' as select * from t1;
3317
create table t22 engine='NDB' as select * from t2;
3318
create table t33 engine='NDB' as select * from t3;
3319
create table t44 engine='NDB' as select * from t4;
3320
create table t55 engine='NDB' as select * from t5;
3321
create table t66 engine='NDB' as select * from t6;
3323
partition by range(cast(mod(col1,10) as signed))
3324
(partition p0 values less than (15),
3325
partition p1 values less than maxvalue);
3327
partition by list(cast(mod(col1,10) as signed))
3328
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3329
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3330
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3331
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3332
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3333
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3336
partition by hash(cast(mod(col1,10) as signed));
3338
partition by range(colint)
3339
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
3340
(partition p0 values less than (15),
3341
partition p1 values less than maxvalue);
3343
partition by list(colint)
3344
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 2
3345
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3346
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3347
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3348
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3349
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3350
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3353
partition by range(colint)
3354
(partition p0 values less than (cast(mod(15,10) as signed)),
3355
partition p1 values less than maxvalue);
3356
select * from t11 order by col1;
3360
select * from t22 order by col1;
3365
select * from t33 order by col1;
3370
select * from t44 order by colint;
3376
select * from t55 order by colint;
3382
select * from t66 order by colint;
3388
---------------------------
3389
---- some alter table begin
3390
---------------------------
3392
reorganize partition p0,p1 into
3393
(partition s1 values less than maxvalue);
3394
select * from t11 order by col1;
3399
reorganize partition s1 into
3400
(partition p0 values less than (15),
3401
partition p1 values less than maxvalue);
3402
select * from t11 order by col1;
3407
partition by list(colint)
3408
subpartition by hash(cast(mod(col1,10) as signed)) subpartitions 5
3409
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3410
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3411
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3412
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3413
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3414
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3416
show create table t55;
3418
t55 CREATE TABLE `t55` (
3419
`colint` int(11) DEFAULT NULL,
3420
`col1` float(7,4) DEFAULT NULL
3421
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (cast(mod(col1,10) as signed)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
3422
select * from t55 order by colint;
3429
reorganize partition p0,p1 into
3430
(partition s1 values less than maxvalue);
3431
select * from t66 order by colint;
3438
reorganize partition s1 into
3439
(partition p0 values less than (cast(mod(15,10) as signed)),
3440
partition p1 values less than maxvalue);
3441
select * from t66 order by colint;
3448
reorganize partition p0,p1 into
3449
(partition s1 values less than maxvalue);
3450
select * from t66 order by colint;
3457
reorganize partition s1 into
3458
(partition p0 values less than (cast(mod(15,10) as signed)),
3459
partition p1 values less than maxvalue);
3460
select * from t66 order by colint;
3466
-------------------------------------------------------------------------
3467
--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
3468
-------------------------------------------------------------------------
3469
delete from t1 where col1=19;
3470
delete from t2 where col1=19;
3471
delete from t3 where col1=19;
3472
delete from t4 where col1=19;
3473
delete from t5 where col1=19;
3474
delete from t6 where col1=19;
3475
select * from t1 order by col1;
3478
select * from t2 order by col1;
3482
select * from t3 order by col1;
3486
select * from t4 order by colint;
3492
select * from t5 order by colint;
3498
insert into t1 values (19);
3499
insert into t2 values (19);
3500
insert into t3 values (19);
3501
insert into t4 values (60,19);
3502
insert into t5 values (60,19);
3503
insert into t6 values (60,19);
3504
select * from t1 order by col1;
3508
select * from t2 order by col1;
3513
select * from t3 order by col1;
3518
select * from t4 order by colint;
3525
select * from t5 order by colint;
3532
select * from t6 order by colint;
3539
alter table t1 drop partition p0;
3540
alter table t2 drop partition p0;
3541
alter table t4 drop partition p0;
3542
alter table t5 drop partition p0;
3543
alter table t6 drop partition p0;
3544
select * from t1 order by col1;
3546
select * from t2 order by col1;
3548
select * from t3 order by col1;
3553
select * from t4 order by colint;
3556
select * from t5 order by colint;
3559
select * from t6 order by colint;
3562
-------------------------------------------------------------------------
3563
--- Delete rows and partitions of tables with cast(mod(col1,10) as signed)
3564
-------------------------------------------------------------------------
3565
delete from t11 where col1=19;
3566
delete from t22 where col1=19;
3567
delete from t33 where col1=19;
3568
delete from t44 where col1=19;
3569
delete from t55 where col1=19;
3570
delete from t66 where col1=19;
3571
select * from t11 order by col1;
3574
select * from t22 order by col1;
3578
select * from t33 order by col1;
3582
select * from t44 order by colint;
3588
select * from t55 order by colint;
3594
insert into t11 values (19);
3595
insert into t22 values (19);
3596
insert into t33 values (19);
3597
insert into t44 values (60,19);
3598
insert into t55 values (60,19);
3599
insert into t66 values (60,19);
3600
select * from t11 order by col1;
3604
select * from t22 order by col1;
3609
select * from t33 order by col1;
3614
select * from t44 order by colint;
3621
select * from t55 order by colint;
3628
select * from t66 order by colint;
3635
alter table t11 drop partition p0;
3636
alter table t22 drop partition p0;
3637
alter table t44 drop partition p0;
3638
alter table t55 drop partition p0;
3639
alter table t66 drop partition p0;
3640
select * from t11 order by col1;
3642
select * from t22 order by col1;
3644
select * from t33 order by col1;
3649
select * from t44 order by colint;
3652
select * from t55 order by colint;
3655
select * from t66 order by colint;
3658
-------------------------
3659
---- some alter table end
3660
-------------------------
3661
drop table if exists t1 ;
3662
drop table if exists t2 ;
3663
drop table if exists t3 ;
3664
drop table if exists t4 ;
3665
drop table if exists t5 ;
3666
drop table if exists t6 ;
3667
drop table if exists t11 ;
3668
drop table if exists t22 ;
3669
drop table if exists t33 ;
3670
drop table if exists t44 ;
3671
drop table if exists t55 ;
3672
drop table if exists t66 ;
3673
-------------------------------------------------------------------------
3674
--- ord(col1) in partition with coltype char(3)
3675
-------------------------------------------------------------------------
3676
drop table if exists t1 ;
3677
drop table if exists t2 ;
3678
drop table if exists t3 ;
3679
drop table if exists t4 ;
3680
drop table if exists t5 ;
3681
drop table if exists t6 ;
3682
-------------------------------------------------------------------------
3683
--- Create tables with ord(col1)
3684
-------------------------------------------------------------------------
3685
create table t1 (col1 char(3)) engine='NDB'
3686
partition by range(ord(col1))
3687
(partition p0 values less than (15),
3688
partition p1 values less than maxvalue);
3689
create table t2 (col1 char(3)) engine='NDB'
3690
partition by list(ord(col1))
3691
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3692
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3693
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3694
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3695
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3696
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3698
create table t3 (col1 char(3)) engine='NDB'
3699
partition by hash(ord(col1));
3700
create table t4 (colint int, col1 char(3)) engine='NDB'
3701
partition by range(colint)
3702
subpartition by hash(ord(col1)) subpartitions 2
3703
(partition p0 values less than (15),
3704
partition p1 values less than maxvalue);
3705
create table t5 (colint int, col1 char(3)) engine='NDB'
3706
partition by list(colint)
3707
subpartition by hash(ord(col1)) subpartitions 2
3708
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3709
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3710
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3711
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3712
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3713
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3715
create table t6 (colint int, col1 char(3)) engine='NDB'
3716
partition by range(colint)
3717
(partition p0 values less than (ord('a')),
3718
partition p1 values less than maxvalue);
3719
-------------------------------------------------------------------------
3720
--- Access tables with ord(col1)
3721
-------------------------------------------------------------------------
3722
insert into t1 values ('1');
3723
insert into t1 values ('9');
3724
insert into t2 values ('1');
3725
insert into t2 values ('9');
3726
insert into t2 values ('3');
3727
insert into t3 values ('1');
3728
insert into t3 values ('9');
3729
insert into t3 values ('3');
3730
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t4;
3731
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t5;
3732
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_ch1.in' into table t6;
3733
select ord(col1) from t1 order by col1;
3737
select * from t1 order by col1;
3741
select * from t2 order by col1;
3746
select * from t3 order by col1;
3751
select * from t4 order by colint;
3757
select * from t5 order by colint;
3763
select * from t6 order by colint;
3769
update t1 set col1='8' where col1='1';
3770
update t2 set col1='8' where col1='1';
3771
update t3 set col1='8' where col1='1';
3772
update t4 set col1='8' where col1='1';
3773
update t5 set col1='8' where col1='1';
3774
update t6 set col1='8' where col1='1';
3775
select * from t1 order by col1;
3779
select * from t2 order by col1;
3784
select * from t3 order by col1;
3789
select * from t4 order by colint;
3795
select * from t5 order by colint;
3801
select * from t6 order by colint;
3807
-------------------------------------------------------------------------
3808
--- Alter tables with ord(col1)
3809
-------------------------------------------------------------------------
3810
drop table if exists t11 ;
3811
drop table if exists t22 ;
3812
drop table if exists t33 ;
3813
drop table if exists t44 ;
3814
drop table if exists t55 ;
3815
drop table if exists t66 ;
3816
create table t11 engine='NDB' as select * from t1;
3817
create table t22 engine='NDB' as select * from t2;
3818
create table t33 engine='NDB' as select * from t3;
3819
create table t44 engine='NDB' as select * from t4;
3820
create table t55 engine='NDB' as select * from t5;
3821
create table t66 engine='NDB' as select * from t6;
3823
partition by range(ord(col1))
3824
(partition p0 values less than (15),
3825
partition p1 values less than maxvalue);
3827
partition by list(ord(col1))
3828
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
3829
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3830
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3831
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3832
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3833
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3836
partition by hash(ord(col1));
3838
partition by range(colint)
3839
subpartition by hash(ord(col1)) subpartitions 2
3840
(partition p0 values less than (15),
3841
partition p1 values less than maxvalue);
3843
partition by list(colint)
3844
subpartition by hash(ord(col1)) subpartitions 2
3845
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3846
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3847
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3848
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3849
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3850
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3853
partition by range(colint)
3854
(partition p0 values less than (ord('a')),
3855
partition p1 values less than maxvalue);
3856
select * from t11 order by col1;
3860
select * from t22 order by col1;
3865
select * from t33 order by col1;
3870
select * from t44 order by colint;
3876
select * from t55 order by colint;
3882
select * from t66 order by colint;
3888
---------------------------
3889
---- some alter table begin
3890
---------------------------
3892
reorganize partition p0,p1 into
3893
(partition s1 values less than maxvalue);
3894
select * from t11 order by col1;
3899
reorganize partition s1 into
3900
(partition p0 values less than (15),
3901
partition p1 values less than maxvalue);
3902
select * from t11 order by col1;
3907
partition by list(colint)
3908
subpartition by hash(ord(col1)) subpartitions 5
3909
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
3910
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
3911
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
3912
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
3913
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
3914
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
3916
show create table t55;
3918
t55 CREATE TABLE `t55` (
3919
`colint` int(11) DEFAULT NULL,
3920
`col1` char(3) DEFAULT NULL
3921
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (ord(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
3922
select * from t55 order by colint;
3929
reorganize partition p0,p1 into
3930
(partition s1 values less than maxvalue);
3931
select * from t66 order by colint;
3938
reorganize partition s1 into
3939
(partition p0 values less than (ord('a')),
3940
partition p1 values less than maxvalue);
3941
select * from t66 order by colint;
3948
reorganize partition p0,p1 into
3949
(partition s1 values less than maxvalue);
3950
select * from t66 order by colint;
3957
reorganize partition s1 into
3958
(partition p0 values less than (ord('a')),
3959
partition p1 values less than maxvalue);
3960
select * from t66 order by colint;
3966
-------------------------------------------------------------------------
3967
--- Delete rows and partitions of tables with ord(col1)
3968
-------------------------------------------------------------------------
3969
delete from t1 where col1='9';
3970
delete from t2 where col1='9';
3971
delete from t3 where col1='9';
3972
delete from t4 where col1='9';
3973
delete from t5 where col1='9';
3974
delete from t6 where col1='9';
3975
select * from t1 order by col1;
3978
select * from t2 order by col1;
3982
select * from t3 order by col1;
3986
select * from t4 order by colint;
3991
select * from t5 order by colint;
3996
insert into t1 values ('9');
3997
insert into t2 values ('9');
3998
insert into t3 values ('9');
3999
insert into t4 values (60,'9');
4000
insert into t5 values (60,'9');
4001
insert into t6 values (60,'9');
4002
select * from t1 order by col1;
4006
select * from t2 order by col1;
4011
select * from t3 order by col1;
4016
select * from t4 order by colint;
4022
select * from t5 order by colint;
4028
select * from t6 order by colint;
4034
alter table t1 drop partition p0;
4035
alter table t2 drop partition p0;
4036
alter table t4 drop partition p0;
4037
alter table t5 drop partition p0;
4038
alter table t6 drop partition p0;
4039
select * from t1 order by col1;
4043
select * from t2 order by col1;
4048
select * from t3 order by col1;
4053
select * from t4 order by colint;
4056
select * from t5 order by colint;
4059
select * from t6 order by colint;
4061
-------------------------------------------------------------------------
4062
--- Delete rows and partitions of tables with ord(col1)
4063
-------------------------------------------------------------------------
4064
delete from t11 where col1='9';
4065
delete from t22 where col1='9';
4066
delete from t33 where col1='9';
4067
delete from t44 where col1='9';
4068
delete from t55 where col1='9';
4069
delete from t66 where col1='9';
4070
select * from t11 order by col1;
4073
select * from t22 order by col1;
4077
select * from t33 order by col1;
4081
select * from t44 order by colint;
4086
select * from t55 order by colint;
4091
insert into t11 values ('9');
4092
insert into t22 values ('9');
4093
insert into t33 values ('9');
4094
insert into t44 values (60,'9');
4095
insert into t55 values (60,'9');
4096
insert into t66 values (60,'9');
4097
select * from t11 order by col1;
4101
select * from t22 order by col1;
4106
select * from t33 order by col1;
4111
select * from t44 order by colint;
4117
select * from t55 order by colint;
4123
select * from t66 order by colint;
4129
alter table t11 drop partition p0;
4130
alter table t22 drop partition p0;
4131
alter table t44 drop partition p0;
4132
alter table t55 drop partition p0;
4133
alter table t66 drop partition p0;
4134
select * from t11 order by col1;
4138
select * from t22 order by col1;
4143
select * from t33 order by col1;
4148
select * from t44 order by colint;
4151
select * from t55 order by colint;
4154
select * from t66 order by colint;
4156
-------------------------
4157
---- some alter table end
4158
-------------------------
4159
drop table if exists t1 ;
4160
drop table if exists t2 ;
4161
drop table if exists t3 ;
4162
drop table if exists t4 ;
4163
drop table if exists t5 ;
4164
drop table if exists t6 ;
4165
drop table if exists t11 ;
4166
drop table if exists t22 ;
4167
drop table if exists t33 ;
4168
drop table if exists t44 ;
4169
drop table if exists t55 ;
4170
drop table if exists t66 ;
4171
-------------------------------------------------------------------------
4172
--- day(col1) in partition with coltype date
4173
-------------------------------------------------------------------------
4174
drop table if exists t1 ;
4175
drop table if exists t2 ;
4176
drop table if exists t3 ;
4177
drop table if exists t4 ;
4178
drop table if exists t5 ;
4179
drop table if exists t6 ;
4180
-------------------------------------------------------------------------
4181
--- Create tables with day(col1)
4182
-------------------------------------------------------------------------
4183
create table t1 (col1 date) engine='NDB'
4184
partition by range(day(col1))
4185
(partition p0 values less than (15),
4186
partition p1 values less than maxvalue);
4187
create table t2 (col1 date) engine='NDB'
4188
partition by list(day(col1))
4189
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4190
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4191
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4192
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4193
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4194
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4196
create table t3 (col1 date) engine='NDB'
4197
partition by hash(day(col1));
4198
create table t4 (colint int, col1 date) engine='NDB'
4199
partition by range(colint)
4200
subpartition by hash(day(col1)) subpartitions 2
4201
(partition p0 values less than (15),
4202
partition p1 values less than maxvalue);
4203
create table t5 (colint int, col1 date) engine='NDB'
4204
partition by list(colint)
4205
subpartition by hash(day(col1)) subpartitions 2
4206
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4207
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4208
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4209
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4210
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4211
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4213
create table t6 (colint int, col1 date) engine='NDB'
4214
partition by range(colint)
4215
(partition p0 values less than (day('2006-12-21')),
4216
partition p1 values less than maxvalue);
4217
-------------------------------------------------------------------------
4218
--- Access tables with day(col1)
4219
-------------------------------------------------------------------------
4220
insert into t1 values ('2006-02-03');
4221
insert into t1 values ('2006-01-17');
4222
insert into t2 values ('2006-02-03');
4223
insert into t2 values ('2006-01-17');
4224
insert into t2 values ('2006-01-25');
4225
insert into t3 values ('2006-02-03');
4226
insert into t3 values ('2006-01-17');
4227
insert into t3 values ('2006-01-25');
4228
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
4229
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
4230
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
4231
select day(col1) from t1 order by col1;
4235
select * from t1 order by col1;
4239
select * from t2 order by col1;
4244
select * from t3 order by col1;
4249
select * from t4 order by colint;
4255
select * from t5 order by colint;
4261
select * from t6 order by colint;
4267
update t1 set col1='2006-02-05' where col1='2006-02-03';
4268
update t2 set col1='2006-02-05' where col1='2006-02-03';
4269
update t3 set col1='2006-02-05' where col1='2006-02-03';
4270
update t4 set col1='2006-02-05' where col1='2006-02-03';
4271
update t5 set col1='2006-02-05' where col1='2006-02-03';
4272
update t6 set col1='2006-02-05' where col1='2006-02-03';
4273
select * from t1 order by col1;
4277
select * from t2 order by col1;
4282
select * from t3 order by col1;
4287
select * from t4 order by colint;
4293
select * from t5 order by colint;
4299
select * from t6 order by colint;
4305
-------------------------------------------------------------------------
4306
--- Alter tables with day(col1)
4307
-------------------------------------------------------------------------
4308
drop table if exists t11 ;
4309
drop table if exists t22 ;
4310
drop table if exists t33 ;
4311
drop table if exists t44 ;
4312
drop table if exists t55 ;
4313
drop table if exists t66 ;
4314
create table t11 engine='NDB' as select * from t1;
4315
create table t22 engine='NDB' as select * from t2;
4316
create table t33 engine='NDB' as select * from t3;
4317
create table t44 engine='NDB' as select * from t4;
4318
create table t55 engine='NDB' as select * from t5;
4319
create table t66 engine='NDB' as select * from t6;
4321
partition by range(day(col1))
4322
(partition p0 values less than (15),
4323
partition p1 values less than maxvalue);
4325
partition by list(day(col1))
4326
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4327
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4328
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4329
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4330
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4331
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4334
partition by hash(day(col1));
4336
partition by range(colint)
4337
subpartition by hash(day(col1)) subpartitions 2
4338
(partition p0 values less than (15),
4339
partition p1 values less than maxvalue);
4341
partition by list(colint)
4342
subpartition by hash(day(col1)) subpartitions 2
4343
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4344
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4345
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4346
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4347
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4348
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4351
partition by range(colint)
4352
(partition p0 values less than (day('2006-12-21')),
4353
partition p1 values less than maxvalue);
4354
select * from t11 order by col1;
4358
select * from t22 order by col1;
4363
select * from t33 order by col1;
4368
select * from t44 order by colint;
4374
select * from t55 order by colint;
4380
select * from t66 order by colint;
4386
---------------------------
4387
---- some alter table begin
4388
---------------------------
4390
reorganize partition p0,p1 into
4391
(partition s1 values less than maxvalue);
4392
select * from t11 order by col1;
4397
reorganize partition s1 into
4398
(partition p0 values less than (15),
4399
partition p1 values less than maxvalue);
4400
select * from t11 order by col1;
4405
partition by list(colint)
4406
subpartition by hash(day(col1)) subpartitions 5
4407
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4408
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4409
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4410
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4411
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4412
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4414
show create table t55;
4416
t55 CREATE TABLE `t55` (
4417
`colint` int(11) DEFAULT NULL,
4418
`col1` date DEFAULT NULL
4419
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (day(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
4420
select * from t55 order by colint;
4427
reorganize partition p0,p1 into
4428
(partition s1 values less than maxvalue);
4429
select * from t66 order by colint;
4436
reorganize partition s1 into
4437
(partition p0 values less than (day('2006-12-21')),
4438
partition p1 values less than maxvalue);
4439
select * from t66 order by colint;
4446
reorganize partition p0,p1 into
4447
(partition s1 values less than maxvalue);
4448
select * from t66 order by colint;
4455
reorganize partition s1 into
4456
(partition p0 values less than (day('2006-12-21')),
4457
partition p1 values less than maxvalue);
4458
select * from t66 order by colint;
4464
-------------------------------------------------------------------------
4465
--- Delete rows and partitions of tables with day(col1)
4466
-------------------------------------------------------------------------
4467
delete from t1 where col1='2006-01-17';
4468
delete from t2 where col1='2006-01-17';
4469
delete from t3 where col1='2006-01-17';
4470
delete from t4 where col1='2006-01-17';
4471
delete from t5 where col1='2006-01-17';
4472
delete from t6 where col1='2006-01-17';
4473
select * from t1 order by col1;
4476
select * from t2 order by col1;
4480
select * from t3 order by col1;
4484
select * from t4 order by colint;
4489
select * from t5 order by colint;
4494
insert into t1 values ('2006-01-17');
4495
insert into t2 values ('2006-01-17');
4496
insert into t3 values ('2006-01-17');
4497
insert into t4 values (60,'2006-01-17');
4498
insert into t5 values (60,'2006-01-17');
4499
insert into t6 values (60,'2006-01-17');
4500
select * from t1 order by col1;
4504
select * from t2 order by col1;
4509
select * from t3 order by col1;
4514
select * from t4 order by colint;
4520
select * from t5 order by colint;
4526
select * from t6 order by colint;
4532
alter table t1 drop partition p0;
4533
alter table t2 drop partition p0;
4534
alter table t4 drop partition p0;
4535
alter table t5 drop partition p0;
4536
alter table t6 drop partition p0;
4537
select * from t1 order by col1;
4540
select * from t2 order by col1;
4544
select * from t3 order by col1;
4549
select * from t4 order by colint;
4552
select * from t5 order by colint;
4555
select * from t6 order by colint;
4558
-------------------------------------------------------------------------
4559
--- Delete rows and partitions of tables with day(col1)
4560
-------------------------------------------------------------------------
4561
delete from t11 where col1='2006-01-17';
4562
delete from t22 where col1='2006-01-17';
4563
delete from t33 where col1='2006-01-17';
4564
delete from t44 where col1='2006-01-17';
4565
delete from t55 where col1='2006-01-17';
4566
delete from t66 where col1='2006-01-17';
4567
select * from t11 order by col1;
4570
select * from t22 order by col1;
4574
select * from t33 order by col1;
4578
select * from t44 order by colint;
4583
select * from t55 order by colint;
4588
insert into t11 values ('2006-01-17');
4589
insert into t22 values ('2006-01-17');
4590
insert into t33 values ('2006-01-17');
4591
insert into t44 values (60,'2006-01-17');
4592
insert into t55 values (60,'2006-01-17');
4593
insert into t66 values (60,'2006-01-17');
4594
select * from t11 order by col1;
4598
select * from t22 order by col1;
4603
select * from t33 order by col1;
4608
select * from t44 order by colint;
4614
select * from t55 order by colint;
4620
select * from t66 order by colint;
4626
alter table t11 drop partition p0;
4627
alter table t22 drop partition p0;
4628
alter table t44 drop partition p0;
4629
alter table t55 drop partition p0;
4630
alter table t66 drop partition p0;
4631
select * from t11 order by col1;
4634
select * from t22 order by col1;
4638
select * from t33 order by col1;
4643
select * from t44 order by colint;
4646
select * from t55 order by colint;
4649
select * from t66 order by colint;
4652
-------------------------
4653
---- some alter table end
4654
-------------------------
4655
drop table if exists t1 ;
4656
drop table if exists t2 ;
4657
drop table if exists t3 ;
4658
drop table if exists t4 ;
4659
drop table if exists t5 ;
4660
drop table if exists t6 ;
4661
drop table if exists t11 ;
4662
drop table if exists t22 ;
4663
drop table if exists t33 ;
4664
drop table if exists t44 ;
4665
drop table if exists t55 ;
4666
drop table if exists t66 ;
4667
-------------------------------------------------------------------------
4668
--- dayofmonth(col1) in partition with coltype date
4669
-------------------------------------------------------------------------
4670
drop table if exists t1 ;
4671
drop table if exists t2 ;
4672
drop table if exists t3 ;
4673
drop table if exists t4 ;
4674
drop table if exists t5 ;
4675
drop table if exists t6 ;
4676
-------------------------------------------------------------------------
4677
--- Create tables with dayofmonth(col1)
4678
-------------------------------------------------------------------------
4679
create table t1 (col1 date) engine='NDB'
4680
partition by range(dayofmonth(col1))
4681
(partition p0 values less than (15),
4682
partition p1 values less than maxvalue);
4683
create table t2 (col1 date) engine='NDB'
4684
partition by list(dayofmonth(col1))
4685
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4686
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4687
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4688
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4689
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4690
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4692
create table t3 (col1 date) engine='NDB'
4693
partition by hash(dayofmonth(col1));
4694
create table t4 (colint int, col1 date) engine='NDB'
4695
partition by range(colint)
4696
subpartition by hash(dayofmonth(col1)) subpartitions 2
4697
(partition p0 values less than (15),
4698
partition p1 values less than maxvalue);
4699
create table t5 (colint int, col1 date) engine='NDB'
4700
partition by list(colint)
4701
subpartition by hash(dayofmonth(col1)) subpartitions 2
4702
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4703
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4704
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4705
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4706
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4707
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4709
create table t6 (colint int, col1 date) engine='NDB'
4710
partition by range(colint)
4711
(partition p0 values less than (dayofmonth('2006-12-24')),
4712
partition p1 values less than maxvalue);
4713
-------------------------------------------------------------------------
4714
--- Access tables with dayofmonth(col1)
4715
-------------------------------------------------------------------------
4716
insert into t1 values ('2006-02-03');
4717
insert into t1 values ('2006-01-17');
4718
insert into t2 values ('2006-02-03');
4719
insert into t2 values ('2006-01-17');
4720
insert into t2 values ('2006-01-25');
4721
insert into t3 values ('2006-02-03');
4722
insert into t3 values ('2006-01-17');
4723
insert into t3 values ('2006-01-25');
4724
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
4725
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
4726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
4727
select dayofmonth(col1) from t1 order by col1;
4731
select * from t1 order by col1;
4735
select * from t2 order by col1;
4740
select * from t3 order by col1;
4745
select * from t4 order by colint;
4751
select * from t5 order by colint;
4757
select * from t6 order by colint;
4763
update t1 set col1='2006-02-05' where col1='2006-02-03';
4764
update t2 set col1='2006-02-05' where col1='2006-02-03';
4765
update t3 set col1='2006-02-05' where col1='2006-02-03';
4766
update t4 set col1='2006-02-05' where col1='2006-02-03';
4767
update t5 set col1='2006-02-05' where col1='2006-02-03';
4768
update t6 set col1='2006-02-05' where col1='2006-02-03';
4769
select * from t1 order by col1;
4773
select * from t2 order by col1;
4778
select * from t3 order by col1;
4783
select * from t4 order by colint;
4789
select * from t5 order by colint;
4795
select * from t6 order by colint;
4801
-------------------------------------------------------------------------
4802
--- Alter tables with dayofmonth(col1)
4803
-------------------------------------------------------------------------
4804
drop table if exists t11 ;
4805
drop table if exists t22 ;
4806
drop table if exists t33 ;
4807
drop table if exists t44 ;
4808
drop table if exists t55 ;
4809
drop table if exists t66 ;
4810
create table t11 engine='NDB' as select * from t1;
4811
create table t22 engine='NDB' as select * from t2;
4812
create table t33 engine='NDB' as select * from t3;
4813
create table t44 engine='NDB' as select * from t4;
4814
create table t55 engine='NDB' as select * from t5;
4815
create table t66 engine='NDB' as select * from t6;
4817
partition by range(dayofmonth(col1))
4818
(partition p0 values less than (15),
4819
partition p1 values less than maxvalue);
4821
partition by list(dayofmonth(col1))
4822
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
4823
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4824
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4825
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4826
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4827
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4830
partition by hash(dayofmonth(col1));
4832
partition by range(colint)
4833
subpartition by hash(dayofmonth(col1)) subpartitions 2
4834
(partition p0 values less than (15),
4835
partition p1 values less than maxvalue);
4837
partition by list(colint)
4838
subpartition by hash(dayofmonth(col1)) subpartitions 2
4839
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4840
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4841
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4842
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4843
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4844
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4847
partition by range(colint)
4848
(partition p0 values less than (dayofmonth('2006-12-24')),
4849
partition p1 values less than maxvalue);
4850
select * from t11 order by col1;
4854
select * from t22 order by col1;
4859
select * from t33 order by col1;
4864
select * from t44 order by colint;
4870
select * from t55 order by colint;
4876
select * from t66 order by colint;
4882
---------------------------
4883
---- some alter table begin
4884
---------------------------
4886
reorganize partition p0,p1 into
4887
(partition s1 values less than maxvalue);
4888
select * from t11 order by col1;
4893
reorganize partition s1 into
4894
(partition p0 values less than (15),
4895
partition p1 values less than maxvalue);
4896
select * from t11 order by col1;
4901
partition by list(colint)
4902
subpartition by hash(dayofmonth(col1)) subpartitions 5
4903
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
4904
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
4905
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
4906
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
4907
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
4908
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
4910
show create table t55;
4912
t55 CREATE TABLE `t55` (
4913
`colint` int(11) DEFAULT NULL,
4914
`col1` date DEFAULT NULL
4915
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofmonth(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
4916
select * from t55 order by colint;
4923
reorganize partition p0,p1 into
4924
(partition s1 values less than maxvalue);
4925
select * from t66 order by colint;
4932
reorganize partition s1 into
4933
(partition p0 values less than (dayofmonth('2006-12-24')),
4934
partition p1 values less than maxvalue);
4935
select * from t66 order by colint;
4942
reorganize partition p0,p1 into
4943
(partition s1 values less than maxvalue);
4944
select * from t66 order by colint;
4951
reorganize partition s1 into
4952
(partition p0 values less than (dayofmonth('2006-12-24')),
4953
partition p1 values less than maxvalue);
4954
select * from t66 order by colint;
4960
-------------------------------------------------------------------------
4961
--- Delete rows and partitions of tables with dayofmonth(col1)
4962
-------------------------------------------------------------------------
4963
delete from t1 where col1='2006-01-17';
4964
delete from t2 where col1='2006-01-17';
4965
delete from t3 where col1='2006-01-17';
4966
delete from t4 where col1='2006-01-17';
4967
delete from t5 where col1='2006-01-17';
4968
delete from t6 where col1='2006-01-17';
4969
select * from t1 order by col1;
4972
select * from t2 order by col1;
4976
select * from t3 order by col1;
4980
select * from t4 order by colint;
4985
select * from t5 order by colint;
4990
insert into t1 values ('2006-01-17');
4991
insert into t2 values ('2006-01-17');
4992
insert into t3 values ('2006-01-17');
4993
insert into t4 values (60,'2006-01-17');
4994
insert into t5 values (60,'2006-01-17');
4995
insert into t6 values (60,'2006-01-17');
4996
select * from t1 order by col1;
5000
select * from t2 order by col1;
5005
select * from t3 order by col1;
5010
select * from t4 order by colint;
5016
select * from t5 order by colint;
5022
select * from t6 order by colint;
5028
alter table t1 drop partition p0;
5029
alter table t2 drop partition p0;
5030
alter table t4 drop partition p0;
5031
alter table t5 drop partition p0;
5032
alter table t6 drop partition p0;
5033
select * from t1 order by col1;
5036
select * from t2 order by col1;
5040
select * from t3 order by col1;
5045
select * from t4 order by colint;
5048
select * from t5 order by colint;
5051
select * from t6 order by colint;
5054
-------------------------------------------------------------------------
5055
--- Delete rows and partitions of tables with dayofmonth(col1)
5056
-------------------------------------------------------------------------
5057
delete from t11 where col1='2006-01-17';
5058
delete from t22 where col1='2006-01-17';
5059
delete from t33 where col1='2006-01-17';
5060
delete from t44 where col1='2006-01-17';
5061
delete from t55 where col1='2006-01-17';
5062
delete from t66 where col1='2006-01-17';
5063
select * from t11 order by col1;
5066
select * from t22 order by col1;
5070
select * from t33 order by col1;
5074
select * from t44 order by colint;
5079
select * from t55 order by colint;
5084
insert into t11 values ('2006-01-17');
5085
insert into t22 values ('2006-01-17');
5086
insert into t33 values ('2006-01-17');
5087
insert into t44 values (60,'2006-01-17');
5088
insert into t55 values (60,'2006-01-17');
5089
insert into t66 values (60,'2006-01-17');
5090
select * from t11 order by col1;
5094
select * from t22 order by col1;
5099
select * from t33 order by col1;
5104
select * from t44 order by colint;
5110
select * from t55 order by colint;
5116
select * from t66 order by colint;
5122
alter table t11 drop partition p0;
5123
alter table t22 drop partition p0;
5124
alter table t44 drop partition p0;
5125
alter table t55 drop partition p0;
5126
alter table t66 drop partition p0;
5127
select * from t11 order by col1;
5130
select * from t22 order by col1;
5134
select * from t33 order by col1;
5139
select * from t44 order by colint;
5142
select * from t55 order by colint;
5145
select * from t66 order by colint;
5148
-------------------------
5149
---- some alter table end
5150
-------------------------
5151
drop table if exists t1 ;
5152
drop table if exists t2 ;
5153
drop table if exists t3 ;
5154
drop table if exists t4 ;
5155
drop table if exists t5 ;
5156
drop table if exists t6 ;
5157
drop table if exists t11 ;
5158
drop table if exists t22 ;
5159
drop table if exists t33 ;
5160
drop table if exists t44 ;
5161
drop table if exists t55 ;
5162
drop table if exists t66 ;
5163
-------------------------------------------------------------------------
5164
--- dayofweek(col1) in partition with coltype date
5165
-------------------------------------------------------------------------
5166
drop table if exists t1 ;
5167
drop table if exists t2 ;
5168
drop table if exists t3 ;
5169
drop table if exists t4 ;
5170
drop table if exists t5 ;
5171
drop table if exists t6 ;
5172
-------------------------------------------------------------------------
5173
--- Create tables with dayofweek(col1)
5174
-------------------------------------------------------------------------
5175
create table t1 (col1 date) engine='NDB'
5176
partition by range(dayofweek(col1))
5177
(partition p0 values less than (15),
5178
partition p1 values less than maxvalue);
5179
create table t2 (col1 date) engine='NDB'
5180
partition by list(dayofweek(col1))
5181
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5182
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5183
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5184
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5185
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5186
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5188
create table t3 (col1 date) engine='NDB'
5189
partition by hash(dayofweek(col1));
5190
create table t4 (colint int, col1 date) engine='NDB'
5191
partition by range(colint)
5192
subpartition by hash(dayofweek(col1)) subpartitions 2
5193
(partition p0 values less than (15),
5194
partition p1 values less than maxvalue);
5195
create table t5 (colint int, col1 date) engine='NDB'
5196
partition by list(colint)
5197
subpartition by hash(dayofweek(col1)) subpartitions 2
5198
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5199
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5200
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5201
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5202
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5203
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5205
create table t6 (colint int, col1 date) engine='NDB'
5206
partition by range(colint)
5207
(partition p0 values less than (dayofweek('2006-12-24')),
5208
partition p1 values less than maxvalue);
5209
-------------------------------------------------------------------------
5210
--- Access tables with dayofweek(col1)
5211
-------------------------------------------------------------------------
5212
insert into t1 values ('2006-01-03');
5213
insert into t1 values ('2006-02-17');
5214
insert into t2 values ('2006-01-03');
5215
insert into t2 values ('2006-02-17');
5216
insert into t2 values ('2006-01-25');
5217
insert into t3 values ('2006-01-03');
5218
insert into t3 values ('2006-02-17');
5219
insert into t3 values ('2006-01-25');
5220
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
5221
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
5222
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
5223
select dayofweek(col1) from t1 order by col1;
5227
select * from t1 order by col1;
5231
select * from t2 order by col1;
5236
select * from t3 order by col1;
5241
select * from t4 order by colint;
5247
select * from t5 order by colint;
5253
select * from t6 order by colint;
5259
update t1 set col1='2006-02-05' where col1='2006-01-03';
5260
update t2 set col1='2006-02-05' where col1='2006-01-03';
5261
update t3 set col1='2006-02-05' where col1='2006-01-03';
5262
update t4 set col1='2006-02-05' where col1='2006-01-03';
5263
update t5 set col1='2006-02-05' where col1='2006-01-03';
5264
update t6 set col1='2006-02-05' where col1='2006-01-03';
5265
select * from t1 order by col1;
5269
select * from t2 order by col1;
5274
select * from t3 order by col1;
5279
select * from t4 order by colint;
5285
select * from t5 order by colint;
5291
select * from t6 order by colint;
5297
-------------------------------------------------------------------------
5298
--- Alter tables with dayofweek(col1)
5299
-------------------------------------------------------------------------
5300
drop table if exists t11 ;
5301
drop table if exists t22 ;
5302
drop table if exists t33 ;
5303
drop table if exists t44 ;
5304
drop table if exists t55 ;
5305
drop table if exists t66 ;
5306
create table t11 engine='NDB' as select * from t1;
5307
create table t22 engine='NDB' as select * from t2;
5308
create table t33 engine='NDB' as select * from t3;
5309
create table t44 engine='NDB' as select * from t4;
5310
create table t55 engine='NDB' as select * from t5;
5311
create table t66 engine='NDB' as select * from t6;
5313
partition by range(dayofweek(col1))
5314
(partition p0 values less than (15),
5315
partition p1 values less than maxvalue);
5317
partition by list(dayofweek(col1))
5318
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5319
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5320
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5321
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5322
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5323
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5326
partition by hash(dayofweek(col1));
5328
partition by range(colint)
5329
subpartition by hash(dayofweek(col1)) subpartitions 2
5330
(partition p0 values less than (15),
5331
partition p1 values less than maxvalue);
5333
partition by list(colint)
5334
subpartition by hash(dayofweek(col1)) subpartitions 2
5335
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5336
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5337
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5338
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5339
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5340
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5343
partition by range(colint)
5344
(partition p0 values less than (dayofweek('2006-12-24')),
5345
partition p1 values less than maxvalue);
5346
select * from t11 order by col1;
5350
select * from t22 order by col1;
5355
select * from t33 order by col1;
5360
select * from t44 order by colint;
5366
select * from t55 order by colint;
5372
select * from t66 order by colint;
5378
---------------------------
5379
---- some alter table begin
5380
---------------------------
5382
reorganize partition p0,p1 into
5383
(partition s1 values less than maxvalue);
5384
select * from t11 order by col1;
5389
reorganize partition s1 into
5390
(partition p0 values less than (15),
5391
partition p1 values less than maxvalue);
5392
select * from t11 order by col1;
5397
partition by list(colint)
5398
subpartition by hash(dayofweek(col1)) subpartitions 5
5399
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5400
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5401
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5402
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5403
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5404
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5406
show create table t55;
5408
t55 CREATE TABLE `t55` (
5409
`colint` int(11) DEFAULT NULL,
5410
`col1` date DEFAULT NULL
5411
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofweek(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
5412
select * from t55 order by colint;
5419
reorganize partition p0,p1 into
5420
(partition s1 values less than maxvalue);
5421
select * from t66 order by colint;
5428
reorganize partition s1 into
5429
(partition p0 values less than (dayofweek('2006-12-24')),
5430
partition p1 values less than maxvalue);
5431
select * from t66 order by colint;
5438
reorganize partition p0,p1 into
5439
(partition s1 values less than maxvalue);
5440
select * from t66 order by colint;
5447
reorganize partition s1 into
5448
(partition p0 values less than (dayofweek('2006-12-24')),
5449
partition p1 values less than maxvalue);
5450
select * from t66 order by colint;
5456
-------------------------------------------------------------------------
5457
--- Delete rows and partitions of tables with dayofweek(col1)
5458
-------------------------------------------------------------------------
5459
delete from t1 where col1='2006-02-17';
5460
delete from t2 where col1='2006-02-17';
5461
delete from t3 where col1='2006-02-17';
5462
delete from t4 where col1='2006-02-17';
5463
delete from t5 where col1='2006-02-17';
5464
delete from t6 where col1='2006-02-17';
5465
select * from t1 order by col1;
5468
select * from t2 order by col1;
5472
select * from t3 order by col1;
5476
select * from t4 order by colint;
5482
select * from t5 order by colint;
5488
insert into t1 values ('2006-02-17');
5489
insert into t2 values ('2006-02-17');
5490
insert into t3 values ('2006-02-17');
5491
insert into t4 values (60,'2006-02-17');
5492
insert into t5 values (60,'2006-02-17');
5493
insert into t6 values (60,'2006-02-17');
5494
select * from t1 order by col1;
5498
select * from t2 order by col1;
5503
select * from t3 order by col1;
5508
select * from t4 order by colint;
5515
select * from t5 order by colint;
5522
select * from t6 order by colint;
5529
alter table t1 drop partition p0;
5530
alter table t2 drop partition p0;
5531
alter table t4 drop partition p0;
5532
alter table t5 drop partition p0;
5533
alter table t6 drop partition p0;
5534
select * from t1 order by col1;
5536
select * from t2 order by col1;
5538
select * from t3 order by col1;
5543
select * from t4 order by colint;
5546
select * from t5 order by colint;
5549
select * from t6 order by colint;
5556
-------------------------------------------------------------------------
5557
--- Delete rows and partitions of tables with dayofweek(col1)
5558
-------------------------------------------------------------------------
5559
delete from t11 where col1='2006-02-17';
5560
delete from t22 where col1='2006-02-17';
5561
delete from t33 where col1='2006-02-17';
5562
delete from t44 where col1='2006-02-17';
5563
delete from t55 where col1='2006-02-17';
5564
delete from t66 where col1='2006-02-17';
5565
select * from t11 order by col1;
5568
select * from t22 order by col1;
5572
select * from t33 order by col1;
5576
select * from t44 order by colint;
5582
select * from t55 order by colint;
5588
insert into t11 values ('2006-02-17');
5589
insert into t22 values ('2006-02-17');
5590
insert into t33 values ('2006-02-17');
5591
insert into t44 values (60,'2006-02-17');
5592
insert into t55 values (60,'2006-02-17');
5593
insert into t66 values (60,'2006-02-17');
5594
select * from t11 order by col1;
5598
select * from t22 order by col1;
5603
select * from t33 order by col1;
5608
select * from t44 order by colint;
5615
select * from t55 order by colint;
5622
select * from t66 order by colint;
5629
alter table t11 drop partition p0;
5630
alter table t22 drop partition p0;
5631
alter table t44 drop partition p0;
5632
alter table t55 drop partition p0;
5633
alter table t66 drop partition p0;
5634
select * from t11 order by col1;
5636
select * from t22 order by col1;
5638
select * from t33 order by col1;
5643
select * from t44 order by colint;
5646
select * from t55 order by colint;
5649
select * from t66 order by colint;
5656
-------------------------
5657
---- some alter table end
5658
-------------------------
5659
drop table if exists t1 ;
5660
drop table if exists t2 ;
5661
drop table if exists t3 ;
5662
drop table if exists t4 ;
5663
drop table if exists t5 ;
5664
drop table if exists t6 ;
5665
drop table if exists t11 ;
5666
drop table if exists t22 ;
5667
drop table if exists t33 ;
5668
drop table if exists t44 ;
5669
drop table if exists t55 ;
5670
drop table if exists t66 ;
5671
-------------------------------------------------------------------------
5672
--- dayofyear(col1) in partition with coltype date
5673
-------------------------------------------------------------------------
5674
drop table if exists t1 ;
5675
drop table if exists t2 ;
5676
drop table if exists t3 ;
5677
drop table if exists t4 ;
5678
drop table if exists t5 ;
5679
drop table if exists t6 ;
5680
-------------------------------------------------------------------------
5681
--- Create tables with dayofyear(col1)
5682
-------------------------------------------------------------------------
5683
create table t1 (col1 date) engine='NDB'
5684
partition by range(dayofyear(col1))
5685
(partition p0 values less than (15),
5686
partition p1 values less than maxvalue);
5687
create table t2 (col1 date) engine='NDB'
5688
partition by list(dayofyear(col1))
5689
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5690
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5691
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5692
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5693
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5694
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5696
create table t3 (col1 date) engine='NDB'
5697
partition by hash(dayofyear(col1));
5698
create table t4 (colint int, col1 date) engine='NDB'
5699
partition by range(colint)
5700
subpartition by hash(dayofyear(col1)) subpartitions 2
5701
(partition p0 values less than (15),
5702
partition p1 values less than maxvalue);
5703
create table t5 (colint int, col1 date) engine='NDB'
5704
partition by list(colint)
5705
subpartition by hash(dayofyear(col1)) subpartitions 2
5706
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5707
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5708
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5709
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5710
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5711
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5713
create table t6 (colint int, col1 date) engine='NDB'
5714
partition by range(colint)
5715
(partition p0 values less than (dayofyear('2006-12-25')),
5716
partition p1 values less than maxvalue);
5717
-------------------------------------------------------------------------
5718
--- Access tables with dayofyear(col1)
5719
-------------------------------------------------------------------------
5720
insert into t1 values ('2006-01-03');
5721
insert into t1 values ('2006-01-17');
5722
insert into t2 values ('2006-01-03');
5723
insert into t2 values ('2006-01-17');
5724
insert into t2 values ('2006-02-25');
5725
insert into t3 values ('2006-01-03');
5726
insert into t3 values ('2006-01-17');
5727
insert into t3 values ('2006-02-25');
5728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
5729
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
5730
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
5731
select dayofyear(col1) from t1 order by col1;
5735
select * from t1 order by col1;
5739
select * from t2 order by col1;
5744
select * from t3 order by col1;
5749
select * from t4 order by colint;
5755
select * from t5 order by colint;
5761
select * from t6 order by colint;
5767
update t1 set col1='2006-02-05' where col1='2006-01-03';
5768
update t2 set col1='2006-02-05' where col1='2006-01-03';
5769
update t3 set col1='2006-02-05' where col1='2006-01-03';
5770
update t4 set col1='2006-02-05' where col1='2006-01-03';
5771
update t5 set col1='2006-02-05' where col1='2006-01-03';
5772
update t6 set col1='2006-02-05' where col1='2006-01-03';
5773
select * from t1 order by col1;
5777
select * from t2 order by col1;
5782
select * from t3 order by col1;
5787
select * from t4 order by colint;
5793
select * from t5 order by colint;
5799
select * from t6 order by colint;
5805
-------------------------------------------------------------------------
5806
--- Alter tables with dayofyear(col1)
5807
-------------------------------------------------------------------------
5808
drop table if exists t11 ;
5809
drop table if exists t22 ;
5810
drop table if exists t33 ;
5811
drop table if exists t44 ;
5812
drop table if exists t55 ;
5813
drop table if exists t66 ;
5814
create table t11 engine='NDB' as select * from t1;
5815
create table t22 engine='NDB' as select * from t2;
5816
create table t33 engine='NDB' as select * from t3;
5817
create table t44 engine='NDB' as select * from t4;
5818
create table t55 engine='NDB' as select * from t5;
5819
create table t66 engine='NDB' as select * from t6;
5821
partition by range(dayofyear(col1))
5822
(partition p0 values less than (15),
5823
partition p1 values less than maxvalue);
5825
partition by list(dayofyear(col1))
5826
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
5827
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5828
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5829
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5830
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5831
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5834
partition by hash(dayofyear(col1));
5836
partition by range(colint)
5837
subpartition by hash(dayofyear(col1)) subpartitions 2
5838
(partition p0 values less than (15),
5839
partition p1 values less than maxvalue);
5841
partition by list(colint)
5842
subpartition by hash(dayofyear(col1)) subpartitions 2
5843
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5844
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5845
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5846
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5847
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5848
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5851
partition by range(colint)
5852
(partition p0 values less than (dayofyear('2006-12-25')),
5853
partition p1 values less than maxvalue);
5854
select * from t11 order by col1;
5858
select * from t22 order by col1;
5863
select * from t33 order by col1;
5868
select * from t44 order by colint;
5874
select * from t55 order by colint;
5880
select * from t66 order by colint;
5886
---------------------------
5887
---- some alter table begin
5888
---------------------------
5890
reorganize partition p0,p1 into
5891
(partition s1 values less than maxvalue);
5892
select * from t11 order by col1;
5897
reorganize partition s1 into
5898
(partition p0 values less than (15),
5899
partition p1 values less than maxvalue);
5900
select * from t11 order by col1;
5905
partition by list(colint)
5906
subpartition by hash(dayofyear(col1)) subpartitions 5
5907
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
5908
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
5909
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
5910
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
5911
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
5912
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
5914
show create table t55;
5916
t55 CREATE TABLE `t55` (
5917
`colint` int(11) DEFAULT NULL,
5918
`col1` date DEFAULT NULL
5919
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
5920
select * from t55 order by colint;
5927
reorganize partition p0,p1 into
5928
(partition s1 values less than maxvalue);
5929
select * from t66 order by colint;
5936
reorganize partition s1 into
5937
(partition p0 values less than (dayofyear('2006-12-25')),
5938
partition p1 values less than maxvalue);
5939
select * from t66 order by colint;
5946
reorganize partition p0,p1 into
5947
(partition s1 values less than maxvalue);
5948
select * from t66 order by colint;
5955
reorganize partition s1 into
5956
(partition p0 values less than (dayofyear('2006-12-25')),
5957
partition p1 values less than maxvalue);
5958
select * from t66 order by colint;
5964
-------------------------------------------------------------------------
5965
--- Delete rows and partitions of tables with dayofyear(col1)
5966
-------------------------------------------------------------------------
5967
delete from t1 where col1='2006-01-17';
5968
delete from t2 where col1='2006-01-17';
5969
delete from t3 where col1='2006-01-17';
5970
delete from t4 where col1='2006-01-17';
5971
delete from t5 where col1='2006-01-17';
5972
delete from t6 where col1='2006-01-17';
5973
select * from t1 order by col1;
5976
select * from t2 order by col1;
5980
select * from t3 order by col1;
5984
select * from t4 order by colint;
5989
select * from t5 order by colint;
5994
insert into t1 values ('2006-01-17');
5995
insert into t2 values ('2006-01-17');
5996
insert into t3 values ('2006-01-17');
5997
insert into t4 values (60,'2006-01-17');
5998
insert into t5 values (60,'2006-01-17');
5999
insert into t6 values (60,'2006-01-17');
6000
select * from t1 order by col1;
6004
select * from t2 order by col1;
6009
select * from t3 order by col1;
6014
select * from t4 order by colint;
6020
select * from t5 order by colint;
6026
select * from t6 order by colint;
6032
alter table t1 drop partition p0;
6033
alter table t2 drop partition p0;
6034
alter table t4 drop partition p0;
6035
alter table t5 drop partition p0;
6036
alter table t6 drop partition p0;
6037
select * from t1 order by col1;
6041
select * from t2 order by col1;
6046
select * from t3 order by col1;
6051
select * from t4 order by colint;
6054
select * from t5 order by colint;
6057
select * from t6 order by colint;
6059
-------------------------------------------------------------------------
6060
--- Delete rows and partitions of tables with dayofyear(col1)
6061
-------------------------------------------------------------------------
6062
delete from t11 where col1='2006-01-17';
6063
delete from t22 where col1='2006-01-17';
6064
delete from t33 where col1='2006-01-17';
6065
delete from t44 where col1='2006-01-17';
6066
delete from t55 where col1='2006-01-17';
6067
delete from t66 where col1='2006-01-17';
6068
select * from t11 order by col1;
6071
select * from t22 order by col1;
6075
select * from t33 order by col1;
6079
select * from t44 order by colint;
6084
select * from t55 order by colint;
6089
insert into t11 values ('2006-01-17');
6090
insert into t22 values ('2006-01-17');
6091
insert into t33 values ('2006-01-17');
6092
insert into t44 values (60,'2006-01-17');
6093
insert into t55 values (60,'2006-01-17');
6094
insert into t66 values (60,'2006-01-17');
6095
select * from t11 order by col1;
6099
select * from t22 order by col1;
6104
select * from t33 order by col1;
6109
select * from t44 order by colint;
6115
select * from t55 order by colint;
6121
select * from t66 order by colint;
6127
alter table t11 drop partition p0;
6128
alter table t22 drop partition p0;
6129
alter table t44 drop partition p0;
6130
alter table t55 drop partition p0;
6131
alter table t66 drop partition p0;
6132
select * from t11 order by col1;
6136
select * from t22 order by col1;
6141
select * from t33 order by col1;
6146
select * from t44 order by colint;
6149
select * from t55 order by colint;
6152
select * from t66 order by colint;
6154
-------------------------
6155
---- some alter table end
6156
-------------------------
6157
drop table if exists t1 ;
6158
drop table if exists t2 ;
6159
drop table if exists t3 ;
6160
drop table if exists t4 ;
6161
drop table if exists t5 ;
6162
drop table if exists t6 ;
6163
drop table if exists t11 ;
6164
drop table if exists t22 ;
6165
drop table if exists t33 ;
6166
drop table if exists t44 ;
6167
drop table if exists t55 ;
6168
drop table if exists t66 ;
6169
-------------------------------------------------------------------------
6170
--- dayofyear(col1) in partition with coltype char(30)
6171
-------------------------------------------------------------------------
6172
drop table if exists t1 ;
6173
drop table if exists t2 ;
6174
drop table if exists t3 ;
6175
drop table if exists t4 ;
6176
drop table if exists t5 ;
6177
drop table if exists t6 ;
6178
-------------------------------------------------------------------------
6179
--- Create tables with dayofyear(col1)
6180
-------------------------------------------------------------------------
6181
create table t1 (col1 char(30)) engine='NDB'
6182
partition by range(dayofyear(col1))
6183
(partition p0 values less than (15),
6184
partition p1 values less than maxvalue);
6185
create table t2 (col1 char(30)) engine='NDB'
6186
partition by list(dayofyear(col1))
6187
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6188
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6189
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6190
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6191
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6192
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6194
create table t3 (col1 char(30)) engine='NDB'
6195
partition by hash(dayofyear(col1));
6196
create table t4 (colint int, col1 char(30)) engine='NDB'
6197
partition by range(colint)
6198
subpartition by hash(dayofyear(col1)) subpartitions 2
6199
(partition p0 values less than (15),
6200
partition p1 values less than maxvalue);
6201
create table t5 (colint int, col1 char(30)) engine='NDB'
6202
partition by list(colint)
6203
subpartition by hash(dayofyear(col1)) subpartitions 2
6204
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6205
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6206
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6207
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6208
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6209
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6211
create table t6 (colint int, col1 char(30)) engine='NDB'
6212
partition by range(colint)
6213
(partition p0 values less than (dayofyear('2006-12-25')),
6214
partition p1 values less than maxvalue);
6215
-------------------------------------------------------------------------
6216
--- Access tables with dayofyear(col1)
6217
-------------------------------------------------------------------------
6218
insert into t1 values ('2006-01-03');
6219
insert into t1 values ('2006-01-17');
6220
insert into t2 values ('2006-01-03');
6221
insert into t2 values ('2006-01-17');
6222
insert into t2 values ('2006-02-25');
6223
insert into t3 values ('2006-01-03');
6224
insert into t3 values ('2006-01-17');
6225
insert into t3 values ('2006-02-25');
6226
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
6227
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
6228
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
6229
select dayofyear(col1) from t1 order by col1;
6233
select * from t1 order by col1;
6237
select * from t2 order by col1;
6242
select * from t3 order by col1;
6247
select * from t4 order by colint;
6253
select * from t5 order by colint;
6259
select * from t6 order by colint;
6265
update t1 set col1='2006-02-05' where col1='2006-01-03';
6266
update t2 set col1='2006-02-05' where col1='2006-01-03';
6267
update t3 set col1='2006-02-05' where col1='2006-01-03';
6268
update t4 set col1='2006-02-05' where col1='2006-01-03';
6269
update t5 set col1='2006-02-05' where col1='2006-01-03';
6270
update t6 set col1='2006-02-05' where col1='2006-01-03';
6271
select * from t1 order by col1;
6275
select * from t2 order by col1;
6280
select * from t3 order by col1;
6285
select * from t4 order by colint;
6291
select * from t5 order by colint;
6297
select * from t6 order by colint;
6303
-------------------------------------------------------------------------
6304
--- Alter tables with dayofyear(col1)
6305
-------------------------------------------------------------------------
6306
drop table if exists t11 ;
6307
drop table if exists t22 ;
6308
drop table if exists t33 ;
6309
drop table if exists t44 ;
6310
drop table if exists t55 ;
6311
drop table if exists t66 ;
6312
create table t11 engine='NDB' as select * from t1;
6313
create table t22 engine='NDB' as select * from t2;
6314
create table t33 engine='NDB' as select * from t3;
6315
create table t44 engine='NDB' as select * from t4;
6316
create table t55 engine='NDB' as select * from t5;
6317
create table t66 engine='NDB' as select * from t6;
6319
partition by range(dayofyear(col1))
6320
(partition p0 values less than (15),
6321
partition p1 values less than maxvalue);
6323
partition by list(dayofyear(col1))
6324
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6325
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6326
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6327
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6328
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6329
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6332
partition by hash(dayofyear(col1));
6334
partition by range(colint)
6335
subpartition by hash(dayofyear(col1)) subpartitions 2
6336
(partition p0 values less than (15),
6337
partition p1 values less than maxvalue);
6339
partition by list(colint)
6340
subpartition by hash(dayofyear(col1)) subpartitions 2
6341
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6342
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6343
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6344
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6345
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6346
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6349
partition by range(colint)
6350
(partition p0 values less than (dayofyear('2006-12-25')),
6351
partition p1 values less than maxvalue);
6352
select * from t11 order by col1;
6356
select * from t22 order by col1;
6361
select * from t33 order by col1;
6366
select * from t44 order by colint;
6372
select * from t55 order by colint;
6378
select * from t66 order by colint;
6384
---------------------------
6385
---- some alter table begin
6386
---------------------------
6388
reorganize partition p0,p1 into
6389
(partition s1 values less than maxvalue);
6390
select * from t11 order by col1;
6395
reorganize partition s1 into
6396
(partition p0 values less than (15),
6397
partition p1 values less than maxvalue);
6398
select * from t11 order by col1;
6403
partition by list(colint)
6404
subpartition by hash(dayofyear(col1)) subpartitions 5
6405
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6406
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6407
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6408
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6409
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6410
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6412
show create table t55;
6414
t55 CREATE TABLE `t55` (
6415
`colint` int(11) DEFAULT NULL,
6416
`col1` char(30) DEFAULT NULL
6417
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (dayofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
6418
select * from t55 order by colint;
6425
reorganize partition p0,p1 into
6426
(partition s1 values less than maxvalue);
6427
select * from t66 order by colint;
6434
reorganize partition s1 into
6435
(partition p0 values less than (dayofyear('2006-12-25')),
6436
partition p1 values less than maxvalue);
6437
select * from t66 order by colint;
6444
reorganize partition p0,p1 into
6445
(partition s1 values less than maxvalue);
6446
select * from t66 order by colint;
6453
reorganize partition s1 into
6454
(partition p0 values less than (dayofyear('2006-12-25')),
6455
partition p1 values less than maxvalue);
6456
select * from t66 order by colint;
6462
-------------------------------------------------------------------------
6463
--- Delete rows and partitions of tables with dayofyear(col1)
6464
-------------------------------------------------------------------------
6465
delete from t1 where col1='2006-01-17';
6466
delete from t2 where col1='2006-01-17';
6467
delete from t3 where col1='2006-01-17';
6468
delete from t4 where col1='2006-01-17';
6469
delete from t5 where col1='2006-01-17';
6470
delete from t6 where col1='2006-01-17';
6471
select * from t1 order by col1;
6474
select * from t2 order by col1;
6478
select * from t3 order by col1;
6482
select * from t4 order by colint;
6487
select * from t5 order by colint;
6492
insert into t1 values ('2006-01-17');
6493
insert into t2 values ('2006-01-17');
6494
insert into t3 values ('2006-01-17');
6495
insert into t4 values (60,'2006-01-17');
6496
insert into t5 values (60,'2006-01-17');
6497
insert into t6 values (60,'2006-01-17');
6498
select * from t1 order by col1;
6502
select * from t2 order by col1;
6507
select * from t3 order by col1;
6512
select * from t4 order by colint;
6518
select * from t5 order by colint;
6524
select * from t6 order by colint;
6530
alter table t1 drop partition p0;
6531
alter table t2 drop partition p0;
6532
alter table t4 drop partition p0;
6533
alter table t5 drop partition p0;
6534
alter table t6 drop partition p0;
6535
select * from t1 order by col1;
6539
select * from t2 order by col1;
6544
select * from t3 order by col1;
6549
select * from t4 order by colint;
6552
select * from t5 order by colint;
6555
select * from t6 order by colint;
6557
-------------------------------------------------------------------------
6558
--- Delete rows and partitions of tables with dayofyear(col1)
6559
-------------------------------------------------------------------------
6560
delete from t11 where col1='2006-01-17';
6561
delete from t22 where col1='2006-01-17';
6562
delete from t33 where col1='2006-01-17';
6563
delete from t44 where col1='2006-01-17';
6564
delete from t55 where col1='2006-01-17';
6565
delete from t66 where col1='2006-01-17';
6566
select * from t11 order by col1;
6569
select * from t22 order by col1;
6573
select * from t33 order by col1;
6577
select * from t44 order by colint;
6582
select * from t55 order by colint;
6587
insert into t11 values ('2006-01-17');
6588
insert into t22 values ('2006-01-17');
6589
insert into t33 values ('2006-01-17');
6590
insert into t44 values (60,'2006-01-17');
6591
insert into t55 values (60,'2006-01-17');
6592
insert into t66 values (60,'2006-01-17');
6593
select * from t11 order by col1;
6597
select * from t22 order by col1;
6602
select * from t33 order by col1;
6607
select * from t44 order by colint;
6613
select * from t55 order by colint;
6619
select * from t66 order by colint;
6625
alter table t11 drop partition p0;
6626
alter table t22 drop partition p0;
6627
alter table t44 drop partition p0;
6628
alter table t55 drop partition p0;
6629
alter table t66 drop partition p0;
6630
select * from t11 order by col1;
6634
select * from t22 order by col1;
6639
select * from t33 order by col1;
6644
select * from t44 order by colint;
6647
select * from t55 order by colint;
6650
select * from t66 order by colint;
6652
-------------------------
6653
---- some alter table end
6654
-------------------------
6655
drop table if exists t1 ;
6656
drop table if exists t2 ;
6657
drop table if exists t3 ;
6658
drop table if exists t4 ;
6659
drop table if exists t5 ;
6660
drop table if exists t6 ;
6661
drop table if exists t11 ;
6662
drop table if exists t22 ;
6663
drop table if exists t33 ;
6664
drop table if exists t44 ;
6665
drop table if exists t55 ;
6666
drop table if exists t66 ;
6667
-------------------------------------------------------------------------
6668
--- extract(month from col1) in partition with coltype date
6669
-------------------------------------------------------------------------
6670
drop table if exists t1 ;
6671
drop table if exists t2 ;
6672
drop table if exists t3 ;
6673
drop table if exists t4 ;
6674
drop table if exists t5 ;
6675
drop table if exists t6 ;
6676
-------------------------------------------------------------------------
6677
--- Create tables with extract(month from col1)
6678
-------------------------------------------------------------------------
6679
create table t1 (col1 date) engine='NDB'
6680
partition by range(extract(month from col1))
6681
(partition p0 values less than (15),
6682
partition p1 values less than maxvalue);
6683
create table t2 (col1 date) engine='NDB'
6684
partition by list(extract(month from col1))
6685
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6686
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6687
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6688
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6689
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6690
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6692
create table t3 (col1 date) engine='NDB'
6693
partition by hash(extract(month from col1));
6694
create table t4 (colint int, col1 date) engine='NDB'
6695
partition by range(colint)
6696
subpartition by hash(extract(month from col1)) subpartitions 2
6697
(partition p0 values less than (15),
6698
partition p1 values less than maxvalue);
6699
create table t5 (colint int, col1 date) engine='NDB'
6700
partition by list(colint)
6701
subpartition by hash(extract(month from col1)) subpartitions 2
6702
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6703
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6704
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6705
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6706
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6707
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6709
create table t6 (colint int, col1 date) engine='NDB'
6710
partition by range(colint)
6711
(partition p0 values less than (extract(year from '1998-11-23')),
6712
partition p1 values less than maxvalue);
6713
-------------------------------------------------------------------------
6714
--- Access tables with extract(month from col1)
6715
-------------------------------------------------------------------------
6716
insert into t1 values ('2006-01-03');
6717
insert into t1 values ('2006-02-17');
6718
insert into t2 values ('2006-01-03');
6719
insert into t2 values ('2006-02-17');
6720
insert into t2 values ('2006-01-25');
6721
insert into t3 values ('2006-01-03');
6722
insert into t3 values ('2006-02-17');
6723
insert into t3 values ('2006-01-25');
6724
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
6725
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
6726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
6727
select extract(month from col1) from t1 order by col1;
6728
extract(month from col1)
6731
select * from t1 order by col1;
6735
select * from t2 order by col1;
6740
select * from t3 order by col1;
6745
select * from t4 order by colint;
6751
select * from t5 order by colint;
6757
select * from t6 order by colint;
6763
update t1 set col1='2006-02-05' where col1='2006-01-03';
6764
update t2 set col1='2006-02-05' where col1='2006-01-03';
6765
update t3 set col1='2006-02-05' where col1='2006-01-03';
6766
update t4 set col1='2006-02-05' where col1='2006-01-03';
6767
update t5 set col1='2006-02-05' where col1='2006-01-03';
6768
update t6 set col1='2006-02-05' where col1='2006-01-03';
6769
select * from t1 order by col1;
6773
select * from t2 order by col1;
6778
select * from t3 order by col1;
6783
select * from t4 order by colint;
6789
select * from t5 order by colint;
6795
select * from t6 order by colint;
6801
-------------------------------------------------------------------------
6802
--- Alter tables with extract(month from col1)
6803
-------------------------------------------------------------------------
6804
drop table if exists t11 ;
6805
drop table if exists t22 ;
6806
drop table if exists t33 ;
6807
drop table if exists t44 ;
6808
drop table if exists t55 ;
6809
drop table if exists t66 ;
6810
create table t11 engine='NDB' as select * from t1;
6811
create table t22 engine='NDB' as select * from t2;
6812
create table t33 engine='NDB' as select * from t3;
6813
create table t44 engine='NDB' as select * from t4;
6814
create table t55 engine='NDB' as select * from t5;
6815
create table t66 engine='NDB' as select * from t6;
6817
partition by range(extract(month from col1))
6818
(partition p0 values less than (15),
6819
partition p1 values less than maxvalue);
6821
partition by list(extract(month from col1))
6822
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
6823
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6824
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6825
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6826
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6827
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6830
partition by hash(extract(month from col1));
6832
partition by range(colint)
6833
subpartition by hash(extract(month from col1)) subpartitions 2
6834
(partition p0 values less than (15),
6835
partition p1 values less than maxvalue);
6837
partition by list(colint)
6838
subpartition by hash(extract(month from col1)) subpartitions 2
6839
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6840
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6841
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6842
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6843
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6844
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6847
partition by range(colint)
6848
(partition p0 values less than (extract(year from '1998-11-23')),
6849
partition p1 values less than maxvalue);
6850
select * from t11 order by col1;
6854
select * from t22 order by col1;
6859
select * from t33 order by col1;
6864
select * from t44 order by colint;
6870
select * from t55 order by colint;
6876
select * from t66 order by colint;
6882
---------------------------
6883
---- some alter table begin
6884
---------------------------
6886
reorganize partition p0,p1 into
6887
(partition s1 values less than maxvalue);
6888
select * from t11 order by col1;
6893
reorganize partition s1 into
6894
(partition p0 values less than (15),
6895
partition p1 values less than maxvalue);
6896
select * from t11 order by col1;
6901
partition by list(colint)
6902
subpartition by hash(extract(month from col1)) subpartitions 5
6903
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
6904
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
6905
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
6906
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
6907
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
6908
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
6910
show create table t55;
6912
t55 CREATE TABLE `t55` (
6913
`colint` int(11) DEFAULT NULL,
6914
`col1` date DEFAULT NULL
6915
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (extract(month from col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
6916
select * from t55 order by colint;
6923
reorganize partition p0,p1 into
6924
(partition s1 values less than maxvalue);
6925
select * from t66 order by colint;
6932
reorganize partition s1 into
6933
(partition p0 values less than (extract(year from '1998-11-23')),
6934
partition p1 values less than maxvalue);
6935
select * from t66 order by colint;
6942
reorganize partition p0,p1 into
6943
(partition s1 values less than maxvalue);
6944
select * from t66 order by colint;
6951
reorganize partition s1 into
6952
(partition p0 values less than (extract(year from '1998-11-23')),
6953
partition p1 values less than maxvalue);
6954
select * from t66 order by colint;
6960
-------------------------------------------------------------------------
6961
--- Delete rows and partitions of tables with extract(month from col1)
6962
-------------------------------------------------------------------------
6963
delete from t1 where col1='2006-02-17';
6964
delete from t2 where col1='2006-02-17';
6965
delete from t3 where col1='2006-02-17';
6966
delete from t4 where col1='2006-02-17';
6967
delete from t5 where col1='2006-02-17';
6968
delete from t6 where col1='2006-02-17';
6969
select * from t1 order by col1;
6972
select * from t2 order by col1;
6976
select * from t3 order by col1;
6980
select * from t4 order by colint;
6986
select * from t5 order by colint;
6992
insert into t1 values ('2006-02-17');
6993
insert into t2 values ('2006-02-17');
6994
insert into t3 values ('2006-02-17');
6995
insert into t4 values (60,'2006-02-17');
6996
insert into t5 values (60,'2006-02-17');
6997
insert into t6 values (60,'2006-02-17');
6998
select * from t1 order by col1;
7002
select * from t2 order by col1;
7007
select * from t3 order by col1;
7012
select * from t4 order by colint;
7019
select * from t5 order by colint;
7026
select * from t6 order by colint;
7033
alter table t1 drop partition p0;
7034
alter table t2 drop partition p0;
7035
alter table t4 drop partition p0;
7036
alter table t5 drop partition p0;
7037
alter table t6 drop partition p0;
7038
select * from t1 order by col1;
7040
select * from t2 order by col1;
7042
select * from t3 order by col1;
7047
select * from t4 order by colint;
7050
select * from t5 order by colint;
7053
select * from t6 order by colint;
7055
-------------------------------------------------------------------------
7056
--- Delete rows and partitions of tables with extract(month from col1)
7057
-------------------------------------------------------------------------
7058
delete from t11 where col1='2006-02-17';
7059
delete from t22 where col1='2006-02-17';
7060
delete from t33 where col1='2006-02-17';
7061
delete from t44 where col1='2006-02-17';
7062
delete from t55 where col1='2006-02-17';
7063
delete from t66 where col1='2006-02-17';
7064
select * from t11 order by col1;
7067
select * from t22 order by col1;
7071
select * from t33 order by col1;
7075
select * from t44 order by colint;
7081
select * from t55 order by colint;
7087
insert into t11 values ('2006-02-17');
7088
insert into t22 values ('2006-02-17');
7089
insert into t33 values ('2006-02-17');
7090
insert into t44 values (60,'2006-02-17');
7091
insert into t55 values (60,'2006-02-17');
7092
insert into t66 values (60,'2006-02-17');
7093
select * from t11 order by col1;
7097
select * from t22 order by col1;
7102
select * from t33 order by col1;
7107
select * from t44 order by colint;
7114
select * from t55 order by colint;
7121
select * from t66 order by colint;
7128
alter table t11 drop partition p0;
7129
alter table t22 drop partition p0;
7130
alter table t44 drop partition p0;
7131
alter table t55 drop partition p0;
7132
alter table t66 drop partition p0;
7133
select * from t11 order by col1;
7135
select * from t22 order by col1;
7137
select * from t33 order by col1;
7142
select * from t44 order by colint;
7145
select * from t55 order by colint;
7148
select * from t66 order by colint;
7150
-------------------------
7151
---- some alter table end
7152
-------------------------
7153
drop table if exists t1 ;
7154
drop table if exists t2 ;
7155
drop table if exists t3 ;
7156
drop table if exists t4 ;
7157
drop table if exists t5 ;
7158
drop table if exists t6 ;
7159
drop table if exists t11 ;
7160
drop table if exists t22 ;
7161
drop table if exists t33 ;
7162
drop table if exists t44 ;
7163
drop table if exists t55 ;
7164
drop table if exists t66 ;
7165
-------------------------------------------------------------------------
7166
--- hour(col1) in partition with coltype time
7167
-------------------------------------------------------------------------
7168
drop table if exists t1 ;
7169
drop table if exists t2 ;
7170
drop table if exists t3 ;
7171
drop table if exists t4 ;
7172
drop table if exists t5 ;
7173
drop table if exists t6 ;
7174
-------------------------------------------------------------------------
7175
--- Create tables with hour(col1)
7176
-------------------------------------------------------------------------
7177
create table t1 (col1 time) engine='NDB'
7178
partition by range(hour(col1))
7179
(partition p0 values less than (15),
7180
partition p1 values less than maxvalue);
7181
create table t2 (col1 time) engine='NDB'
7182
partition by list(hour(col1))
7183
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7184
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7185
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7186
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7187
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7188
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7190
create table t3 (col1 time) engine='NDB'
7191
partition by hash(hour(col1));
7192
create table t4 (colint int, col1 time) engine='NDB'
7193
partition by range(colint)
7194
subpartition by hash(hour(col1)) subpartitions 2
7195
(partition p0 values less than (15),
7196
partition p1 values less than maxvalue);
7197
create table t5 (colint int, col1 time) engine='NDB'
7198
partition by list(colint)
7199
subpartition by hash(hour(col1)) subpartitions 2
7200
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7201
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7202
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7203
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7204
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7205
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7207
create table t6 (colint int, col1 time) engine='NDB'
7208
partition by range(colint)
7209
(partition p0 values less than (hour('18:30')),
7210
partition p1 values less than maxvalue);
7211
-------------------------------------------------------------------------
7212
--- Access tables with hour(col1)
7213
-------------------------------------------------------------------------
7214
insert into t1 values ('09:09');
7215
insert into t1 values ('14:30');
7216
insert into t2 values ('09:09');
7217
insert into t2 values ('14:30');
7218
insert into t2 values ('21:59');
7219
insert into t3 values ('09:09');
7220
insert into t3 values ('14:30');
7221
insert into t3 values ('21:59');
7222
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
7223
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
7224
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
7225
select hour(col1) from t1 order by col1;
7229
select * from t1 order by col1;
7233
select * from t2 order by col1;
7238
select * from t3 order by col1;
7243
select * from t4 order by colint;
7249
select * from t5 order by colint;
7255
select * from t6 order by colint;
7261
update t1 set col1='10:30' where col1='09:09';
7262
update t2 set col1='10:30' where col1='09:09';
7263
update t3 set col1='10:30' where col1='09:09';
7264
update t4 set col1='10:30' where col1='09:09';
7265
update t5 set col1='10:30' where col1='09:09';
7266
update t6 set col1='10:30' where col1='09:09';
7267
select * from t1 order by col1;
7271
select * from t2 order by col1;
7276
select * from t3 order by col1;
7281
select * from t4 order by colint;
7287
select * from t5 order by colint;
7293
select * from t6 order by colint;
7299
-------------------------------------------------------------------------
7300
--- Alter tables with hour(col1)
7301
-------------------------------------------------------------------------
7302
drop table if exists t11 ;
7303
drop table if exists t22 ;
7304
drop table if exists t33 ;
7305
drop table if exists t44 ;
7306
drop table if exists t55 ;
7307
drop table if exists t66 ;
7308
create table t11 engine='NDB' as select * from t1;
7309
create table t22 engine='NDB' as select * from t2;
7310
create table t33 engine='NDB' as select * from t3;
7311
create table t44 engine='NDB' as select * from t4;
7312
create table t55 engine='NDB' as select * from t5;
7313
create table t66 engine='NDB' as select * from t6;
7315
partition by range(hour(col1))
7316
(partition p0 values less than (15),
7317
partition p1 values less than maxvalue);
7319
partition by list(hour(col1))
7320
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7321
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7322
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7323
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7324
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7325
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7328
partition by hash(hour(col1));
7330
partition by range(colint)
7331
subpartition by hash(hour(col1)) subpartitions 2
7332
(partition p0 values less than (15),
7333
partition p1 values less than maxvalue);
7335
partition by list(colint)
7336
subpartition by hash(hour(col1)) subpartitions 2
7337
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7338
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7339
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7340
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7341
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7342
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7345
partition by range(colint)
7346
(partition p0 values less than (hour('18:30')),
7347
partition p1 values less than maxvalue);
7348
select * from t11 order by col1;
7352
select * from t22 order by col1;
7357
select * from t33 order by col1;
7362
select * from t44 order by colint;
7368
select * from t55 order by colint;
7374
select * from t66 order by colint;
7380
---------------------------
7381
---- some alter table begin
7382
---------------------------
7384
reorganize partition p0,p1 into
7385
(partition s1 values less than maxvalue);
7386
select * from t11 order by col1;
7391
reorganize partition s1 into
7392
(partition p0 values less than (15),
7393
partition p1 values less than maxvalue);
7394
select * from t11 order by col1;
7399
partition by list(colint)
7400
subpartition by hash(hour(col1)) subpartitions 5
7401
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7402
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7403
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7404
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7405
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7406
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7408
show create table t55;
7410
t55 CREATE TABLE `t55` (
7411
`colint` int(11) DEFAULT NULL,
7412
`col1` time DEFAULT NULL
7413
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (hour(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
7414
select * from t55 order by colint;
7421
reorganize partition p0,p1 into
7422
(partition s1 values less than maxvalue);
7423
select * from t66 order by colint;
7430
reorganize partition s1 into
7431
(partition p0 values less than (hour('18:30')),
7432
partition p1 values less than maxvalue);
7433
select * from t66 order by colint;
7440
reorganize partition p0,p1 into
7441
(partition s1 values less than maxvalue);
7442
select * from t66 order by colint;
7449
reorganize partition s1 into
7450
(partition p0 values less than (hour('18:30')),
7451
partition p1 values less than maxvalue);
7452
select * from t66 order by colint;
7458
-------------------------------------------------------------------------
7459
--- Delete rows and partitions of tables with hour(col1)
7460
-------------------------------------------------------------------------
7461
delete from t1 where col1='14:30';
7462
delete from t2 where col1='14:30';
7463
delete from t3 where col1='14:30';
7464
delete from t4 where col1='14:30';
7465
delete from t5 where col1='14:30';
7466
delete from t6 where col1='14:30';
7467
select * from t1 order by col1;
7470
select * from t2 order by col1;
7474
select * from t3 order by col1;
7478
select * from t4 order by colint;
7484
select * from t5 order by colint;
7490
insert into t1 values ('14:30');
7491
insert into t2 values ('14:30');
7492
insert into t3 values ('14:30');
7493
insert into t4 values (60,'14:30');
7494
insert into t5 values (60,'14:30');
7495
insert into t6 values (60,'14:30');
7496
select * from t1 order by col1;
7500
select * from t2 order by col1;
7505
select * from t3 order by col1;
7510
select * from t4 order by colint;
7517
select * from t5 order by colint;
7524
select * from t6 order by colint;
7531
alter table t1 drop partition p0;
7532
alter table t2 drop partition p0;
7533
alter table t4 drop partition p0;
7534
alter table t5 drop partition p0;
7535
alter table t6 drop partition p0;
7536
select * from t1 order by col1;
7538
select * from t2 order by col1;
7542
select * from t3 order by col1;
7547
select * from t4 order by colint;
7550
select * from t5 order by colint;
7553
select * from t6 order by colint;
7556
-------------------------------------------------------------------------
7557
--- Delete rows and partitions of tables with hour(col1)
7558
-------------------------------------------------------------------------
7559
delete from t11 where col1='14:30';
7560
delete from t22 where col1='14:30';
7561
delete from t33 where col1='14:30';
7562
delete from t44 where col1='14:30';
7563
delete from t55 where col1='14:30';
7564
delete from t66 where col1='14:30';
7565
select * from t11 order by col1;
7568
select * from t22 order by col1;
7572
select * from t33 order by col1;
7576
select * from t44 order by colint;
7582
select * from t55 order by colint;
7588
insert into t11 values ('14:30');
7589
insert into t22 values ('14:30');
7590
insert into t33 values ('14:30');
7591
insert into t44 values (60,'14:30');
7592
insert into t55 values (60,'14:30');
7593
insert into t66 values (60,'14:30');
7594
select * from t11 order by col1;
7598
select * from t22 order by col1;
7603
select * from t33 order by col1;
7608
select * from t44 order by colint;
7615
select * from t55 order by colint;
7622
select * from t66 order by colint;
7629
alter table t11 drop partition p0;
7630
alter table t22 drop partition p0;
7631
alter table t44 drop partition p0;
7632
alter table t55 drop partition p0;
7633
alter table t66 drop partition p0;
7634
select * from t11 order by col1;
7636
select * from t22 order by col1;
7640
select * from t33 order by col1;
7645
select * from t44 order by colint;
7648
select * from t55 order by colint;
7651
select * from t66 order by colint;
7654
-------------------------
7655
---- some alter table end
7656
-------------------------
7657
drop table if exists t1 ;
7658
drop table if exists t2 ;
7659
drop table if exists t3 ;
7660
drop table if exists t4 ;
7661
drop table if exists t5 ;
7662
drop table if exists t6 ;
7663
drop table if exists t11 ;
7664
drop table if exists t22 ;
7665
drop table if exists t33 ;
7666
drop table if exists t44 ;
7667
drop table if exists t55 ;
7668
drop table if exists t66 ;
7669
-------------------------------------------------------------------------
7670
--- microsecond(col1) in partition with coltype time
7671
-------------------------------------------------------------------------
7672
drop table if exists t1 ;
7673
drop table if exists t2 ;
7674
drop table if exists t3 ;
7675
drop table if exists t4 ;
7676
drop table if exists t5 ;
7677
drop table if exists t6 ;
7678
-------------------------------------------------------------------------
7679
--- Create tables with microsecond(col1)
7680
-------------------------------------------------------------------------
7681
create table t1 (col1 time) engine='NDB'
7682
partition by range(microsecond(col1))
7683
(partition p0 values less than (15),
7684
partition p1 values less than maxvalue);
7685
create table t2 (col1 time) engine='NDB'
7686
partition by list(microsecond(col1))
7687
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7688
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7689
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7690
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7691
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7692
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7694
create table t3 (col1 time) engine='NDB'
7695
partition by hash(microsecond(col1));
7696
create table t4 (colint int, col1 time) engine='NDB'
7697
partition by range(colint)
7698
subpartition by hash(microsecond(col1)) subpartitions 2
7699
(partition p0 values less than (15),
7700
partition p1 values less than maxvalue);
7701
create table t5 (colint int, col1 time) engine='NDB'
7702
partition by list(colint)
7703
subpartition by hash(microsecond(col1)) subpartitions 2
7704
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7705
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7706
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7707
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7708
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7709
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7711
create table t6 (colint int, col1 time) engine='NDB'
7712
partition by range(colint)
7713
(partition p0 values less than (microsecond('10:30:10.000010')),
7714
partition p1 values less than maxvalue);
7715
-------------------------------------------------------------------------
7716
--- Access tables with microsecond(col1)
7717
-------------------------------------------------------------------------
7718
insert into t1 values ('09:09:15.000002');
7719
insert into t1 values ('04:30:01.000018');
7720
insert into t2 values ('09:09:15.000002');
7721
insert into t2 values ('04:30:01.000018');
7722
insert into t2 values ('00:59:22.000024');
7723
insert into t3 values ('09:09:15.000002');
7724
insert into t3 values ('04:30:01.000018');
7725
insert into t3 values ('00:59:22.000024');
7726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
7727
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
7728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
7729
select microsecond(col1) from t1 order by col1;
7733
select * from t1 order by col1;
7737
select * from t2 order by col1;
7742
select * from t3 order by col1;
7747
select * from t4 order by colint;
7753
select * from t5 order by colint;
7759
select * from t6 order by colint;
7765
update t1 set col1='05:30:34.000037' where col1='09:09:15.000002';
7766
update t2 set col1='05:30:34.000037' where col1='09:09:15.000002';
7767
update t3 set col1='05:30:34.000037' where col1='09:09:15.000002';
7768
update t4 set col1='05:30:34.000037' where col1='09:09:15.000002';
7769
update t5 set col1='05:30:34.000037' where col1='09:09:15.000002';
7770
update t6 set col1='05:30:34.000037' where col1='09:09:15.000002';
7771
select * from t1 order by col1;
7775
select * from t2 order by col1;
7780
select * from t3 order by col1;
7785
select * from t4 order by colint;
7791
select * from t5 order by colint;
7797
select * from t6 order by colint;
7803
-------------------------------------------------------------------------
7804
--- Alter tables with microsecond(col1)
7805
-------------------------------------------------------------------------
7806
drop table if exists t11 ;
7807
drop table if exists t22 ;
7808
drop table if exists t33 ;
7809
drop table if exists t44 ;
7810
drop table if exists t55 ;
7811
drop table if exists t66 ;
7812
create table t11 engine='NDB' as select * from t1;
7813
create table t22 engine='NDB' as select * from t2;
7814
create table t33 engine='NDB' as select * from t3;
7815
create table t44 engine='NDB' as select * from t4;
7816
create table t55 engine='NDB' as select * from t5;
7817
create table t66 engine='NDB' as select * from t6;
7819
partition by range(microsecond(col1))
7820
(partition p0 values less than (15),
7821
partition p1 values less than maxvalue);
7823
partition by list(microsecond(col1))
7824
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
7825
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7826
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7827
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7828
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7829
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7832
partition by hash(microsecond(col1));
7834
partition by range(colint)
7835
subpartition by hash(microsecond(col1)) subpartitions 2
7836
(partition p0 values less than (15),
7837
partition p1 values less than maxvalue);
7839
partition by list(colint)
7840
subpartition by hash(microsecond(col1)) subpartitions 2
7841
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7842
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7843
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7844
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7845
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7846
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7849
partition by range(colint)
7850
(partition p0 values less than (microsecond('10:30:10.000010')),
7851
partition p1 values less than maxvalue);
7852
select * from t11 order by col1;
7856
select * from t22 order by col1;
7861
select * from t33 order by col1;
7866
select * from t44 order by colint;
7872
select * from t55 order by colint;
7878
select * from t66 order by colint;
7884
---------------------------
7885
---- some alter table begin
7886
---------------------------
7888
reorganize partition p0,p1 into
7889
(partition s1 values less than maxvalue);
7890
select * from t11 order by col1;
7895
reorganize partition s1 into
7896
(partition p0 values less than (15),
7897
partition p1 values less than maxvalue);
7898
select * from t11 order by col1;
7903
partition by list(colint)
7904
subpartition by hash(microsecond(col1)) subpartitions 5
7905
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
7906
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
7907
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
7908
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
7909
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
7910
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
7912
show create table t55;
7914
t55 CREATE TABLE `t55` (
7915
`colint` int(11) DEFAULT NULL,
7916
`col1` time DEFAULT NULL
7917
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (microsecond(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
7918
select * from t55 order by colint;
7925
reorganize partition p0,p1 into
7926
(partition s1 values less than maxvalue);
7927
select * from t66 order by colint;
7934
reorganize partition s1 into
7935
(partition p0 values less than (microsecond('10:30:10.000010')),
7936
partition p1 values less than maxvalue);
7937
select * from t66 order by colint;
7944
reorganize partition p0,p1 into
7945
(partition s1 values less than maxvalue);
7946
select * from t66 order by colint;
7953
reorganize partition s1 into
7954
(partition p0 values less than (microsecond('10:30:10.000010')),
7955
partition p1 values less than maxvalue);
7956
select * from t66 order by colint;
7962
-------------------------------------------------------------------------
7963
--- Delete rows and partitions of tables with microsecond(col1)
7964
-------------------------------------------------------------------------
7965
delete from t1 where col1='04:30:01.000018';
7966
delete from t2 where col1='04:30:01.000018';
7967
delete from t3 where col1='04:30:01.000018';
7968
delete from t4 where col1='04:30:01.000018';
7969
delete from t5 where col1='04:30:01.000018';
7970
delete from t6 where col1='04:30:01.000018';
7971
select * from t1 order by col1;
7974
select * from t2 order by col1;
7978
select * from t3 order by col1;
7982
select * from t4 order by colint;
7987
select * from t5 order by colint;
7992
insert into t1 values ('04:30:01.000018');
7993
insert into t2 values ('04:30:01.000018');
7994
insert into t3 values ('04:30:01.000018');
7995
insert into t4 values (60,'04:30:01.000018');
7996
insert into t5 values (60,'04:30:01.000018');
7997
insert into t6 values (60,'04:30:01.000018');
7998
select * from t1 order by col1;
8002
select * from t2 order by col1;
8007
select * from t3 order by col1;
8012
select * from t4 order by colint;
8018
select * from t5 order by colint;
8024
select * from t6 order by colint;
8030
alter table t1 drop partition p0;
8031
alter table t2 drop partition p0;
8032
alter table t4 drop partition p0;
8033
alter table t5 drop partition p0;
8034
alter table t6 drop partition p0;
8035
select * from t1 order by col1;
8037
select * from t2 order by col1;
8039
select * from t3 order by col1;
8044
select * from t4 order by colint;
8047
select * from t5 order by colint;
8050
select * from t6 order by colint;
8053
-------------------------------------------------------------------------
8054
--- Delete rows and partitions of tables with microsecond(col1)
8055
-------------------------------------------------------------------------
8056
delete from t11 where col1='04:30:01.000018';
8057
delete from t22 where col1='04:30:01.000018';
8058
delete from t33 where col1='04:30:01.000018';
8059
delete from t44 where col1='04:30:01.000018';
8060
delete from t55 where col1='04:30:01.000018';
8061
delete from t66 where col1='04:30:01.000018';
8062
select * from t11 order by col1;
8065
select * from t22 order by col1;
8069
select * from t33 order by col1;
8073
select * from t44 order by colint;
8078
select * from t55 order by colint;
8083
insert into t11 values ('04:30:01.000018');
8084
insert into t22 values ('04:30:01.000018');
8085
insert into t33 values ('04:30:01.000018');
8086
insert into t44 values (60,'04:30:01.000018');
8087
insert into t55 values (60,'04:30:01.000018');
8088
insert into t66 values (60,'04:30:01.000018');
8089
select * from t11 order by col1;
8093
select * from t22 order by col1;
8098
select * from t33 order by col1;
8103
select * from t44 order by colint;
8109
select * from t55 order by colint;
8115
select * from t66 order by colint;
8121
alter table t11 drop partition p0;
8122
alter table t22 drop partition p0;
8123
alter table t44 drop partition p0;
8124
alter table t55 drop partition p0;
8125
alter table t66 drop partition p0;
8126
select * from t11 order by col1;
8128
select * from t22 order by col1;
8130
select * from t33 order by col1;
8135
select * from t44 order by colint;
8138
select * from t55 order by colint;
8141
select * from t66 order by colint;
8144
-------------------------
8145
---- some alter table end
8146
-------------------------
8147
drop table if exists t1 ;
8148
drop table if exists t2 ;
8149
drop table if exists t3 ;
8150
drop table if exists t4 ;
8151
drop table if exists t5 ;
8152
drop table if exists t6 ;
8153
drop table if exists t11 ;
8154
drop table if exists t22 ;
8155
drop table if exists t33 ;
8156
drop table if exists t44 ;
8157
drop table if exists t55 ;
8158
drop table if exists t66 ;
8159
-------------------------------------------------------------------------
8160
--- minute(col1) in partition with coltype time
8161
-------------------------------------------------------------------------
8162
drop table if exists t1 ;
8163
drop table if exists t2 ;
8164
drop table if exists t3 ;
8165
drop table if exists t4 ;
8166
drop table if exists t5 ;
8167
drop table if exists t6 ;
8168
-------------------------------------------------------------------------
8169
--- Create tables with minute(col1)
8170
-------------------------------------------------------------------------
8171
create table t1 (col1 time) engine='NDB'
8172
partition by range(minute(col1))
8173
(partition p0 values less than (15),
8174
partition p1 values less than maxvalue);
8175
create table t2 (col1 time) engine='NDB'
8176
partition by list(minute(col1))
8177
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8178
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8179
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8180
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8181
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8182
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8184
create table t3 (col1 time) engine='NDB'
8185
partition by hash(minute(col1));
8186
create table t4 (colint int, col1 time) engine='NDB'
8187
partition by range(colint)
8188
subpartition by hash(minute(col1)) subpartitions 2
8189
(partition p0 values less than (15),
8190
partition p1 values less than maxvalue);
8191
create table t5 (colint int, col1 time) engine='NDB'
8192
partition by list(colint)
8193
subpartition by hash(minute(col1)) subpartitions 2
8194
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8195
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8196
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8197
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8198
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8199
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8201
create table t6 (colint int, col1 time) engine='NDB'
8202
partition by range(colint)
8203
(partition p0 values less than (minute('18:30')),
8204
partition p1 values less than maxvalue);
8205
-------------------------------------------------------------------------
8206
--- Access tables with minute(col1)
8207
-------------------------------------------------------------------------
8208
insert into t1 values ('09:09:15');
8209
insert into t1 values ('14:30:45');
8210
insert into t2 values ('09:09:15');
8211
insert into t2 values ('14:30:45');
8212
insert into t2 values ('21:59:22');
8213
insert into t3 values ('09:09:15');
8214
insert into t3 values ('14:30:45');
8215
insert into t3 values ('21:59:22');
8216
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
8217
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
8218
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
8219
select minute(col1) from t1 order by col1;
8223
select * from t1 order by col1;
8227
select * from t2 order by col1;
8232
select * from t3 order by col1;
8237
select * from t4 order by colint;
8243
select * from t5 order by colint;
8249
select * from t6 order by colint;
8255
update t1 set col1='10:24:23' where col1='09:09:15';
8256
update t2 set col1='10:24:23' where col1='09:09:15';
8257
update t3 set col1='10:24:23' where col1='09:09:15';
8258
update t4 set col1='10:24:23' where col1='09:09:15';
8259
update t5 set col1='10:24:23' where col1='09:09:15';
8260
update t6 set col1='10:24:23' where col1='09:09:15';
8261
select * from t1 order by col1;
8265
select * from t2 order by col1;
8270
select * from t3 order by col1;
8275
select * from t4 order by colint;
8281
select * from t5 order by colint;
8287
select * from t6 order by colint;
8293
-------------------------------------------------------------------------
8294
--- Alter tables with minute(col1)
8295
-------------------------------------------------------------------------
8296
drop table if exists t11 ;
8297
drop table if exists t22 ;
8298
drop table if exists t33 ;
8299
drop table if exists t44 ;
8300
drop table if exists t55 ;
8301
drop table if exists t66 ;
8302
create table t11 engine='NDB' as select * from t1;
8303
create table t22 engine='NDB' as select * from t2;
8304
create table t33 engine='NDB' as select * from t3;
8305
create table t44 engine='NDB' as select * from t4;
8306
create table t55 engine='NDB' as select * from t5;
8307
create table t66 engine='NDB' as select * from t6;
8309
partition by range(minute(col1))
8310
(partition p0 values less than (15),
8311
partition p1 values less than maxvalue);
8313
partition by list(minute(col1))
8314
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8315
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8316
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8317
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8318
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8319
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8322
partition by hash(minute(col1));
8324
partition by range(colint)
8325
subpartition by hash(minute(col1)) subpartitions 2
8326
(partition p0 values less than (15),
8327
partition p1 values less than maxvalue);
8329
partition by list(colint)
8330
subpartition by hash(minute(col1)) subpartitions 2
8331
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8332
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8333
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8334
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8335
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8336
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8339
partition by range(colint)
8340
(partition p0 values less than (minute('18:30')),
8341
partition p1 values less than maxvalue);
8342
select * from t11 order by col1;
8346
select * from t22 order by col1;
8351
select * from t33 order by col1;
8356
select * from t44 order by colint;
8362
select * from t55 order by colint;
8368
select * from t66 order by colint;
8374
---------------------------
8375
---- some alter table begin
8376
---------------------------
8378
reorganize partition p0,p1 into
8379
(partition s1 values less than maxvalue);
8380
select * from t11 order by col1;
8385
reorganize partition s1 into
8386
(partition p0 values less than (15),
8387
partition p1 values less than maxvalue);
8388
select * from t11 order by col1;
8393
partition by list(colint)
8394
subpartition by hash(minute(col1)) subpartitions 5
8395
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8396
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8397
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8398
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8399
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8400
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8402
show create table t55;
8404
t55 CREATE TABLE `t55` (
8405
`colint` int(11) DEFAULT NULL,
8406
`col1` time DEFAULT NULL
8407
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (minute(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
8408
select * from t55 order by colint;
8415
reorganize partition p0,p1 into
8416
(partition s1 values less than maxvalue);
8417
select * from t66 order by colint;
8424
reorganize partition s1 into
8425
(partition p0 values less than (minute('18:30')),
8426
partition p1 values less than maxvalue);
8427
select * from t66 order by colint;
8434
reorganize partition p0,p1 into
8435
(partition s1 values less than maxvalue);
8436
select * from t66 order by colint;
8443
reorganize partition s1 into
8444
(partition p0 values less than (minute('18:30')),
8445
partition p1 values less than maxvalue);
8446
select * from t66 order by colint;
8452
-------------------------------------------------------------------------
8453
--- Delete rows and partitions of tables with minute(col1)
8454
-------------------------------------------------------------------------
8455
delete from t1 where col1='14:30:45';
8456
delete from t2 where col1='14:30:45';
8457
delete from t3 where col1='14:30:45';
8458
delete from t4 where col1='14:30:45';
8459
delete from t5 where col1='14:30:45';
8460
delete from t6 where col1='14:30:45';
8461
select * from t1 order by col1;
8464
select * from t2 order by col1;
8468
select * from t3 order by col1;
8472
select * from t4 order by colint;
8478
select * from t5 order by colint;
8484
insert into t1 values ('14:30:45');
8485
insert into t2 values ('14:30:45');
8486
insert into t3 values ('14:30:45');
8487
insert into t4 values (60,'14:30:45');
8488
insert into t5 values (60,'14:30:45');
8489
insert into t6 values (60,'14:30:45');
8490
select * from t1 order by col1;
8494
select * from t2 order by col1;
8499
select * from t3 order by col1;
8504
select * from t4 order by colint;
8511
select * from t5 order by colint;
8518
select * from t6 order by colint;
8525
alter table t1 drop partition p0;
8526
alter table t2 drop partition p0;
8527
alter table t4 drop partition p0;
8528
alter table t5 drop partition p0;
8529
alter table t6 drop partition p0;
8530
select * from t1 order by col1;
8534
select * from t2 order by col1;
8539
select * from t3 order by col1;
8544
select * from t4 order by colint;
8547
select * from t5 order by colint;
8550
select * from t6 order by colint;
8553
-------------------------------------------------------------------------
8554
--- Delete rows and partitions of tables with minute(col1)
8555
-------------------------------------------------------------------------
8556
delete from t11 where col1='14:30:45';
8557
delete from t22 where col1='14:30:45';
8558
delete from t33 where col1='14:30:45';
8559
delete from t44 where col1='14:30:45';
8560
delete from t55 where col1='14:30:45';
8561
delete from t66 where col1='14:30:45';
8562
select * from t11 order by col1;
8565
select * from t22 order by col1;
8569
select * from t33 order by col1;
8573
select * from t44 order by colint;
8579
select * from t55 order by colint;
8585
insert into t11 values ('14:30:45');
8586
insert into t22 values ('14:30:45');
8587
insert into t33 values ('14:30:45');
8588
insert into t44 values (60,'14:30:45');
8589
insert into t55 values (60,'14:30:45');
8590
insert into t66 values (60,'14:30:45');
8591
select * from t11 order by col1;
8595
select * from t22 order by col1;
8600
select * from t33 order by col1;
8605
select * from t44 order by colint;
8612
select * from t55 order by colint;
8619
select * from t66 order by colint;
8626
alter table t11 drop partition p0;
8627
alter table t22 drop partition p0;
8628
alter table t44 drop partition p0;
8629
alter table t55 drop partition p0;
8630
alter table t66 drop partition p0;
8631
select * from t11 order by col1;
8635
select * from t22 order by col1;
8640
select * from t33 order by col1;
8645
select * from t44 order by colint;
8648
select * from t55 order by colint;
8651
select * from t66 order by colint;
8654
-------------------------
8655
---- some alter table end
8656
-------------------------
8657
drop table if exists t1 ;
8658
drop table if exists t2 ;
8659
drop table if exists t3 ;
8660
drop table if exists t4 ;
8661
drop table if exists t5 ;
8662
drop table if exists t6 ;
8663
drop table if exists t11 ;
8664
drop table if exists t22 ;
8665
drop table if exists t33 ;
8666
drop table if exists t44 ;
8667
drop table if exists t55 ;
8668
drop table if exists t66 ;
8669
-------------------------------------------------------------------------
8670
--- second(col1) in partition with coltype time
8671
-------------------------------------------------------------------------
8672
drop table if exists t1 ;
8673
drop table if exists t2 ;
8674
drop table if exists t3 ;
8675
drop table if exists t4 ;
8676
drop table if exists t5 ;
8677
drop table if exists t6 ;
8678
-------------------------------------------------------------------------
8679
--- Create tables with second(col1)
8680
-------------------------------------------------------------------------
8681
create table t1 (col1 time) engine='NDB'
8682
partition by range(second(col1))
8683
(partition p0 values less than (15),
8684
partition p1 values less than maxvalue);
8685
create table t2 (col1 time) engine='NDB'
8686
partition by list(second(col1))
8687
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8688
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8689
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8690
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8691
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8692
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8694
create table t3 (col1 time) engine='NDB'
8695
partition by hash(second(col1));
8696
create table t4 (colint int, col1 time) engine='NDB'
8697
partition by range(colint)
8698
subpartition by hash(second(col1)) subpartitions 2
8699
(partition p0 values less than (15),
8700
partition p1 values less than maxvalue);
8701
create table t5 (colint int, col1 time) engine='NDB'
8702
partition by list(colint)
8703
subpartition by hash(second(col1)) subpartitions 2
8704
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8705
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8706
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8707
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8708
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8709
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8711
create table t6 (colint int, col1 time) engine='NDB'
8712
partition by range(colint)
8713
(partition p0 values less than (second('18:30:14')),
8714
partition p1 values less than maxvalue);
8715
-------------------------------------------------------------------------
8716
--- Access tables with second(col1)
8717
-------------------------------------------------------------------------
8718
insert into t1 values ('09:09:09');
8719
insert into t1 values ('14:30:20');
8720
insert into t2 values ('09:09:09');
8721
insert into t2 values ('14:30:20');
8722
insert into t2 values ('21:59:22');
8723
insert into t3 values ('09:09:09');
8724
insert into t3 values ('14:30:20');
8725
insert into t3 values ('21:59:22');
8726
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
8727
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
8728
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
8729
select second(col1) from t1 order by col1;
8733
select * from t1 order by col1;
8737
select * from t2 order by col1;
8742
select * from t3 order by col1;
8747
select * from t4 order by colint;
8753
select * from t5 order by colint;
8759
select * from t6 order by colint;
8765
update t1 set col1='10:22:33' where col1='09:09:09';
8766
update t2 set col1='10:22:33' where col1='09:09:09';
8767
update t3 set col1='10:22:33' where col1='09:09:09';
8768
update t4 set col1='10:22:33' where col1='09:09:09';
8769
update t5 set col1='10:22:33' where col1='09:09:09';
8770
update t6 set col1='10:22:33' where col1='09:09:09';
8771
select * from t1 order by col1;
8775
select * from t2 order by col1;
8780
select * from t3 order by col1;
8785
select * from t4 order by colint;
8791
select * from t5 order by colint;
8797
select * from t6 order by colint;
8803
-------------------------------------------------------------------------
8804
--- Alter tables with second(col1)
8805
-------------------------------------------------------------------------
8806
drop table if exists t11 ;
8807
drop table if exists t22 ;
8808
drop table if exists t33 ;
8809
drop table if exists t44 ;
8810
drop table if exists t55 ;
8811
drop table if exists t66 ;
8812
create table t11 engine='NDB' as select * from t1;
8813
create table t22 engine='NDB' as select * from t2;
8814
create table t33 engine='NDB' as select * from t3;
8815
create table t44 engine='NDB' as select * from t4;
8816
create table t55 engine='NDB' as select * from t5;
8817
create table t66 engine='NDB' as select * from t6;
8819
partition by range(second(col1))
8820
(partition p0 values less than (15),
8821
partition p1 values less than maxvalue);
8823
partition by list(second(col1))
8824
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
8825
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8826
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8827
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8828
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8829
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8832
partition by hash(second(col1));
8834
partition by range(colint)
8835
subpartition by hash(second(col1)) subpartitions 2
8836
(partition p0 values less than (15),
8837
partition p1 values less than maxvalue);
8839
partition by list(colint)
8840
subpartition by hash(second(col1)) subpartitions 2
8841
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8842
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8843
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8844
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8845
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8846
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8849
partition by range(colint)
8850
(partition p0 values less than (second('18:30:14')),
8851
partition p1 values less than maxvalue);
8852
select * from t11 order by col1;
8856
select * from t22 order by col1;
8861
select * from t33 order by col1;
8866
select * from t44 order by colint;
8872
select * from t55 order by colint;
8878
select * from t66 order by colint;
8884
---------------------------
8885
---- some alter table begin
8886
---------------------------
8888
reorganize partition p0,p1 into
8889
(partition s1 values less than maxvalue);
8890
select * from t11 order by col1;
8895
reorganize partition s1 into
8896
(partition p0 values less than (15),
8897
partition p1 values less than maxvalue);
8898
select * from t11 order by col1;
8903
partition by list(colint)
8904
subpartition by hash(second(col1)) subpartitions 5
8905
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
8906
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
8907
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
8908
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
8909
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
8910
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
8912
show create table t55;
8914
t55 CREATE TABLE `t55` (
8915
`colint` int(11) DEFAULT NULL,
8916
`col1` time DEFAULT NULL
8917
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
8918
select * from t55 order by colint;
8925
reorganize partition p0,p1 into
8926
(partition s1 values less than maxvalue);
8927
select * from t66 order by colint;
8934
reorganize partition s1 into
8935
(partition p0 values less than (second('18:30:14')),
8936
partition p1 values less than maxvalue);
8937
select * from t66 order by colint;
8944
reorganize partition p0,p1 into
8945
(partition s1 values less than maxvalue);
8946
select * from t66 order by colint;
8953
reorganize partition s1 into
8954
(partition p0 values less than (second('18:30:14')),
8955
partition p1 values less than maxvalue);
8956
select * from t66 order by colint;
8962
-------------------------------------------------------------------------
8963
--- Delete rows and partitions of tables with second(col1)
8964
-------------------------------------------------------------------------
8965
delete from t1 where col1='14:30:20';
8966
delete from t2 where col1='14:30:20';
8967
delete from t3 where col1='14:30:20';
8968
delete from t4 where col1='14:30:20';
8969
delete from t5 where col1='14:30:20';
8970
delete from t6 where col1='14:30:20';
8971
select * from t1 order by col1;
8974
select * from t2 order by col1;
8978
select * from t3 order by col1;
8982
select * from t4 order by colint;
8988
select * from t5 order by colint;
8994
insert into t1 values ('14:30:20');
8995
insert into t2 values ('14:30:20');
8996
insert into t3 values ('14:30:20');
8997
insert into t4 values (60,'14:30:20');
8998
insert into t5 values (60,'14:30:20');
8999
insert into t6 values (60,'14:30:20');
9000
select * from t1 order by col1;
9004
select * from t2 order by col1;
9009
select * from t3 order by col1;
9014
select * from t4 order by colint;
9021
select * from t5 order by colint;
9028
select * from t6 order by colint;
9035
alter table t1 drop partition p0;
9036
alter table t2 drop partition p0;
9037
alter table t4 drop partition p0;
9038
alter table t5 drop partition p0;
9039
alter table t6 drop partition p0;
9040
select * from t1 order by col1;
9044
select * from t2 order by col1;
9049
select * from t3 order by col1;
9054
select * from t4 order by colint;
9057
select * from t5 order by colint;
9060
select * from t6 order by colint;
9063
-------------------------------------------------------------------------
9064
--- Delete rows and partitions of tables with second(col1)
9065
-------------------------------------------------------------------------
9066
delete from t11 where col1='14:30:20';
9067
delete from t22 where col1='14:30:20';
9068
delete from t33 where col1='14:30:20';
9069
delete from t44 where col1='14:30:20';
9070
delete from t55 where col1='14:30:20';
9071
delete from t66 where col1='14:30:20';
9072
select * from t11 order by col1;
9075
select * from t22 order by col1;
9079
select * from t33 order by col1;
9083
select * from t44 order by colint;
9089
select * from t55 order by colint;
9095
insert into t11 values ('14:30:20');
9096
insert into t22 values ('14:30:20');
9097
insert into t33 values ('14:30:20');
9098
insert into t44 values (60,'14:30:20');
9099
insert into t55 values (60,'14:30:20');
9100
insert into t66 values (60,'14:30:20');
9101
select * from t11 order by col1;
9105
select * from t22 order by col1;
9110
select * from t33 order by col1;
9115
select * from t44 order by colint;
9122
select * from t55 order by colint;
9129
select * from t66 order by colint;
9136
alter table t11 drop partition p0;
9137
alter table t22 drop partition p0;
9138
alter table t44 drop partition p0;
9139
alter table t55 drop partition p0;
9140
alter table t66 drop partition p0;
9141
select * from t11 order by col1;
9145
select * from t22 order by col1;
9150
select * from t33 order by col1;
9155
select * from t44 order by colint;
9158
select * from t55 order by colint;
9161
select * from t66 order by colint;
9164
-------------------------
9165
---- some alter table end
9166
-------------------------
9167
drop table if exists t1 ;
9168
drop table if exists t2 ;
9169
drop table if exists t3 ;
9170
drop table if exists t4 ;
9171
drop table if exists t5 ;
9172
drop table if exists t6 ;
9173
drop table if exists t11 ;
9174
drop table if exists t22 ;
9175
drop table if exists t33 ;
9176
drop table if exists t44 ;
9177
drop table if exists t55 ;
9178
drop table if exists t66 ;
9179
-------------------------------------------------------------------------
9180
--- second(col1) in partition with coltype char(30)
9181
-------------------------------------------------------------------------
9182
drop table if exists t1 ;
9183
drop table if exists t2 ;
9184
drop table if exists t3 ;
9185
drop table if exists t4 ;
9186
drop table if exists t5 ;
9187
drop table if exists t6 ;
9188
-------------------------------------------------------------------------
9189
--- Create tables with second(col1)
9190
-------------------------------------------------------------------------
9191
create table t1 (col1 char(30)) engine='NDB'
9192
partition by range(second(col1))
9193
(partition p0 values less than (15),
9194
partition p1 values less than maxvalue);
9195
create table t2 (col1 char(30)) engine='NDB'
9196
partition by list(second(col1))
9197
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9198
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9199
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9200
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9201
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9202
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9204
create table t3 (col1 char(30)) engine='NDB'
9205
partition by hash(second(col1));
9206
create table t4 (colint int, col1 char(30)) engine='NDB'
9207
partition by range(colint)
9208
subpartition by hash(second(col1)) subpartitions 2
9209
(partition p0 values less than (15),
9210
partition p1 values less than maxvalue);
9211
create table t5 (colint int, col1 char(30)) engine='NDB'
9212
partition by list(colint)
9213
subpartition by hash(second(col1)) subpartitions 2
9214
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9215
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9216
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9217
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9218
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9219
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9221
create table t6 (colint int, col1 char(30)) engine='NDB'
9222
partition by range(colint)
9223
(partition p0 values less than (second('18:30:14')),
9224
partition p1 values less than maxvalue);
9225
-------------------------------------------------------------------------
9226
--- Access tables with second(col1)
9227
-------------------------------------------------------------------------
9228
insert into t1 values ('09:09:09');
9229
insert into t1 values ('14:30:20');
9230
insert into t2 values ('09:09:09');
9231
insert into t2 values ('14:30:20');
9232
insert into t2 values ('21:59:22');
9233
insert into t3 values ('09:09:09');
9234
insert into t3 values ('14:30:20');
9235
insert into t3 values ('21:59:22');
9236
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
9237
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
9238
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
9239
select second(col1) from t1 order by col1;
9243
select * from t1 order by col1;
9247
select * from t2 order by col1;
9252
select * from t3 order by col1;
9257
select * from t4 order by colint;
9263
select * from t5 order by colint;
9269
select * from t6 order by colint;
9275
update t1 set col1='10:22:33' where col1='09:09:09';
9276
update t2 set col1='10:22:33' where col1='09:09:09';
9277
update t3 set col1='10:22:33' where col1='09:09:09';
9278
update t4 set col1='10:22:33' where col1='09:09:09';
9279
update t5 set col1='10:22:33' where col1='09:09:09';
9280
update t6 set col1='10:22:33' where col1='09:09:09';
9281
select * from t1 order by col1;
9285
select * from t2 order by col1;
9290
select * from t3 order by col1;
9295
select * from t4 order by colint;
9301
select * from t5 order by colint;
9307
select * from t6 order by colint;
9313
-------------------------------------------------------------------------
9314
--- Alter tables with second(col1)
9315
-------------------------------------------------------------------------
9316
drop table if exists t11 ;
9317
drop table if exists t22 ;
9318
drop table if exists t33 ;
9319
drop table if exists t44 ;
9320
drop table if exists t55 ;
9321
drop table if exists t66 ;
9322
create table t11 engine='NDB' as select * from t1;
9323
create table t22 engine='NDB' as select * from t2;
9324
create table t33 engine='NDB' as select * from t3;
9325
create table t44 engine='NDB' as select * from t4;
9326
create table t55 engine='NDB' as select * from t5;
9327
create table t66 engine='NDB' as select * from t6;
9329
partition by range(second(col1))
9330
(partition p0 values less than (15),
9331
partition p1 values less than maxvalue);
9333
partition by list(second(col1))
9334
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9335
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9336
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9337
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9338
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9339
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9342
partition by hash(second(col1));
9344
partition by range(colint)
9345
subpartition by hash(second(col1)) subpartitions 2
9346
(partition p0 values less than (15),
9347
partition p1 values less than maxvalue);
9349
partition by list(colint)
9350
subpartition by hash(second(col1)) subpartitions 2
9351
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9352
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9353
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9354
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9355
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9356
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9359
partition by range(colint)
9360
(partition p0 values less than (second('18:30:14')),
9361
partition p1 values less than maxvalue);
9362
select * from t11 order by col1;
9366
select * from t22 order by col1;
9371
select * from t33 order by col1;
9376
select * from t44 order by colint;
9382
select * from t55 order by colint;
9388
select * from t66 order by colint;
9394
---------------------------
9395
---- some alter table begin
9396
---------------------------
9398
reorganize partition p0,p1 into
9399
(partition s1 values less than maxvalue);
9400
select * from t11 order by col1;
9405
reorganize partition s1 into
9406
(partition p0 values less than (15),
9407
partition p1 values less than maxvalue);
9408
select * from t11 order by col1;
9413
partition by list(colint)
9414
subpartition by hash(second(col1)) subpartitions 5
9415
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9416
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9417
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9418
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9419
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9420
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9422
show create table t55;
9424
t55 CREATE TABLE `t55` (
9425
`colint` int(11) DEFAULT NULL,
9426
`col1` char(30) DEFAULT NULL
9427
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (second(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
9428
select * from t55 order by colint;
9435
reorganize partition p0,p1 into
9436
(partition s1 values less than maxvalue);
9437
select * from t66 order by colint;
9444
reorganize partition s1 into
9445
(partition p0 values less than (second('18:30:14')),
9446
partition p1 values less than maxvalue);
9447
select * from t66 order by colint;
9454
reorganize partition p0,p1 into
9455
(partition s1 values less than maxvalue);
9456
select * from t66 order by colint;
9463
reorganize partition s1 into
9464
(partition p0 values less than (second('18:30:14')),
9465
partition p1 values less than maxvalue);
9466
select * from t66 order by colint;
9472
-------------------------------------------------------------------------
9473
--- Delete rows and partitions of tables with second(col1)
9474
-------------------------------------------------------------------------
9475
delete from t1 where col1='14:30:20';
9476
delete from t2 where col1='14:30:20';
9477
delete from t3 where col1='14:30:20';
9478
delete from t4 where col1='14:30:20';
9479
delete from t5 where col1='14:30:20';
9480
delete from t6 where col1='14:30:20';
9481
select * from t1 order by col1;
9484
select * from t2 order by col1;
9488
select * from t3 order by col1;
9492
select * from t4 order by colint;
9498
select * from t5 order by colint;
9504
insert into t1 values ('14:30:20');
9505
insert into t2 values ('14:30:20');
9506
insert into t3 values ('14:30:20');
9507
insert into t4 values (60,'14:30:20');
9508
insert into t5 values (60,'14:30:20');
9509
insert into t6 values (60,'14:30:20');
9510
select * from t1 order by col1;
9514
select * from t2 order by col1;
9519
select * from t3 order by col1;
9524
select * from t4 order by colint;
9531
select * from t5 order by colint;
9538
select * from t6 order by colint;
9545
alter table t1 drop partition p0;
9546
alter table t2 drop partition p0;
9547
alter table t4 drop partition p0;
9548
alter table t5 drop partition p0;
9549
alter table t6 drop partition p0;
9550
select * from t1 order by col1;
9554
select * from t2 order by col1;
9559
select * from t3 order by col1;
9564
select * from t4 order by colint;
9567
select * from t5 order by colint;
9570
select * from t6 order by colint;
9573
-------------------------------------------------------------------------
9574
--- Delete rows and partitions of tables with second(col1)
9575
-------------------------------------------------------------------------
9576
delete from t11 where col1='14:30:20';
9577
delete from t22 where col1='14:30:20';
9578
delete from t33 where col1='14:30:20';
9579
delete from t44 where col1='14:30:20';
9580
delete from t55 where col1='14:30:20';
9581
delete from t66 where col1='14:30:20';
9582
select * from t11 order by col1;
9585
select * from t22 order by col1;
9589
select * from t33 order by col1;
9593
select * from t44 order by colint;
9599
select * from t55 order by colint;
9605
insert into t11 values ('14:30:20');
9606
insert into t22 values ('14:30:20');
9607
insert into t33 values ('14:30:20');
9608
insert into t44 values (60,'14:30:20');
9609
insert into t55 values (60,'14:30:20');
9610
insert into t66 values (60,'14:30:20');
9611
select * from t11 order by col1;
9615
select * from t22 order by col1;
9620
select * from t33 order by col1;
9625
select * from t44 order by colint;
9632
select * from t55 order by colint;
9639
select * from t66 order by colint;
9646
alter table t11 drop partition p0;
9647
alter table t22 drop partition p0;
9648
alter table t44 drop partition p0;
9649
alter table t55 drop partition p0;
9650
alter table t66 drop partition p0;
9651
select * from t11 order by col1;
9655
select * from t22 order by col1;
9660
select * from t33 order by col1;
9665
select * from t44 order by colint;
9668
select * from t55 order by colint;
9671
select * from t66 order by colint;
9674
-------------------------
9675
---- some alter table end
9676
-------------------------
9677
drop table if exists t1 ;
9678
drop table if exists t2 ;
9679
drop table if exists t3 ;
9680
drop table if exists t4 ;
9681
drop table if exists t5 ;
9682
drop table if exists t6 ;
9683
drop table if exists t11 ;
9684
drop table if exists t22 ;
9685
drop table if exists t33 ;
9686
drop table if exists t44 ;
9687
drop table if exists t55 ;
9688
drop table if exists t66 ;
9689
-------------------------------------------------------------------------
9690
--- month(col1) in partition with coltype date
9691
-------------------------------------------------------------------------
9692
drop table if exists t1 ;
9693
drop table if exists t2 ;
9694
drop table if exists t3 ;
9695
drop table if exists t4 ;
9696
drop table if exists t5 ;
9697
drop table if exists t6 ;
9698
-------------------------------------------------------------------------
9699
--- Create tables with month(col1)
9700
-------------------------------------------------------------------------
9701
create table t1 (col1 date) engine='NDB'
9702
partition by range(month(col1))
9703
(partition p0 values less than (15),
9704
partition p1 values less than maxvalue);
9705
create table t2 (col1 date) engine='NDB'
9706
partition by list(month(col1))
9707
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9708
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9709
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9710
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9711
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9712
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9714
create table t3 (col1 date) engine='NDB'
9715
partition by hash(month(col1));
9716
create table t4 (colint int, col1 date) engine='NDB'
9717
partition by range(colint)
9718
subpartition by hash(month(col1)) subpartitions 2
9719
(partition p0 values less than (15),
9720
partition p1 values less than maxvalue);
9721
create table t5 (colint int, col1 date) engine='NDB'
9722
partition by list(colint)
9723
subpartition by hash(month(col1)) subpartitions 2
9724
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9725
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9726
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9727
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9728
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9729
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9731
create table t6 (colint int, col1 date) engine='NDB'
9732
partition by range(colint)
9733
(partition p0 values less than (month('2006-10-14')),
9734
partition p1 values less than maxvalue);
9735
-------------------------------------------------------------------------
9736
--- Access tables with month(col1)
9737
-------------------------------------------------------------------------
9738
insert into t1 values ('2006-01-03');
9739
insert into t1 values ('2006-12-17');
9740
insert into t2 values ('2006-01-03');
9741
insert into t2 values ('2006-12-17');
9742
insert into t2 values ('2006-05-25');
9743
insert into t3 values ('2006-01-03');
9744
insert into t3 values ('2006-12-17');
9745
insert into t3 values ('2006-05-25');
9746
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
9747
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
9748
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
9749
select month(col1) from t1 order by col1;
9753
select * from t1 order by col1;
9757
select * from t2 order by col1;
9762
select * from t3 order by col1;
9767
select * from t4 order by colint;
9773
select * from t5 order by colint;
9779
select * from t6 order by colint;
9785
update t1 set col1='2006-11-06' where col1='2006-01-03';
9786
update t2 set col1='2006-11-06' where col1='2006-01-03';
9787
update t3 set col1='2006-11-06' where col1='2006-01-03';
9788
update t4 set col1='2006-11-06' where col1='2006-01-03';
9789
update t5 set col1='2006-11-06' where col1='2006-01-03';
9790
update t6 set col1='2006-11-06' where col1='2006-01-03';
9791
select * from t1 order by col1;
9795
select * from t2 order by col1;
9800
select * from t3 order by col1;
9805
select * from t4 order by colint;
9811
select * from t5 order by colint;
9817
select * from t6 order by colint;
9823
-------------------------------------------------------------------------
9824
--- Alter tables with month(col1)
9825
-------------------------------------------------------------------------
9826
drop table if exists t11 ;
9827
drop table if exists t22 ;
9828
drop table if exists t33 ;
9829
drop table if exists t44 ;
9830
drop table if exists t55 ;
9831
drop table if exists t66 ;
9832
create table t11 engine='NDB' as select * from t1;
9833
create table t22 engine='NDB' as select * from t2;
9834
create table t33 engine='NDB' as select * from t3;
9835
create table t44 engine='NDB' as select * from t4;
9836
create table t55 engine='NDB' as select * from t5;
9837
create table t66 engine='NDB' as select * from t6;
9839
partition by range(month(col1))
9840
(partition p0 values less than (15),
9841
partition p1 values less than maxvalue);
9843
partition by list(month(col1))
9844
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
9845
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9846
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9847
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9848
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9849
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9852
partition by hash(month(col1));
9854
partition by range(colint)
9855
subpartition by hash(month(col1)) subpartitions 2
9856
(partition p0 values less than (15),
9857
partition p1 values less than maxvalue);
9859
partition by list(colint)
9860
subpartition by hash(month(col1)) subpartitions 2
9861
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9862
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9863
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9864
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9865
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9866
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9869
partition by range(colint)
9870
(partition p0 values less than (month('2006-10-14')),
9871
partition p1 values less than maxvalue);
9872
select * from t11 order by col1;
9876
select * from t22 order by col1;
9881
select * from t33 order by col1;
9886
select * from t44 order by colint;
9892
select * from t55 order by colint;
9898
select * from t66 order by colint;
9904
---------------------------
9905
---- some alter table begin
9906
---------------------------
9908
reorganize partition p0,p1 into
9909
(partition s1 values less than maxvalue);
9910
select * from t11 order by col1;
9915
reorganize partition s1 into
9916
(partition p0 values less than (15),
9917
partition p1 values less than maxvalue);
9918
select * from t11 order by col1;
9923
partition by list(colint)
9924
subpartition by hash(month(col1)) subpartitions 5
9925
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
9926
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
9927
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
9928
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
9929
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
9930
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
9932
show create table t55;
9934
t55 CREATE TABLE `t55` (
9935
`colint` int(11) DEFAULT NULL,
9936
`col1` date DEFAULT NULL
9937
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (month(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
9938
select * from t55 order by colint;
9945
reorganize partition p0,p1 into
9946
(partition s1 values less than maxvalue);
9947
select * from t66 order by colint;
9954
reorganize partition s1 into
9955
(partition p0 values less than (month('2006-10-14')),
9956
partition p1 values less than maxvalue);
9957
select * from t66 order by colint;
9964
reorganize partition p0,p1 into
9965
(partition s1 values less than maxvalue);
9966
select * from t66 order by colint;
9973
reorganize partition s1 into
9974
(partition p0 values less than (month('2006-10-14')),
9975
partition p1 values less than maxvalue);
9976
select * from t66 order by colint;
9982
-------------------------------------------------------------------------
9983
--- Delete rows and partitions of tables with month(col1)
9984
-------------------------------------------------------------------------
9985
delete from t1 where col1='2006-12-17';
9986
delete from t2 where col1='2006-12-17';
9987
delete from t3 where col1='2006-12-17';
9988
delete from t4 where col1='2006-12-17';
9989
delete from t5 where col1='2006-12-17';
9990
delete from t6 where col1='2006-12-17';
9991
select * from t1 order by col1;
9994
select * from t2 order by col1;
9998
select * from t3 order by col1;
10002
select * from t4 order by colint;
10008
select * from t5 order by colint;
10014
insert into t1 values ('2006-12-17');
10015
insert into t2 values ('2006-12-17');
10016
insert into t3 values ('2006-12-17');
10017
insert into t4 values (60,'2006-12-17');
10018
insert into t5 values (60,'2006-12-17');
10019
insert into t6 values (60,'2006-12-17');
10020
select * from t1 order by col1;
10024
select * from t2 order by col1;
10029
select * from t3 order by col1;
10034
select * from t4 order by colint;
10041
select * from t5 order by colint;
10048
select * from t6 order by colint;
10055
alter table t1 drop partition p0;
10056
alter table t2 drop partition p0;
10057
alter table t4 drop partition p0;
10058
alter table t5 drop partition p0;
10059
alter table t6 drop partition p0;
10060
select * from t1 order by col1;
10062
select * from t2 order by col1;
10066
select * from t3 order by col1;
10071
select * from t4 order by colint;
10074
select * from t5 order by colint;
10077
select * from t6 order by colint;
10080
-------------------------------------------------------------------------
10081
--- Delete rows and partitions of tables with month(col1)
10082
-------------------------------------------------------------------------
10083
delete from t11 where col1='2006-12-17';
10084
delete from t22 where col1='2006-12-17';
10085
delete from t33 where col1='2006-12-17';
10086
delete from t44 where col1='2006-12-17';
10087
delete from t55 where col1='2006-12-17';
10088
delete from t66 where col1='2006-12-17';
10089
select * from t11 order by col1;
10092
select * from t22 order by col1;
10096
select * from t33 order by col1;
10100
select * from t44 order by colint;
10106
select * from t55 order by colint;
10112
insert into t11 values ('2006-12-17');
10113
insert into t22 values ('2006-12-17');
10114
insert into t33 values ('2006-12-17');
10115
insert into t44 values (60,'2006-12-17');
10116
insert into t55 values (60,'2006-12-17');
10117
insert into t66 values (60,'2006-12-17');
10118
select * from t11 order by col1;
10122
select * from t22 order by col1;
10127
select * from t33 order by col1;
10132
select * from t44 order by colint;
10139
select * from t55 order by colint;
10146
select * from t66 order by colint;
10153
alter table t11 drop partition p0;
10154
alter table t22 drop partition p0;
10155
alter table t44 drop partition p0;
10156
alter table t55 drop partition p0;
10157
alter table t66 drop partition p0;
10158
select * from t11 order by col1;
10160
select * from t22 order by col1;
10164
select * from t33 order by col1;
10169
select * from t44 order by colint;
10172
select * from t55 order by colint;
10175
select * from t66 order by colint;
10178
-------------------------
10179
---- some alter table end
10180
-------------------------
10181
drop table if exists t1 ;
10182
drop table if exists t2 ;
10183
drop table if exists t3 ;
10184
drop table if exists t4 ;
10185
drop table if exists t5 ;
10186
drop table if exists t6 ;
10187
drop table if exists t11 ;
10188
drop table if exists t22 ;
10189
drop table if exists t33 ;
10190
drop table if exists t44 ;
10191
drop table if exists t55 ;
10192
drop table if exists t66 ;
10193
-------------------------------------------------------------------------
10194
--- quarter(col1) in partition with coltype date
10195
-------------------------------------------------------------------------
10196
drop table if exists t1 ;
10197
drop table if exists t2 ;
10198
drop table if exists t3 ;
10199
drop table if exists t4 ;
10200
drop table if exists t5 ;
10201
drop table if exists t6 ;
10202
-------------------------------------------------------------------------
10203
--- Create tables with quarter(col1)
10204
-------------------------------------------------------------------------
10205
create table t1 (col1 date) engine='NDB'
10206
partition by range(quarter(col1))
10207
(partition p0 values less than (15),
10208
partition p1 values less than maxvalue);
10209
create table t2 (col1 date) engine='NDB'
10210
partition by list(quarter(col1))
10211
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10212
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10213
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10214
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10215
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10216
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10218
create table t3 (col1 date) engine='NDB'
10219
partition by hash(quarter(col1));
10220
create table t4 (colint int, col1 date) engine='NDB'
10221
partition by range(colint)
10222
subpartition by hash(quarter(col1)) subpartitions 2
10223
(partition p0 values less than (15),
10224
partition p1 values less than maxvalue);
10225
create table t5 (colint int, col1 date) engine='NDB'
10226
partition by list(colint)
10227
subpartition by hash(quarter(col1)) subpartitions 2
10228
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10229
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10230
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10231
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10232
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10233
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10235
create table t6 (colint int, col1 date) engine='NDB'
10236
partition by range(colint)
10237
(partition p0 values less than (quarter('2006-10-14')),
10238
partition p1 values less than maxvalue);
10239
-------------------------------------------------------------------------
10240
--- Access tables with quarter(col1)
10241
-------------------------------------------------------------------------
10242
insert into t1 values ('2006-01-03');
10243
insert into t1 values ('2006-12-17');
10244
insert into t2 values ('2006-01-03');
10245
insert into t2 values ('2006-12-17');
10246
insert into t2 values ('2006-09-25');
10247
insert into t3 values ('2006-01-03');
10248
insert into t3 values ('2006-12-17');
10249
insert into t3 values ('2006-09-25');
10250
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
10251
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
10252
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
10253
select quarter(col1) from t1 order by col1;
10257
select * from t1 order by col1;
10261
select * from t2 order by col1;
10266
select * from t3 order by col1;
10271
select * from t4 order by colint;
10277
select * from t5 order by colint;
10283
select * from t6 order by colint;
10289
update t1 set col1='2006-07-30' where col1='2006-01-03';
10290
update t2 set col1='2006-07-30' where col1='2006-01-03';
10291
update t3 set col1='2006-07-30' where col1='2006-01-03';
10292
update t4 set col1='2006-07-30' where col1='2006-01-03';
10293
update t5 set col1='2006-07-30' where col1='2006-01-03';
10294
update t6 set col1='2006-07-30' where col1='2006-01-03';
10295
select * from t1 order by col1;
10299
select * from t2 order by col1;
10304
select * from t3 order by col1;
10309
select * from t4 order by colint;
10315
select * from t5 order by colint;
10321
select * from t6 order by colint;
10327
-------------------------------------------------------------------------
10328
--- Alter tables with quarter(col1)
10329
-------------------------------------------------------------------------
10330
drop table if exists t11 ;
10331
drop table if exists t22 ;
10332
drop table if exists t33 ;
10333
drop table if exists t44 ;
10334
drop table if exists t55 ;
10335
drop table if exists t66 ;
10336
create table t11 engine='NDB' as select * from t1;
10337
create table t22 engine='NDB' as select * from t2;
10338
create table t33 engine='NDB' as select * from t3;
10339
create table t44 engine='NDB' as select * from t4;
10340
create table t55 engine='NDB' as select * from t5;
10341
create table t66 engine='NDB' as select * from t6;
10343
partition by range(quarter(col1))
10344
(partition p0 values less than (15),
10345
partition p1 values less than maxvalue);
10347
partition by list(quarter(col1))
10348
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10349
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10350
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10351
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10352
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10353
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10356
partition by hash(quarter(col1));
10358
partition by range(colint)
10359
subpartition by hash(quarter(col1)) subpartitions 2
10360
(partition p0 values less than (15),
10361
partition p1 values less than maxvalue);
10363
partition by list(colint)
10364
subpartition by hash(quarter(col1)) subpartitions 2
10365
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10366
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10367
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10368
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10369
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10370
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10373
partition by range(colint)
10374
(partition p0 values less than (quarter('2006-10-14')),
10375
partition p1 values less than maxvalue);
10376
select * from t11 order by col1;
10380
select * from t22 order by col1;
10385
select * from t33 order by col1;
10390
select * from t44 order by colint;
10396
select * from t55 order by colint;
10402
select * from t66 order by colint;
10408
---------------------------
10409
---- some alter table begin
10410
---------------------------
10412
reorganize partition p0,p1 into
10413
(partition s1 values less than maxvalue);
10414
select * from t11 order by col1;
10419
reorganize partition s1 into
10420
(partition p0 values less than (15),
10421
partition p1 values less than maxvalue);
10422
select * from t11 order by col1;
10427
partition by list(colint)
10428
subpartition by hash(quarter(col1)) subpartitions 5
10429
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10430
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10431
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10432
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10433
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10434
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10436
show create table t55;
10438
t55 CREATE TABLE `t55` (
10439
`colint` int(11) DEFAULT NULL,
10440
`col1` date DEFAULT NULL
10441
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (quarter(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
10442
select * from t55 order by colint;
10449
reorganize partition p0,p1 into
10450
(partition s1 values less than maxvalue);
10451
select * from t66 order by colint;
10458
reorganize partition s1 into
10459
(partition p0 values less than (quarter('2006-10-14')),
10460
partition p1 values less than maxvalue);
10461
select * from t66 order by colint;
10468
reorganize partition p0,p1 into
10469
(partition s1 values less than maxvalue);
10470
select * from t66 order by colint;
10477
reorganize partition s1 into
10478
(partition p0 values less than (quarter('2006-10-14')),
10479
partition p1 values less than maxvalue);
10480
select * from t66 order by colint;
10486
-------------------------------------------------------------------------
10487
--- Delete rows and partitions of tables with quarter(col1)
10488
-------------------------------------------------------------------------
10489
delete from t1 where col1='2006-12-17';
10490
delete from t2 where col1='2006-12-17';
10491
delete from t3 where col1='2006-12-17';
10492
delete from t4 where col1='2006-12-17';
10493
delete from t5 where col1='2006-12-17';
10494
delete from t6 where col1='2006-12-17';
10495
select * from t1 order by col1;
10498
select * from t2 order by col1;
10502
select * from t3 order by col1;
10506
select * from t4 order by colint;
10512
select * from t5 order by colint;
10518
insert into t1 values ('2006-12-17');
10519
insert into t2 values ('2006-12-17');
10520
insert into t3 values ('2006-12-17');
10521
insert into t4 values (60,'2006-12-17');
10522
insert into t5 values (60,'2006-12-17');
10523
insert into t6 values (60,'2006-12-17');
10524
select * from t1 order by col1;
10528
select * from t2 order by col1;
10533
select * from t3 order by col1;
10538
select * from t4 order by colint;
10545
select * from t5 order by colint;
10552
select * from t6 order by colint;
10559
alter table t1 drop partition p0;
10560
alter table t2 drop partition p0;
10561
alter table t4 drop partition p0;
10562
alter table t5 drop partition p0;
10563
alter table t6 drop partition p0;
10564
select * from t1 order by col1;
10566
select * from t2 order by col1;
10568
select * from t3 order by col1;
10573
select * from t4 order by colint;
10576
select * from t5 order by colint;
10579
select * from t6 order by colint;
10583
-------------------------------------------------------------------------
10584
--- Delete rows and partitions of tables with quarter(col1)
10585
-------------------------------------------------------------------------
10586
delete from t11 where col1='2006-12-17';
10587
delete from t22 where col1='2006-12-17';
10588
delete from t33 where col1='2006-12-17';
10589
delete from t44 where col1='2006-12-17';
10590
delete from t55 where col1='2006-12-17';
10591
delete from t66 where col1='2006-12-17';
10592
select * from t11 order by col1;
10595
select * from t22 order by col1;
10599
select * from t33 order by col1;
10603
select * from t44 order by colint;
10609
select * from t55 order by colint;
10615
insert into t11 values ('2006-12-17');
10616
insert into t22 values ('2006-12-17');
10617
insert into t33 values ('2006-12-17');
10618
insert into t44 values (60,'2006-12-17');
10619
insert into t55 values (60,'2006-12-17');
10620
insert into t66 values (60,'2006-12-17');
10621
select * from t11 order by col1;
10625
select * from t22 order by col1;
10630
select * from t33 order by col1;
10635
select * from t44 order by colint;
10642
select * from t55 order by colint;
10649
select * from t66 order by colint;
10656
alter table t11 drop partition p0;
10657
alter table t22 drop partition p0;
10658
alter table t44 drop partition p0;
10659
alter table t55 drop partition p0;
10660
alter table t66 drop partition p0;
10661
select * from t11 order by col1;
10663
select * from t22 order by col1;
10665
select * from t33 order by col1;
10670
select * from t44 order by colint;
10673
select * from t55 order by colint;
10676
select * from t66 order by colint;
10680
-------------------------
10681
---- some alter table end
10682
-------------------------
10683
drop table if exists t1 ;
10684
drop table if exists t2 ;
10685
drop table if exists t3 ;
10686
drop table if exists t4 ;
10687
drop table if exists t5 ;
10688
drop table if exists t6 ;
10689
drop table if exists t11 ;
10690
drop table if exists t22 ;
10691
drop table if exists t33 ;
10692
drop table if exists t44 ;
10693
drop table if exists t55 ;
10694
drop table if exists t66 ;
10695
-------------------------------------------------------------------------
10696
--- time_to_sec(col1)-(time_to_sec(col1)-20) in partition with coltype time
10697
-------------------------------------------------------------------------
10698
drop table if exists t1 ;
10699
drop table if exists t2 ;
10700
drop table if exists t3 ;
10701
drop table if exists t4 ;
10702
drop table if exists t5 ;
10703
drop table if exists t6 ;
10704
-------------------------------------------------------------------------
10705
--- Create tables with time_to_sec(col1)-(time_to_sec(col1)-20)
10706
-------------------------------------------------------------------------
10707
create table t1 (col1 time) engine='NDB'
10708
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
10709
(partition p0 values less than (15),
10710
partition p1 values less than maxvalue);
10711
create table t2 (col1 time) engine='NDB'
10712
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
10713
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10714
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10715
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10716
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10717
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10718
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10720
create table t3 (col1 time) engine='NDB'
10721
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
10722
create table t4 (colint int, col1 time) engine='NDB'
10723
partition by range(colint)
10724
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
10725
(partition p0 values less than (15),
10726
partition p1 values less than maxvalue);
10727
create table t5 (colint int, col1 time) engine='NDB'
10728
partition by list(colint)
10729
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
10730
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10731
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10732
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10733
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10734
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10735
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10737
create table t6 (colint int, col1 time) engine='NDB'
10738
partition by range(colint)
10739
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
10740
partition p1 values less than maxvalue);
10741
-------------------------------------------------------------------------
10742
--- Access tables with time_to_sec(col1)-(time_to_sec(col1)-20)
10743
-------------------------------------------------------------------------
10744
insert into t1 values ('09:09:15');
10745
insert into t1 values ('14:30:45');
10746
insert into t2 values ('09:09:15');
10747
insert into t2 values ('14:30:45');
10748
insert into t2 values ('21:59:22');
10749
insert into t3 values ('09:09:15');
10750
insert into t3 values ('14:30:45');
10751
insert into t3 values ('21:59:22');
10752
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t4;
10753
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t5;
10754
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_time.in' into table t6;
10755
select time_to_sec(col1)-(time_to_sec(col1)-20) from t1 order by col1;
10756
time_to_sec(col1)-(time_to_sec(col1)-20)
10759
select * from t1 order by col1;
10763
select * from t2 order by col1;
10768
select * from t3 order by col1;
10773
select * from t4 order by colint;
10779
select * from t5 order by colint;
10785
select * from t6 order by colint;
10791
update t1 set col1='10:33:11' where col1='09:09:15';
10792
update t2 set col1='10:33:11' where col1='09:09:15';
10793
update t3 set col1='10:33:11' where col1='09:09:15';
10794
update t4 set col1='10:33:11' where col1='09:09:15';
10795
update t5 set col1='10:33:11' where col1='09:09:15';
10796
update t6 set col1='10:33:11' where col1='09:09:15';
10797
select * from t1 order by col1;
10801
select * from t2 order by col1;
10806
select * from t3 order by col1;
10811
select * from t4 order by colint;
10817
select * from t5 order by colint;
10823
select * from t6 order by colint;
10829
-------------------------------------------------------------------------
10830
--- Alter tables with time_to_sec(col1)-(time_to_sec(col1)-20)
10831
-------------------------------------------------------------------------
10832
drop table if exists t11 ;
10833
drop table if exists t22 ;
10834
drop table if exists t33 ;
10835
drop table if exists t44 ;
10836
drop table if exists t55 ;
10837
drop table if exists t66 ;
10838
create table t11 engine='NDB' as select * from t1;
10839
create table t22 engine='NDB' as select * from t2;
10840
create table t33 engine='NDB' as select * from t3;
10841
create table t44 engine='NDB' as select * from t4;
10842
create table t55 engine='NDB' as select * from t5;
10843
create table t66 engine='NDB' as select * from t6;
10845
partition by range(time_to_sec(col1)-(time_to_sec(col1)-20))
10846
(partition p0 values less than (15),
10847
partition p1 values less than maxvalue);
10849
partition by list(time_to_sec(col1)-(time_to_sec(col1)-20))
10850
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
10851
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10852
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10853
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10854
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10855
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10858
partition by hash(time_to_sec(col1)-(time_to_sec(col1)-20));
10860
partition by range(colint)
10861
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
10862
(partition p0 values less than (15),
10863
partition p1 values less than maxvalue);
10865
partition by list(colint)
10866
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 2
10867
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10868
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10869
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10870
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10871
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10872
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10875
partition by range(colint)
10876
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
10877
partition p1 values less than maxvalue);
10878
select * from t11 order by col1;
10882
select * from t22 order by col1;
10887
select * from t33 order by col1;
10892
select * from t44 order by colint;
10898
select * from t55 order by colint;
10904
select * from t66 order by colint;
10910
---------------------------
10911
---- some alter table begin
10912
---------------------------
10914
reorganize partition p0,p1 into
10915
(partition s1 values less than maxvalue);
10916
select * from t11 order by col1;
10921
reorganize partition s1 into
10922
(partition p0 values less than (15),
10923
partition p1 values less than maxvalue);
10924
select * from t11 order by col1;
10929
partition by list(colint)
10930
subpartition by hash(time_to_sec(col1)-(time_to_sec(col1)-20)) subpartitions 5
10931
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
10932
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
10933
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
10934
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
10935
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
10936
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
10938
show create table t55;
10940
t55 CREATE TABLE `t55` (
10941
`colint` int(11) DEFAULT NULL,
10942
`col1` time DEFAULT NULL
10943
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (time_to_sec(col1)-(time_to_sec(col1)-20)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
10944
select * from t55 order by colint;
10951
reorganize partition p0,p1 into
10952
(partition s1 values less than maxvalue);
10953
select * from t66 order by colint;
10960
reorganize partition s1 into
10961
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
10962
partition p1 values less than maxvalue);
10963
select * from t66 order by colint;
10970
reorganize partition p0,p1 into
10971
(partition s1 values less than maxvalue);
10972
select * from t66 order by colint;
10979
reorganize partition s1 into
10980
(partition p0 values less than (time_to_sec('18:30:14')-(time_to_sec('17:59:59'))),
10981
partition p1 values less than maxvalue);
10982
select * from t66 order by colint;
10988
-------------------------------------------------------------------------
10989
--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
10990
-------------------------------------------------------------------------
10991
delete from t1 where col1='14:30:45';
10992
delete from t2 where col1='14:30:45';
10993
delete from t3 where col1='14:30:45';
10994
delete from t4 where col1='14:30:45';
10995
delete from t5 where col1='14:30:45';
10996
delete from t6 where col1='14:30:45';
10997
select * from t1 order by col1;
11000
select * from t2 order by col1;
11004
select * from t3 order by col1;
11008
select * from t4 order by colint;
11014
select * from t5 order by colint;
11020
insert into t1 values ('14:30:45');
11021
insert into t2 values ('14:30:45');
11022
insert into t3 values ('14:30:45');
11023
insert into t4 values (60,'14:30:45');
11024
insert into t5 values (60,'14:30:45');
11025
insert into t6 values (60,'14:30:45');
11026
select * from t1 order by col1;
11030
select * from t2 order by col1;
11035
select * from t3 order by col1;
11040
select * from t4 order by colint;
11047
select * from t5 order by colint;
11054
select * from t6 order by colint;
11061
alter table t1 drop partition p0;
11062
alter table t2 drop partition p0;
11063
alter table t4 drop partition p0;
11064
alter table t5 drop partition p0;
11065
alter table t6 drop partition p0;
11066
select * from t1 order by col1;
11070
select * from t2 order by col1;
11075
select * from t3 order by col1;
11080
select * from t4 order by colint;
11083
select * from t5 order by colint;
11086
select * from t6 order by colint;
11088
-------------------------------------------------------------------------
11089
--- Delete rows and partitions of tables with time_to_sec(col1)-(time_to_sec(col1)-20)
11090
-------------------------------------------------------------------------
11091
delete from t11 where col1='14:30:45';
11092
delete from t22 where col1='14:30:45';
11093
delete from t33 where col1='14:30:45';
11094
delete from t44 where col1='14:30:45';
11095
delete from t55 where col1='14:30:45';
11096
delete from t66 where col1='14:30:45';
11097
select * from t11 order by col1;
11100
select * from t22 order by col1;
11104
select * from t33 order by col1;
11108
select * from t44 order by colint;
11114
select * from t55 order by colint;
11120
insert into t11 values ('14:30:45');
11121
insert into t22 values ('14:30:45');
11122
insert into t33 values ('14:30:45');
11123
insert into t44 values (60,'14:30:45');
11124
insert into t55 values (60,'14:30:45');
11125
insert into t66 values (60,'14:30:45');
11126
select * from t11 order by col1;
11130
select * from t22 order by col1;
11135
select * from t33 order by col1;
11140
select * from t44 order by colint;
11147
select * from t55 order by colint;
11154
select * from t66 order by colint;
11161
alter table t11 drop partition p0;
11162
alter table t22 drop partition p0;
11163
alter table t44 drop partition p0;
11164
alter table t55 drop partition p0;
11165
alter table t66 drop partition p0;
11166
select * from t11 order by col1;
11170
select * from t22 order by col1;
11175
select * from t33 order by col1;
11180
select * from t44 order by colint;
11183
select * from t55 order by colint;
11186
select * from t66 order by colint;
11188
-------------------------
11189
---- some alter table end
11190
-------------------------
11191
drop table if exists t1 ;
11192
drop table if exists t2 ;
11193
drop table if exists t3 ;
11194
drop table if exists t4 ;
11195
drop table if exists t5 ;
11196
drop table if exists t6 ;
11197
drop table if exists t11 ;
11198
drop table if exists t22 ;
11199
drop table if exists t33 ;
11200
drop table if exists t44 ;
11201
drop table if exists t55 ;
11202
drop table if exists t66 ;
11203
-------------------------------------------------------------------------
11204
--- to_days(col1)-to_days('2006-01-01') in partition with coltype date
11205
-------------------------------------------------------------------------
11206
drop table if exists t1 ;
11207
drop table if exists t2 ;
11208
drop table if exists t3 ;
11209
drop table if exists t4 ;
11210
drop table if exists t5 ;
11211
drop table if exists t6 ;
11212
-------------------------------------------------------------------------
11213
--- Create tables with to_days(col1)-to_days('2006-01-01')
11214
-------------------------------------------------------------------------
11215
create table t1 (col1 date) engine='NDB'
11216
partition by range(to_days(col1)-to_days('2006-01-01'))
11217
(partition p0 values less than (15),
11218
partition p1 values less than maxvalue);
11219
create table t2 (col1 date) engine='NDB'
11220
partition by list(to_days(col1)-to_days('2006-01-01'))
11221
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11222
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11223
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11224
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11225
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11226
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11228
create table t3 (col1 date) engine='NDB'
11229
partition by hash(to_days(col1)-to_days('2006-01-01'));
11230
create table t4 (colint int, col1 date) engine='NDB'
11231
partition by range(colint)
11232
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
11233
(partition p0 values less than (15),
11234
partition p1 values less than maxvalue);
11235
create table t5 (colint int, col1 date) engine='NDB'
11236
partition by list(colint)
11237
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
11238
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11239
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11240
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11241
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11242
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11243
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11245
create table t6 (colint int, col1 date) engine='NDB'
11246
partition by range(colint)
11247
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
11248
partition p1 values less than maxvalue);
11249
-------------------------------------------------------------------------
11250
--- Access tables with to_days(col1)-to_days('2006-01-01')
11251
-------------------------------------------------------------------------
11252
insert into t1 values ('2006-02-03');
11253
insert into t1 values ('2006-01-17');
11254
insert into t2 values ('2006-02-03');
11255
insert into t2 values ('2006-01-17');
11256
insert into t2 values ('2006-01-25');
11257
insert into t3 values ('2006-02-03');
11258
insert into t3 values ('2006-01-17');
11259
insert into t3 values ('2006-01-25');
11260
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
11261
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
11262
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
11263
select to_days(col1)-to_days('2006-01-01') from t1 order by col1;
11264
to_days(col1)-to_days('2006-01-01')
11267
select * from t1 order by col1;
11271
select * from t2 order by col1;
11276
select * from t3 order by col1;
11281
select * from t4 order by colint;
11287
select * from t5 order by colint;
11293
select * from t6 order by colint;
11299
update t1 set col1='2006-02-06' where col1='2006-02-03';
11300
update t2 set col1='2006-02-06' where col1='2006-02-03';
11301
update t3 set col1='2006-02-06' where col1='2006-02-03';
11302
update t4 set col1='2006-02-06' where col1='2006-02-03';
11303
update t5 set col1='2006-02-06' where col1='2006-02-03';
11304
update t6 set col1='2006-02-06' where col1='2006-02-03';
11305
select * from t1 order by col1;
11309
select * from t2 order by col1;
11314
select * from t3 order by col1;
11319
select * from t4 order by colint;
11325
select * from t5 order by colint;
11331
select * from t6 order by colint;
11337
-------------------------------------------------------------------------
11338
--- Alter tables with to_days(col1)-to_days('2006-01-01')
11339
-------------------------------------------------------------------------
11340
drop table if exists t11 ;
11341
drop table if exists t22 ;
11342
drop table if exists t33 ;
11343
drop table if exists t44 ;
11344
drop table if exists t55 ;
11345
drop table if exists t66 ;
11346
create table t11 engine='NDB' as select * from t1;
11347
create table t22 engine='NDB' as select * from t2;
11348
create table t33 engine='NDB' as select * from t3;
11349
create table t44 engine='NDB' as select * from t4;
11350
create table t55 engine='NDB' as select * from t5;
11351
create table t66 engine='NDB' as select * from t6;
11353
partition by range(to_days(col1)-to_days('2006-01-01'))
11354
(partition p0 values less than (15),
11355
partition p1 values less than maxvalue);
11357
partition by list(to_days(col1)-to_days('2006-01-01'))
11358
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11359
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11360
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11361
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11362
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11363
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11366
partition by hash(to_days(col1)-to_days('2006-01-01'));
11368
partition by range(colint)
11369
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
11370
(partition p0 values less than (15),
11371
partition p1 values less than maxvalue);
11373
partition by list(colint)
11374
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 2
11375
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11376
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11377
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11378
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11379
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11380
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11383
partition by range(colint)
11384
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
11385
partition p1 values less than maxvalue);
11386
select * from t11 order by col1;
11390
select * from t22 order by col1;
11395
select * from t33 order by col1;
11400
select * from t44 order by colint;
11406
select * from t55 order by colint;
11412
select * from t66 order by colint;
11418
---------------------------
11419
---- some alter table begin
11420
---------------------------
11422
reorganize partition p0,p1 into
11423
(partition s1 values less than maxvalue);
11424
select * from t11 order by col1;
11429
reorganize partition s1 into
11430
(partition p0 values less than (15),
11431
partition p1 values less than maxvalue);
11432
select * from t11 order by col1;
11437
partition by list(colint)
11438
subpartition by hash(to_days(col1)-to_days('2006-01-01')) subpartitions 5
11439
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11440
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11441
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11442
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11443
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11444
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11446
show create table t55;
11448
t55 CREATE TABLE `t55` (
11449
`colint` int(11) DEFAULT NULL,
11450
`col1` date DEFAULT NULL
11451
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (to_days(col1)-to_days('2006-01-01')) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
11452
select * from t55 order by colint;
11459
reorganize partition p0,p1 into
11460
(partition s1 values less than maxvalue);
11461
select * from t66 order by colint;
11468
reorganize partition s1 into
11469
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
11470
partition p1 values less than maxvalue);
11471
select * from t66 order by colint;
11478
reorganize partition p0,p1 into
11479
(partition s1 values less than maxvalue);
11480
select * from t66 order by colint;
11487
reorganize partition s1 into
11488
(partition p0 values less than (to_days('2006-02-02')-to_days('2006-01-01')),
11489
partition p1 values less than maxvalue);
11490
select * from t66 order by colint;
11496
-------------------------------------------------------------------------
11497
--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
11498
-------------------------------------------------------------------------
11499
delete from t1 where col1='2006-01-17';
11500
delete from t2 where col1='2006-01-17';
11501
delete from t3 where col1='2006-01-17';
11502
delete from t4 where col1='2006-01-17';
11503
delete from t5 where col1='2006-01-17';
11504
delete from t6 where col1='2006-01-17';
11505
select * from t1 order by col1;
11508
select * from t2 order by col1;
11512
select * from t3 order by col1;
11516
select * from t4 order by colint;
11521
select * from t5 order by colint;
11526
insert into t1 values ('2006-01-17');
11527
insert into t2 values ('2006-01-17');
11528
insert into t3 values ('2006-01-17');
11529
insert into t4 values (60,'2006-01-17');
11530
insert into t5 values (60,'2006-01-17');
11531
insert into t6 values (60,'2006-01-17');
11532
select * from t1 order by col1;
11536
select * from t2 order by col1;
11541
select * from t3 order by col1;
11546
select * from t4 order by colint;
11552
select * from t5 order by colint;
11558
select * from t6 order by colint;
11564
alter table t1 drop partition p0;
11565
alter table t2 drop partition p0;
11566
alter table t4 drop partition p0;
11567
alter table t5 drop partition p0;
11568
alter table t6 drop partition p0;
11569
select * from t1 order by col1;
11573
select * from t2 order by col1;
11578
select * from t3 order by col1;
11583
select * from t4 order by colint;
11586
select * from t5 order by colint;
11589
select * from t6 order by colint;
11592
-------------------------------------------------------------------------
11593
--- Delete rows and partitions of tables with to_days(col1)-to_days('2006-01-01')
11594
-------------------------------------------------------------------------
11595
delete from t11 where col1='2006-01-17';
11596
delete from t22 where col1='2006-01-17';
11597
delete from t33 where col1='2006-01-17';
11598
delete from t44 where col1='2006-01-17';
11599
delete from t55 where col1='2006-01-17';
11600
delete from t66 where col1='2006-01-17';
11601
select * from t11 order by col1;
11604
select * from t22 order by col1;
11608
select * from t33 order by col1;
11612
select * from t44 order by colint;
11617
select * from t55 order by colint;
11622
insert into t11 values ('2006-01-17');
11623
insert into t22 values ('2006-01-17');
11624
insert into t33 values ('2006-01-17');
11625
insert into t44 values (60,'2006-01-17');
11626
insert into t55 values (60,'2006-01-17');
11627
insert into t66 values (60,'2006-01-17');
11628
select * from t11 order by col1;
11632
select * from t22 order by col1;
11637
select * from t33 order by col1;
11642
select * from t44 order by colint;
11648
select * from t55 order by colint;
11654
select * from t66 order by colint;
11660
alter table t11 drop partition p0;
11661
alter table t22 drop partition p0;
11662
alter table t44 drop partition p0;
11663
alter table t55 drop partition p0;
11664
alter table t66 drop partition p0;
11665
select * from t11 order by col1;
11669
select * from t22 order by col1;
11674
select * from t33 order by col1;
11679
select * from t44 order by colint;
11682
select * from t55 order by colint;
11685
select * from t66 order by colint;
11688
-------------------------
11689
---- some alter table end
11690
-------------------------
11691
drop table if exists t1 ;
11692
drop table if exists t2 ;
11693
drop table if exists t3 ;
11694
drop table if exists t4 ;
11695
drop table if exists t5 ;
11696
drop table if exists t6 ;
11697
drop table if exists t11 ;
11698
drop table if exists t22 ;
11699
drop table if exists t33 ;
11700
drop table if exists t44 ;
11701
drop table if exists t55 ;
11702
drop table if exists t66 ;
11703
-------------------------------------------------------------------------
11704
--- weekday(col1) in partition with coltype date
11705
-------------------------------------------------------------------------
11706
drop table if exists t1 ;
11707
drop table if exists t2 ;
11708
drop table if exists t3 ;
11709
drop table if exists t4 ;
11710
drop table if exists t5 ;
11711
drop table if exists t6 ;
11712
-------------------------------------------------------------------------
11713
--- Create tables with weekday(col1)
11714
-------------------------------------------------------------------------
11715
create table t1 (col1 date) engine='NDB'
11716
partition by range(weekday(col1))
11717
(partition p0 values less than (15),
11718
partition p1 values less than maxvalue);
11719
create table t2 (col1 date) engine='NDB'
11720
partition by list(weekday(col1))
11721
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11722
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11723
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11724
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11725
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11726
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11728
create table t3 (col1 date) engine='NDB'
11729
partition by hash(weekday(col1));
11730
create table t4 (colint int, col1 date) engine='NDB'
11731
partition by range(colint)
11732
subpartition by hash(weekday(col1)) subpartitions 2
11733
(partition p0 values less than (15),
11734
partition p1 values less than maxvalue);
11735
create table t5 (colint int, col1 date) engine='NDB'
11736
partition by list(colint)
11737
subpartition by hash(weekday(col1)) subpartitions 2
11738
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11739
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11740
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11741
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11742
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11743
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11745
create table t6 (colint int, col1 date) engine='NDB'
11746
partition by range(colint)
11747
(partition p0 values less than (weekday('2006-10-14')),
11748
partition p1 values less than maxvalue);
11749
-------------------------------------------------------------------------
11750
--- Access tables with weekday(col1)
11751
-------------------------------------------------------------------------
11752
insert into t1 values ('2006-12-03');
11753
insert into t1 values ('2006-11-17');
11754
insert into t2 values ('2006-12-03');
11755
insert into t2 values ('2006-11-17');
11756
insert into t2 values ('2006-05-25');
11757
insert into t3 values ('2006-12-03');
11758
insert into t3 values ('2006-11-17');
11759
insert into t3 values ('2006-05-25');
11760
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
11761
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
11762
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
11763
select weekday(col1) from t1 order by col1;
11767
select * from t1 order by col1;
11771
select * from t2 order by col1;
11776
select * from t3 order by col1;
11781
select * from t4 order by colint;
11787
select * from t5 order by colint;
11793
select * from t6 order by colint;
11799
update t1 set col1='2006-02-06' where col1='2006-12-03';
11800
update t2 set col1='2006-02-06' where col1='2006-12-03';
11801
update t3 set col1='2006-02-06' where col1='2006-12-03';
11802
update t4 set col1='2006-02-06' where col1='2006-12-03';
11803
update t5 set col1='2006-02-06' where col1='2006-12-03';
11804
update t6 set col1='2006-02-06' where col1='2006-12-03';
11805
select * from t1 order by col1;
11809
select * from t2 order by col1;
11814
select * from t3 order by col1;
11819
select * from t4 order by colint;
11825
select * from t5 order by colint;
11831
select * from t6 order by colint;
11837
-------------------------------------------------------------------------
11838
--- Alter tables with weekday(col1)
11839
-------------------------------------------------------------------------
11840
drop table if exists t11 ;
11841
drop table if exists t22 ;
11842
drop table if exists t33 ;
11843
drop table if exists t44 ;
11844
drop table if exists t55 ;
11845
drop table if exists t66 ;
11846
create table t11 engine='NDB' as select * from t1;
11847
create table t22 engine='NDB' as select * from t2;
11848
create table t33 engine='NDB' as select * from t3;
11849
create table t44 engine='NDB' as select * from t4;
11850
create table t55 engine='NDB' as select * from t5;
11851
create table t66 engine='NDB' as select * from t6;
11853
partition by range(weekday(col1))
11854
(partition p0 values less than (15),
11855
partition p1 values less than maxvalue);
11857
partition by list(weekday(col1))
11858
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
11859
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11860
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11861
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11862
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11863
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11866
partition by hash(weekday(col1));
11868
partition by range(colint)
11869
subpartition by hash(weekday(col1)) subpartitions 2
11870
(partition p0 values less than (15),
11871
partition p1 values less than maxvalue);
11873
partition by list(colint)
11874
subpartition by hash(weekday(col1)) subpartitions 2
11875
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11876
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11877
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11878
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11879
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11880
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11883
partition by range(colint)
11884
(partition p0 values less than (weekday('2006-10-14')),
11885
partition p1 values less than maxvalue);
11886
select * from t11 order by col1;
11890
select * from t22 order by col1;
11895
select * from t33 order by col1;
11900
select * from t44 order by colint;
11906
select * from t55 order by colint;
11912
select * from t66 order by colint;
11918
---------------------------
11919
---- some alter table begin
11920
---------------------------
11922
reorganize partition p0,p1 into
11923
(partition s1 values less than maxvalue);
11924
select * from t11 order by col1;
11929
reorganize partition s1 into
11930
(partition p0 values less than (15),
11931
partition p1 values less than maxvalue);
11932
select * from t11 order by col1;
11937
partition by list(colint)
11938
subpartition by hash(weekday(col1)) subpartitions 5
11939
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
11940
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
11941
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
11942
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
11943
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
11944
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
11946
show create table t55;
11948
t55 CREATE TABLE `t55` (
11949
`colint` int(11) DEFAULT NULL,
11950
`col1` date DEFAULT NULL
11951
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekday(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
11952
select * from t55 order by colint;
11959
reorganize partition p0,p1 into
11960
(partition s1 values less than maxvalue);
11961
select * from t66 order by colint;
11968
reorganize partition s1 into
11969
(partition p0 values less than (weekday('2006-10-14')),
11970
partition p1 values less than maxvalue);
11971
select * from t66 order by colint;
11978
reorganize partition p0,p1 into
11979
(partition s1 values less than maxvalue);
11980
select * from t66 order by colint;
11987
reorganize partition s1 into
11988
(partition p0 values less than (weekday('2006-10-14')),
11989
partition p1 values less than maxvalue);
11990
select * from t66 order by colint;
11996
-------------------------------------------------------------------------
11997
--- Delete rows and partitions of tables with weekday(col1)
11998
-------------------------------------------------------------------------
11999
delete from t1 where col1='2006-11-17';
12000
delete from t2 where col1='2006-11-17';
12001
delete from t3 where col1='2006-11-17';
12002
delete from t4 where col1='2006-11-17';
12003
delete from t5 where col1='2006-11-17';
12004
delete from t6 where col1='2006-11-17';
12005
select * from t1 order by col1;
12008
select * from t2 order by col1;
12012
select * from t3 order by col1;
12016
select * from t4 order by colint;
12022
select * from t5 order by colint;
12028
insert into t1 values ('2006-11-17');
12029
insert into t2 values ('2006-11-17');
12030
insert into t3 values ('2006-11-17');
12031
insert into t4 values (60,'2006-11-17');
12032
insert into t5 values (60,'2006-11-17');
12033
insert into t6 values (60,'2006-11-17');
12034
select * from t1 order by col1;
12038
select * from t2 order by col1;
12043
select * from t3 order by col1;
12048
select * from t4 order by colint;
12055
select * from t5 order by colint;
12062
select * from t6 order by colint;
12069
alter table t1 drop partition p0;
12070
alter table t2 drop partition p0;
12071
alter table t4 drop partition p0;
12072
alter table t5 drop partition p0;
12073
alter table t6 drop partition p0;
12074
select * from t1 order by col1;
12076
select * from t2 order by col1;
12078
select * from t3 order by col1;
12083
select * from t4 order by colint;
12086
select * from t5 order by colint;
12089
select * from t6 order by colint;
12092
-------------------------------------------------------------------------
12093
--- Delete rows and partitions of tables with weekday(col1)
12094
-------------------------------------------------------------------------
12095
delete from t11 where col1='2006-11-17';
12096
delete from t22 where col1='2006-11-17';
12097
delete from t33 where col1='2006-11-17';
12098
delete from t44 where col1='2006-11-17';
12099
delete from t55 where col1='2006-11-17';
12100
delete from t66 where col1='2006-11-17';
12101
select * from t11 order by col1;
12104
select * from t22 order by col1;
12108
select * from t33 order by col1;
12112
select * from t44 order by colint;
12118
select * from t55 order by colint;
12124
insert into t11 values ('2006-11-17');
12125
insert into t22 values ('2006-11-17');
12126
insert into t33 values ('2006-11-17');
12127
insert into t44 values (60,'2006-11-17');
12128
insert into t55 values (60,'2006-11-17');
12129
insert into t66 values (60,'2006-11-17');
12130
select * from t11 order by col1;
12134
select * from t22 order by col1;
12139
select * from t33 order by col1;
12144
select * from t44 order by colint;
12151
select * from t55 order by colint;
12158
select * from t66 order by colint;
12165
alter table t11 drop partition p0;
12166
alter table t22 drop partition p0;
12167
alter table t44 drop partition p0;
12168
alter table t55 drop partition p0;
12169
alter table t66 drop partition p0;
12170
select * from t11 order by col1;
12172
select * from t22 order by col1;
12174
select * from t33 order by col1;
12179
select * from t44 order by colint;
12182
select * from t55 order by colint;
12185
select * from t66 order by colint;
12188
-------------------------
12189
---- some alter table end
12190
-------------------------
12191
drop table if exists t1 ;
12192
drop table if exists t2 ;
12193
drop table if exists t3 ;
12194
drop table if exists t4 ;
12195
drop table if exists t5 ;
12196
drop table if exists t6 ;
12197
drop table if exists t11 ;
12198
drop table if exists t22 ;
12199
drop table if exists t33 ;
12200
drop table if exists t44 ;
12201
drop table if exists t55 ;
12202
drop table if exists t66 ;
12203
-------------------------------------------------------------------------
12204
--- weekofyear(col1) in partition with coltype date
12205
-------------------------------------------------------------------------
12206
drop table if exists t1 ;
12207
drop table if exists t2 ;
12208
drop table if exists t3 ;
12209
drop table if exists t4 ;
12210
drop table if exists t5 ;
12211
drop table if exists t6 ;
12212
-------------------------------------------------------------------------
12213
--- Create tables with weekofyear(col1)
12214
-------------------------------------------------------------------------
12215
create table t1 (col1 date) engine='NDB'
12216
partition by range(weekofyear(col1))
12217
(partition p0 values less than (15),
12218
partition p1 values less than maxvalue);
12219
create table t2 (col1 date) engine='NDB'
12220
partition by list(weekofyear(col1))
12221
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
12222
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12223
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12224
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12225
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12226
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12228
create table t3 (col1 date) engine='NDB'
12229
partition by hash(weekofyear(col1));
12230
create table t4 (colint int, col1 date) engine='NDB'
12231
partition by range(colint)
12232
subpartition by hash(weekofyear(col1)) subpartitions 2
12233
(partition p0 values less than (15),
12234
partition p1 values less than maxvalue);
12235
create table t5 (colint int, col1 date) engine='NDB'
12236
partition by list(colint)
12237
subpartition by hash(weekofyear(col1)) subpartitions 2
12238
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12239
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12240
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12241
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12242
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12243
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12245
create table t6 (colint int, col1 date) engine='NDB'
12246
partition by range(colint)
12247
(partition p0 values less than (weekofyear('2006-02-14')),
12248
partition p1 values less than maxvalue);
12249
-------------------------------------------------------------------------
12250
--- Access tables with weekofyear(col1)
12251
-------------------------------------------------------------------------
12252
insert into t1 values ('2006-01-03');
12253
insert into t1 values ('2006-03-17');
12254
insert into t2 values ('2006-01-03');
12255
insert into t2 values ('2006-03-17');
12256
insert into t2 values ('2006-05-25');
12257
insert into t3 values ('2006-01-03');
12258
insert into t3 values ('2006-03-17');
12259
insert into t3 values ('2006-05-25');
12260
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
12261
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
12262
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
12263
select weekofyear(col1) from t1 order by col1;
12267
select * from t1 order by col1;
12271
select * from t2 order by col1;
12276
select * from t3 order by col1;
12281
select * from t4 order by colint;
12287
select * from t5 order by colint;
12293
select * from t6 order by colint;
12299
update t1 set col1='2006-09-06' where col1='2006-01-03';
12300
update t2 set col1='2006-09-06' where col1='2006-01-03';
12301
update t3 set col1='2006-09-06' where col1='2006-01-03';
12302
update t4 set col1='2006-09-06' where col1='2006-01-03';
12303
update t5 set col1='2006-09-06' where col1='2006-01-03';
12304
update t6 set col1='2006-09-06' where col1='2006-01-03';
12305
select * from t1 order by col1;
12309
select * from t2 order by col1;
12314
select * from t3 order by col1;
12319
select * from t4 order by colint;
12325
select * from t5 order by colint;
12331
select * from t6 order by colint;
12337
-------------------------------------------------------------------------
12338
--- Alter tables with weekofyear(col1)
12339
-------------------------------------------------------------------------
12340
drop table if exists t11 ;
12341
drop table if exists t22 ;
12342
drop table if exists t33 ;
12343
drop table if exists t44 ;
12344
drop table if exists t55 ;
12345
drop table if exists t66 ;
12346
create table t11 engine='NDB' as select * from t1;
12347
create table t22 engine='NDB' as select * from t2;
12348
create table t33 engine='NDB' as select * from t3;
12349
create table t44 engine='NDB' as select * from t4;
12350
create table t55 engine='NDB' as select * from t5;
12351
create table t66 engine='NDB' as select * from t6;
12353
partition by range(weekofyear(col1))
12354
(partition p0 values less than (15),
12355
partition p1 values less than maxvalue);
12357
partition by list(weekofyear(col1))
12358
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
12359
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12360
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12361
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12362
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12363
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12366
partition by hash(weekofyear(col1));
12368
partition by range(colint)
12369
subpartition by hash(weekofyear(col1)) subpartitions 2
12370
(partition p0 values less than (15),
12371
partition p1 values less than maxvalue);
12373
partition by list(colint)
12374
subpartition by hash(weekofyear(col1)) subpartitions 2
12375
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12376
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12377
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12378
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12379
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12380
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12383
partition by range(colint)
12384
(partition p0 values less than (weekofyear('2006-02-14')),
12385
partition p1 values less than maxvalue);
12386
select * from t11 order by col1;
12390
select * from t22 order by col1;
12395
select * from t33 order by col1;
12400
select * from t44 order by colint;
12406
select * from t55 order by colint;
12412
select * from t66 order by colint;
12418
---------------------------
12419
---- some alter table begin
12420
---------------------------
12422
reorganize partition p0,p1 into
12423
(partition s1 values less than maxvalue);
12424
select * from t11 order by col1;
12429
reorganize partition s1 into
12430
(partition p0 values less than (15),
12431
partition p1 values less than maxvalue);
12432
select * from t11 order by col1;
12437
partition by list(colint)
12438
subpartition by hash(weekofyear(col1)) subpartitions 5
12439
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12440
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12441
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12442
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12443
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12444
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12446
show create table t55;
12448
t55 CREATE TABLE `t55` (
12449
`colint` int(11) DEFAULT NULL,
12450
`col1` date DEFAULT NULL
12451
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (weekofyear(col1)) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
12452
select * from t55 order by colint;
12459
reorganize partition p0,p1 into
12460
(partition s1 values less than maxvalue);
12461
select * from t66 order by colint;
12468
reorganize partition s1 into
12469
(partition p0 values less than (weekofyear('2006-02-14')),
12470
partition p1 values less than maxvalue);
12471
select * from t66 order by colint;
12478
reorganize partition p0,p1 into
12479
(partition s1 values less than maxvalue);
12480
select * from t66 order by colint;
12487
reorganize partition s1 into
12488
(partition p0 values less than (weekofyear('2006-02-14')),
12489
partition p1 values less than maxvalue);
12490
select * from t66 order by colint;
12496
-------------------------------------------------------------------------
12497
--- Delete rows and partitions of tables with weekofyear(col1)
12498
-------------------------------------------------------------------------
12499
delete from t1 where col1='2006-03-17';
12500
delete from t2 where col1='2006-03-17';
12501
delete from t3 where col1='2006-03-17';
12502
delete from t4 where col1='2006-03-17';
12503
delete from t5 where col1='2006-03-17';
12504
delete from t6 where col1='2006-03-17';
12505
select * from t1 order by col1;
12508
select * from t2 order by col1;
12512
select * from t3 order by col1;
12516
select * from t4 order by colint;
12522
select * from t5 order by colint;
12528
insert into t1 values ('2006-03-17');
12529
insert into t2 values ('2006-03-17');
12530
insert into t3 values ('2006-03-17');
12531
insert into t4 values (60,'2006-03-17');
12532
insert into t5 values (60,'2006-03-17');
12533
insert into t6 values (60,'2006-03-17');
12534
select * from t1 order by col1;
12538
select * from t2 order by col1;
12543
select * from t3 order by col1;
12548
select * from t4 order by colint;
12555
select * from t5 order by colint;
12562
select * from t6 order by colint;
12569
alter table t1 drop partition p0;
12570
alter table t2 drop partition p0;
12571
alter table t4 drop partition p0;
12572
alter table t5 drop partition p0;
12573
alter table t6 drop partition p0;
12574
select * from t1 order by col1;
12577
select * from t2 order by col1;
12582
select * from t3 order by col1;
12587
select * from t4 order by colint;
12590
select * from t5 order by colint;
12593
select * from t6 order by colint;
12596
-------------------------------------------------------------------------
12597
--- Delete rows and partitions of tables with weekofyear(col1)
12598
-------------------------------------------------------------------------
12599
delete from t11 where col1='2006-03-17';
12600
delete from t22 where col1='2006-03-17';
12601
delete from t33 where col1='2006-03-17';
12602
delete from t44 where col1='2006-03-17';
12603
delete from t55 where col1='2006-03-17';
12604
delete from t66 where col1='2006-03-17';
12605
select * from t11 order by col1;
12608
select * from t22 order by col1;
12612
select * from t33 order by col1;
12616
select * from t44 order by colint;
12622
select * from t55 order by colint;
12628
insert into t11 values ('2006-03-17');
12629
insert into t22 values ('2006-03-17');
12630
insert into t33 values ('2006-03-17');
12631
insert into t44 values (60,'2006-03-17');
12632
insert into t55 values (60,'2006-03-17');
12633
insert into t66 values (60,'2006-03-17');
12634
select * from t11 order by col1;
12638
select * from t22 order by col1;
12643
select * from t33 order by col1;
12648
select * from t44 order by colint;
12655
select * from t55 order by colint;
12662
select * from t66 order by colint;
12669
alter table t11 drop partition p0;
12670
alter table t22 drop partition p0;
12671
alter table t44 drop partition p0;
12672
alter table t55 drop partition p0;
12673
alter table t66 drop partition p0;
12674
select * from t11 order by col1;
12677
select * from t22 order by col1;
12682
select * from t33 order by col1;
12687
select * from t44 order by colint;
12690
select * from t55 order by colint;
12693
select * from t66 order by colint;
12696
-------------------------
12697
---- some alter table end
12698
-------------------------
12699
drop table if exists t1 ;
12700
drop table if exists t2 ;
12701
drop table if exists t3 ;
12702
drop table if exists t4 ;
12703
drop table if exists t5 ;
12704
drop table if exists t6 ;
12705
drop table if exists t11 ;
12706
drop table if exists t22 ;
12707
drop table if exists t33 ;
12708
drop table if exists t44 ;
12709
drop table if exists t55 ;
12710
drop table if exists t66 ;
12711
-------------------------------------------------------------------------
12712
--- year(col1)-1990 in partition with coltype date
12713
-------------------------------------------------------------------------
12714
drop table if exists t1 ;
12715
drop table if exists t2 ;
12716
drop table if exists t3 ;
12717
drop table if exists t4 ;
12718
drop table if exists t5 ;
12719
drop table if exists t6 ;
12720
-------------------------------------------------------------------------
12721
--- Create tables with year(col1)-1990
12722
-------------------------------------------------------------------------
12723
create table t1 (col1 date) engine='NDB'
12724
partition by range(year(col1)-1990)
12725
(partition p0 values less than (15),
12726
partition p1 values less than maxvalue);
12727
create table t2 (col1 date) engine='NDB'
12728
partition by list(year(col1)-1990)
12729
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
12730
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12731
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12732
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12733
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12734
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12736
create table t3 (col1 date) engine='NDB'
12737
partition by hash(year(col1)-1990);
12738
create table t4 (colint int, col1 date) engine='NDB'
12739
partition by range(colint)
12740
subpartition by hash(year(col1)-1990) subpartitions 2
12741
(partition p0 values less than (15),
12742
partition p1 values less than maxvalue);
12743
create table t5 (colint int, col1 date) engine='NDB'
12744
partition by list(colint)
12745
subpartition by hash(year(col1)-1990) subpartitions 2
12746
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12747
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12748
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12749
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12750
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12751
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12753
create table t6 (colint int, col1 date) engine='NDB'
12754
partition by range(colint)
12755
(partition p0 values less than (year('2005-10-14')-1990),
12756
partition p1 values less than maxvalue);
12757
-------------------------------------------------------------------------
12758
--- Access tables with year(col1)-1990
12759
-------------------------------------------------------------------------
12760
insert into t1 values ('1996-01-03');
12761
insert into t1 values ('2000-02-17');
12762
insert into t2 values ('1996-01-03');
12763
insert into t2 values ('2000-02-17');
12764
insert into t2 values ('2004-05-25');
12765
insert into t3 values ('1996-01-03');
12766
insert into t3 values ('2000-02-17');
12767
insert into t3 values ('2004-05-25');
12768
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
12769
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
12770
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
12771
select year(col1)-1990 from t1 order by col1;
12775
select * from t1 order by col1;
12779
select * from t2 order by col1;
12784
select * from t3 order by col1;
12789
select * from t4 order by colint;
12795
select * from t5 order by colint;
12801
select * from t6 order by colint;
12807
update t1 set col1='2002-02-15' where col1='1996-01-03';
12808
update t2 set col1='2002-02-15' where col1='1996-01-03';
12809
update t3 set col1='2002-02-15' where col1='1996-01-03';
12810
update t4 set col1='2002-02-15' where col1='1996-01-03';
12811
update t5 set col1='2002-02-15' where col1='1996-01-03';
12812
update t6 set col1='2002-02-15' where col1='1996-01-03';
12813
select * from t1 order by col1;
12817
select * from t2 order by col1;
12822
select * from t3 order by col1;
12827
select * from t4 order by colint;
12833
select * from t5 order by colint;
12839
select * from t6 order by colint;
12845
-------------------------------------------------------------------------
12846
--- Alter tables with year(col1)-1990
12847
-------------------------------------------------------------------------
12848
drop table if exists t11 ;
12849
drop table if exists t22 ;
12850
drop table if exists t33 ;
12851
drop table if exists t44 ;
12852
drop table if exists t55 ;
12853
drop table if exists t66 ;
12854
create table t11 engine='NDB' as select * from t1;
12855
create table t22 engine='NDB' as select * from t2;
12856
create table t33 engine='NDB' as select * from t3;
12857
create table t44 engine='NDB' as select * from t4;
12858
create table t55 engine='NDB' as select * from t5;
12859
create table t66 engine='NDB' as select * from t6;
12861
partition by range(year(col1)-1990)
12862
(partition p0 values less than (15),
12863
partition p1 values less than maxvalue);
12865
partition by list(year(col1)-1990)
12866
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
12867
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12868
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12869
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12870
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12871
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12874
partition by hash(year(col1)-1990);
12876
partition by range(colint)
12877
subpartition by hash(year(col1)-1990) subpartitions 2
12878
(partition p0 values less than (15),
12879
partition p1 values less than maxvalue);
12881
partition by list(colint)
12882
subpartition by hash(year(col1)-1990) subpartitions 2
12883
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12884
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12885
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12886
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12887
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12888
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12891
partition by range(colint)
12892
(partition p0 values less than (year('2005-10-14')-1990),
12893
partition p1 values less than maxvalue);
12894
select * from t11 order by col1;
12898
select * from t22 order by col1;
12903
select * from t33 order by col1;
12908
select * from t44 order by colint;
12914
select * from t55 order by colint;
12920
select * from t66 order by colint;
12926
---------------------------
12927
---- some alter table begin
12928
---------------------------
12930
reorganize partition p0,p1 into
12931
(partition s1 values less than maxvalue);
12932
select * from t11 order by col1;
12937
reorganize partition s1 into
12938
(partition p0 values less than (15),
12939
partition p1 values less than maxvalue);
12940
select * from t11 order by col1;
12945
partition by list(colint)
12946
subpartition by hash(year(col1)-1990) subpartitions 5
12947
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
12948
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
12949
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
12950
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
12951
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
12952
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
12954
show create table t55;
12956
t55 CREATE TABLE `t55` (
12957
`colint` int(11) DEFAULT NULL,
12958
`col1` date DEFAULT NULL
12959
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (year(col1)-1990) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
12960
select * from t55 order by colint;
12967
reorganize partition p0,p1 into
12968
(partition s1 values less than maxvalue);
12969
select * from t66 order by colint;
12976
reorganize partition s1 into
12977
(partition p0 values less than (year('2005-10-14')-1990),
12978
partition p1 values less than maxvalue);
12979
select * from t66 order by colint;
12986
reorganize partition p0,p1 into
12987
(partition s1 values less than maxvalue);
12988
select * from t66 order by colint;
12995
reorganize partition s1 into
12996
(partition p0 values less than (year('2005-10-14')-1990),
12997
partition p1 values less than maxvalue);
12998
select * from t66 order by colint;
13004
-------------------------------------------------------------------------
13005
--- Delete rows and partitions of tables with year(col1)-1990
13006
-------------------------------------------------------------------------
13007
delete from t1 where col1='2000-02-17';
13008
delete from t2 where col1='2000-02-17';
13009
delete from t3 where col1='2000-02-17';
13010
delete from t4 where col1='2000-02-17';
13011
delete from t5 where col1='2000-02-17';
13012
delete from t6 where col1='2000-02-17';
13013
select * from t1 order by col1;
13016
select * from t2 order by col1;
13020
select * from t3 order by col1;
13024
select * from t4 order by colint;
13030
select * from t5 order by colint;
13036
insert into t1 values ('2000-02-17');
13037
insert into t2 values ('2000-02-17');
13038
insert into t3 values ('2000-02-17');
13039
insert into t4 values (60,'2000-02-17');
13040
insert into t5 values (60,'2000-02-17');
13041
insert into t6 values (60,'2000-02-17');
13042
select * from t1 order by col1;
13046
select * from t2 order by col1;
13051
select * from t3 order by col1;
13056
select * from t4 order by colint;
13063
select * from t5 order by colint;
13070
select * from t6 order by colint;
13077
alter table t1 drop partition p0;
13078
alter table t2 drop partition p0;
13079
alter table t4 drop partition p0;
13080
alter table t5 drop partition p0;
13081
alter table t6 drop partition p0;
13082
select * from t1 order by col1;
13084
select * from t2 order by col1;
13088
select * from t3 order by col1;
13093
select * from t4 order by colint;
13096
select * from t5 order by colint;
13099
select * from t6 order by colint;
13102
-------------------------------------------------------------------------
13103
--- Delete rows and partitions of tables with year(col1)-1990
13104
-------------------------------------------------------------------------
13105
delete from t11 where col1='2000-02-17';
13106
delete from t22 where col1='2000-02-17';
13107
delete from t33 where col1='2000-02-17';
13108
delete from t44 where col1='2000-02-17';
13109
delete from t55 where col1='2000-02-17';
13110
delete from t66 where col1='2000-02-17';
13111
select * from t11 order by col1;
13114
select * from t22 order by col1;
13118
select * from t33 order by col1;
13122
select * from t44 order by colint;
13128
select * from t55 order by colint;
13134
insert into t11 values ('2000-02-17');
13135
insert into t22 values ('2000-02-17');
13136
insert into t33 values ('2000-02-17');
13137
insert into t44 values (60,'2000-02-17');
13138
insert into t55 values (60,'2000-02-17');
13139
insert into t66 values (60,'2000-02-17');
13140
select * from t11 order by col1;
13144
select * from t22 order by col1;
13149
select * from t33 order by col1;
13154
select * from t44 order by colint;
13161
select * from t55 order by colint;
13168
select * from t66 order by colint;
13175
alter table t11 drop partition p0;
13176
alter table t22 drop partition p0;
13177
alter table t44 drop partition p0;
13178
alter table t55 drop partition p0;
13179
alter table t66 drop partition p0;
13180
select * from t11 order by col1;
13182
select * from t22 order by col1;
13186
select * from t33 order by col1;
13191
select * from t44 order by colint;
13194
select * from t55 order by colint;
13197
select * from t66 order by colint;
13200
-------------------------
13201
---- some alter table end
13202
-------------------------
13203
drop table if exists t1 ;
13204
drop table if exists t2 ;
13205
drop table if exists t3 ;
13206
drop table if exists t4 ;
13207
drop table if exists t5 ;
13208
drop table if exists t6 ;
13209
drop table if exists t11 ;
13210
drop table if exists t22 ;
13211
drop table if exists t33 ;
13212
drop table if exists t44 ;
13213
drop table if exists t55 ;
13214
drop table if exists t66 ;
13215
-------------------------------------------------------------------------
13216
--- yearweek(col1)-200600 in partition with coltype date
13217
-------------------------------------------------------------------------
13218
drop table if exists t1 ;
13219
drop table if exists t2 ;
13220
drop table if exists t3 ;
13221
drop table if exists t4 ;
13222
drop table if exists t5 ;
13223
drop table if exists t6 ;
13224
-------------------------------------------------------------------------
13225
--- Create tables with yearweek(col1)-200600
13226
-------------------------------------------------------------------------
13227
create table t1 (col1 date) engine='NDB'
13228
partition by range(yearweek(col1)-200600)
13229
(partition p0 values less than (15),
13230
partition p1 values less than maxvalue);
13231
create table t2 (col1 date) engine='NDB'
13232
partition by list(yearweek(col1)-200600)
13233
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
13234
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
13235
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
13236
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
13237
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
13238
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
13240
create table t3 (col1 date) engine='NDB'
13241
partition by hash(yearweek(col1)-200600);
13242
create table t4 (colint int, col1 date) engine='NDB'
13243
partition by range(colint)
13244
subpartition by hash(yearweek(col1)-200600) subpartitions 2
13245
(partition p0 values less than (15),
13246
partition p1 values less than maxvalue);
13247
create table t5 (colint int, col1 date) engine='NDB'
13248
partition by list(colint)
13249
subpartition by hash(yearweek(col1)-200600) subpartitions 2
13250
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
13251
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
13252
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
13253
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
13254
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
13255
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
13257
create table t6 (colint int, col1 date) engine='NDB'
13258
partition by range(colint)
13259
(partition p0 values less than (yearweek('2006-10-14')-200600),
13260
partition p1 values less than maxvalue);
13261
-------------------------------------------------------------------------
13262
--- Access tables with yearweek(col1)-200600
13263
-------------------------------------------------------------------------
13264
insert into t1 values ('2006-01-03');
13265
insert into t1 values ('2006-08-17');
13266
insert into t2 values ('2006-01-03');
13267
insert into t2 values ('2006-08-17');
13268
insert into t2 values ('2006-03-25');
13269
insert into t3 values ('2006-01-03');
13270
insert into t3 values ('2006-08-17');
13271
insert into t3 values ('2006-03-25');
13272
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t4;
13273
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t5;
13274
load data infile 'MYSQL_TEST_DIR/suite/partitions/include/partition_supported_sql_funcs_int_date.in' into table t6;
13275
select yearweek(col1)-200600 from t1 order by col1;
13276
yearweek(col1)-200600
13279
select * from t1 order by col1;
13283
select * from t2 order by col1;
13288
select * from t3 order by col1;
13293
select * from t4 order by colint;
13299
select * from t5 order by colint;
13305
select * from t6 order by colint;
13311
update t1 set col1='2006-11-15' where col1='2006-01-03';
13312
update t2 set col1='2006-11-15' where col1='2006-01-03';
13313
update t3 set col1='2006-11-15' where col1='2006-01-03';
13314
update t4 set col1='2006-11-15' where col1='2006-01-03';
13315
update t5 set col1='2006-11-15' where col1='2006-01-03';
13316
update t6 set col1='2006-11-15' where col1='2006-01-03';
13317
select * from t1 order by col1;
13321
select * from t2 order by col1;
13326
select * from t3 order by col1;
13331
select * from t4 order by colint;
13337
select * from t5 order by colint;
13343
select * from t6 order by colint;
13349
-------------------------------------------------------------------------
13350
--- Alter tables with yearweek(col1)-200600
13351
-------------------------------------------------------------------------
13352
drop table if exists t11 ;
13353
drop table if exists t22 ;
13354
drop table if exists t33 ;
13355
drop table if exists t44 ;
13356
drop table if exists t55 ;
13357
drop table if exists t66 ;
13358
create table t11 engine='NDB' as select * from t1;
13359
create table t22 engine='NDB' as select * from t2;
13360
create table t33 engine='NDB' as select * from t3;
13361
create table t44 engine='NDB' as select * from t4;
13362
create table t55 engine='NDB' as select * from t5;
13363
create table t66 engine='NDB' as select * from t6;
13365
partition by range(yearweek(col1)-200600)
13366
(partition p0 values less than (15),
13367
partition p1 values less than maxvalue);
13369
partition by list(yearweek(col1)-200600)
13370
(partition p0 values in (0,1,2,3,4,5,6,7,8,9,10),
13371
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
13372
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
13373
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
13374
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
13375
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
13378
partition by hash(yearweek(col1)-200600);
13380
partition by range(colint)
13381
subpartition by hash(yearweek(col1)-200600) subpartitions 2
13382
(partition p0 values less than (15),
13383
partition p1 values less than maxvalue);
13385
partition by list(colint)
13386
subpartition by hash(yearweek(col1)-200600) subpartitions 2
13387
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
13388
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
13389
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
13390
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
13391
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
13392
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
13395
partition by range(colint)
13396
(partition p0 values less than (yearweek('2006-10-14')-200600),
13397
partition p1 values less than maxvalue);
13398
select * from t11 order by col1;
13402
select * from t22 order by col1;
13407
select * from t33 order by col1;
13412
select * from t44 order by colint;
13418
select * from t55 order by colint;
13424
select * from t66 order by colint;
13430
---------------------------
13431
---- some alter table begin
13432
---------------------------
13434
reorganize partition p0,p1 into
13435
(partition s1 values less than maxvalue);
13436
select * from t11 order by col1;
13441
reorganize partition s1 into
13442
(partition p0 values less than (15),
13443
partition p1 values less than maxvalue);
13444
select * from t11 order by col1;
13449
partition by list(colint)
13450
subpartition by hash(yearweek(col1)-200600) subpartitions 5
13451
(partition p0 values in (1,2,3,4,5,6,7,8,9,10),
13452
partition p1 values in (11,12,13,14,15,16,17,18,19,20),
13453
partition p2 values in (21,22,23,24,25,26,27,28,29,30),
13454
partition p3 values in (31,32,33,34,35,36,37,38,39,40),
13455
partition p4 values in (41,42,43,44,45,46,47,48,49,50),
13456
partition p5 values in (51,52,53,54,55,56,57,58,59,60)
13458
show create table t55;
13460
t55 CREATE TABLE `t55` (
13461
`colint` int(11) DEFAULT NULL,
13462
`col1` date DEFAULT NULL
13463
) ENGINE=NDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (colint) SUBPARTITION BY HASH (yearweek(col1)-200600) SUBPARTITIONS 5 (PARTITION p0 VALUES IN (1,2,3,4,5,6,7,8,9,10) ENGINE = NDB, PARTITION p1 VALUES IN (11,12,13,14,15,16,17,18,19,20) ENGINE = NDB, PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30) ENGINE = NDB, PARTITION p3 VALUES IN (31,32,33,34,35,36,37,38,39,40) ENGINE = NDB, PARTITION p4 VALUES IN (41,42,43,44,45,46,47,48,49,50) ENGINE = NDB, PARTITION p5 VALUES IN (51,52,53,54,55,56,57,58,59,60) ENGINE = NDB) */
13464
select * from t55 order by colint;
13471
reorganize partition p0,p1 into
13472
(partition s1 values less than maxvalue);
13473
select * from t66 order by colint;
13480
reorganize partition s1 into
13481
(partition p0 values less than (yearweek('2006-10-14')-200600),
13482
partition p1 values less than maxvalue);
13483
select * from t66 order by colint;
13490
reorganize partition p0,p1 into
13491
(partition s1 values less than maxvalue);
13492
select * from t66 order by colint;
13499
reorganize partition s1 into
13500
(partition p0 values less than (yearweek('2006-10-14')-200600),
13501
partition p1 values less than maxvalue);
13502
select * from t66 order by colint;
13508
-------------------------------------------------------------------------
13509
--- Delete rows and partitions of tables with yearweek(col1)-200600
13510
-------------------------------------------------------------------------
13511
delete from t1 where col1='2006-08-17';
13512
delete from t2 where col1='2006-08-17';
13513
delete from t3 where col1='2006-08-17';
13514
delete from t4 where col1='2006-08-17';
13515
delete from t5 where col1='2006-08-17';
13516
delete from t6 where col1='2006-08-17';
13517
select * from t1 order by col1;
13520
select * from t2 order by col1;
13524
select * from t3 order by col1;
13528
select * from t4 order by colint;
13534
select * from t5 order by colint;
13540
insert into t1 values ('2006-08-17');
13541
insert into t2 values ('2006-08-17');
13542
insert into t3 values ('2006-08-17');
13543
insert into t4 values (60,'2006-08-17');
13544
insert into t5 values (60,'2006-08-17');
13545
insert into t6 values (60,'2006-08-17');
13546
select * from t1 order by col1;
13550
select * from t2 order by col1;
13555
select * from t3 order by col1;
13560
select * from t4 order by colint;
13567
select * from t5 order by colint;
13574
select * from t6 order by colint;
13581
alter table t1 drop partition p0;
13582
alter table t2 drop partition p0;
13583
alter table t4 drop partition p0;
13584
alter table t5 drop partition p0;
13585
alter table t6 drop partition p0;
13586
select * from t1 order by col1;
13590
select * from t2 order by col1;
13595
select * from t3 order by col1;
13600
select * from t4 order by colint;
13603
select * from t5 order by colint;
13606
select * from t6 order by colint;
13609
-------------------------------------------------------------------------
13610
--- Delete rows and partitions of tables with yearweek(col1)-200600
13611
-------------------------------------------------------------------------
13612
delete from t11 where col1='2006-08-17';
13613
delete from t22 where col1='2006-08-17';
13614
delete from t33 where col1='2006-08-17';
13615
delete from t44 where col1='2006-08-17';
13616
delete from t55 where col1='2006-08-17';
13617
delete from t66 where col1='2006-08-17';
13618
select * from t11 order by col1;
13621
select * from t22 order by col1;
13625
select * from t33 order by col1;
13629
select * from t44 order by colint;
13635
select * from t55 order by colint;
13641
insert into t11 values ('2006-08-17');
13642
insert into t22 values ('2006-08-17');
13643
insert into t33 values ('2006-08-17');
13644
insert into t44 values (60,'2006-08-17');
13645
insert into t55 values (60,'2006-08-17');
13646
insert into t66 values (60,'2006-08-17');
13647
select * from t11 order by col1;
13651
select * from t22 order by col1;
13656
select * from t33 order by col1;
13661
select * from t44 order by colint;
13668
select * from t55 order by colint;
13675
select * from t66 order by colint;
13682
alter table t11 drop partition p0;
13683
alter table t22 drop partition p0;
13684
alter table t44 drop partition p0;
13685
alter table t55 drop partition p0;
13686
alter table t66 drop partition p0;
13687
select * from t11 order by col1;
13691
select * from t22 order by col1;
13696
select * from t33 order by col1;
13701
select * from t44 order by colint;
13704
select * from t55 order by colint;
13707
select * from t66 order by colint;
13710
-------------------------
13711
---- some alter table end
13712
-------------------------
13713
drop table if exists t1 ;
13714
drop table if exists t2 ;
13715
drop table if exists t3 ;
13716
drop table if exists t4 ;
13717
drop table if exists t5 ;
13718
drop table if exists t6 ;
13719
drop table if exists t11 ;
13720
drop table if exists t22 ;
13721
drop table if exists t33 ;
13722
drop table if exists t44 ;
13723
drop table if exists t55 ;
13724
drop table if exists t66 ;