summaryrefslogtreecommitdiff
path: root/storage/connect/mysql-test
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-07-17 18:13:51 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-07-17 18:13:51 +0200
commit19042843613efeffb4880c4b145a7744b4810ab5 (patch)
treefd009e8f4663e6e7cd99eab8219353e4db276b0e /storage/connect/mysql-test
parent78292e17ae2ceb3413644a29b25afe0c24d2bcc3 (diff)
downloadmariadb-git-19042843613efeffb4880c4b145a7744b4810ab5.tar.gz
This commit brings many changes, in particular two important ones:
1) Support of partitioning by connect. A table can be partitioned by files, this is an enhanced MULTIPLE table. It can be also partitioned by sub-tables like TBL and this enables table sharding. 2) Handling a CONNECT bug that causes in some cases extraneous rows to remain in the table after an UPDATE or DELETE when the command uses indexing (for not fixed file tables). Until a real fix is done, CONNECT tries to ignore indexing and if it cannot do it abort the command with an error message. - Add tests on partitioning added: storage/connect/mysql-test/connect/r/part_file.result storage/connect/mysql-test/connect/r/part_table.result storage/connect/mysql-test/connect/t/part_file.test storage/connect/mysql-test/connect/t/part_table.test - Temporary fix modified: sql/sql_partition.cc - Add partition support modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h storage/connect/reldef.cpp storage/connect/reldef.h storage/connect/tabdos.cpp - Add functions ha_connect::IsUnique and ha_connect::CheckColumnList modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h - Prevent updating a partition table column that is part of the partition function (outward tables only) modified: storage/connect/ha_connect.cc - Support INSERT/UPDATE/DELETE for PROXY tables modified: storage/connect/tabutil.cpp - Handle the bug on updating rows via indexing. Waiting for a real fix, Don't use indexing when possible else raise an error and abort. modified: storage/connect/ha_connect.cc - dbuserp->UseTemp set to TMP_AUTO modified: storage/connect/connect.cc - Add members nox, abort and only modified: storage/connect/ha_connect.cc storage/connect/ha_connect.h - Add arguments nox and abort to CntCloseTable modified: storage/connect/connect.cc storage/connect/connect.h storage/connect/filamap.cpp storage/connect/filamap.h storage/connect/filamdbf.cpp storage/connect/filamdbf.h storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/filamtxt.h storage/connect/filamvct.cpp storage/connect/filamvct.h storage/connect/filamzip.cpp storage/connect/filamzip.h storage/connect/ha_connect.cc - Add arguments abort to CloseTableFile and RenameTempFile modified: storage/connect/filamap.cpp storage/connect/filamap.h storage/connect/filamdbf.cpp storage/connect/filamdbf.h storage/connect/filamfix.cpp storage/connect/filamfix.h storage/connect/filamtxt.cpp storage/connect/filamtxt.h storage/connect/filamvct.cpp storage/connect/filamvct.h storage/connect/filamzip.cpp storage/connect/filamzip.h storage/connect/tabdos.cpp storage/connect/tabdos.h storage/connect/tabvct.cpp storage/connect/xtable.h - Fix info->records when file does not exists modified: storage/connect/connect.cc - Close XML table when opened for info modified: storage/connect/connect.cc - Add function VCTFAM::GetFileLength modified: storage/connect/filamvct.cpp storage/connect/filamvct.h - Column option DISTRIB -> ENUM modified: storage/connect/ha_connect.cc - Options connect, query_string and partname allways available modified: storage/connect/ha_connect.cc - Add function MYSQLC::GetTableSize modified: storage/connect/myconn.cpp storage/connect/myconn.h - Add new special columns (PARTNAME, FNAME, FPATH, FTYPE and FDISK) modified: storage/connect/colblk.cpp storage/connect/colblk.h storage/connect/plgdbsem.h storage/connect/table.cpp - Add function ExtractFromPath modified: storage/connect/colblk.cpp storage/connect/plgdbsem.h storage/connect/plgdbutl.cpp - Enhance Cardinality for some table types modified: storage/connect/tabdos.cpp storage/connect/tabmysql.cpp storage/connect/tabmysql.h storage/connect/tabodbc.cpp storage/connect/tabodbc.h storage/connect/tabsys.cpp storage/connect/tabsys.h storage/connect/xindex.cpp storage/connect/xindex.h storage/connect/xtable.h - Add test on special column modified: storage/connect/tabfmt.cpp - Add new files (added for block indexing) modified: storage/connect/CMakeLists.txt
Diffstat (limited to 'storage/connect/mysql-test')
-rw-r--r--storage/connect/mysql-test/connect/r/part_file.result355
-rw-r--r--storage/connect/mysql-test/connect/r/part_table.result180
-rw-r--r--storage/connect/mysql-test/connect/t/part_file.test159
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test85
4 files changed, 779 insertions, 0 deletions
diff --git a/storage/connect/mysql-test/connect/r/part_file.result b/storage/connect/mysql-test/connect/r/part_file.result
new file mode 100644
index 00000000000..b342059bff0
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/part_file.result
@@ -0,0 +1,355 @@
+# This will be used to see what data files are created
+CREATE TABLE dr1 (
+FNAME VARCHAR(256) NOT NULL FLAG=2,
+FTYPE CHAR(8) NOT NULL FLAG=3
+# ,FSIZE INT(6) NOT NULL FLAG=5 removed because Unix size != Windows size
+) engine=CONNECT table_type=DIR file_name='t1#P#*.*';
+#
+# Testing partitioning on inward table
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=CSV
+PARTITION BY RANGE(id) (
+PARTITION first VALUES LESS THAN(10),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+INSERT INTO t1 VALUES(4, 'four'),(24, 'twenty four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+first 2
+middle 3
+last 2
+SELECT * FROM t1;
+id msg
+4 four
+7 seven
+24 twenty four
+10 ten
+40 forty
+60 sixty
+81 eighty one
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 last ALL NULL NULL NULL NULL 13 Using where
+SELECT * FROM t1 WHERE id > 50;
+id msg
+60 sixty
+81 eighty one
+SHOW TABLE STATUS LIKE 't1';
+Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
+t1 CONNECT 10 Dynamic 7 10 76 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned `TABLE_TYPE`=CSV
+UPDATE t1 set id = 41 WHERE msg = 'four';
+ERROR HY000: Got error 174 'Cannot update column id because it is used for partitioning' from CONNECT
+UPDATE t1 set msg = 'quatre' WHERE id = 4;
+SELECT * FROM dr1;
+FNAME FTYPE
+t1#P#first .csv
+t1#P#last .csv
+t1#P#middle .csv
+#
+# Altering partitioning on inward table
+#
+ALTER TABLE t1
+PARTITION by range(id) (
+PARTITION first VALUES LESS THAN(11),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+first 3
+middle 2
+last 2
+SELECT * FROM dr1;
+FNAME FTYPE
+t1#P#first .csv
+t1#P#last .csv
+t1#P#middle .csv
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 first ALL NULL NULL NULL NULL 14 Using where
+SELECT * FROM t1 WHERE id=10;
+id msg
+10 ten
+DELETE FROM t1 WHERE id in (4,60);
+SELECT * FROM t1;
+id msg
+7 seven
+10 ten
+24 twenty four
+40 forty
+81 eighty one
+DROP TABLE t1;
+SELECT * FROM dr1;
+FNAME FTYPE
+#
+# Testing partitioning on a void outward table
+#
+ALTER TABLE dr1 file_name='part*.*';
+Warnings:
+Warning 1105 This is an outward table, table data were not modified.
+CREATE TABLE t1 (
+rwid INT(6) DEFAULT 0 SPECIAL=ROWID,
+rnum INT(6) DEFAULT 0 SPECIAL=ROWNUM,
+prtn VARCHAR(64) DEFAULT '' SPECIAL=PARTID,
+tbn VARCHAR(64) DEFAULT '' SPECIAL=TABID,
+fid VARCHAR(256) DEFAULT '' SPECIAL=FNAME,
+id INT KEY NOT NULL,
+msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt';
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+Warnings:
+Warning 1105 Open(rb) error 2 on DATADIR/test/part%s.txt: No such file or directory
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 id A NULL NULL NULL XINDEX
+SELECT * FROM dr1;
+FNAME FTYPE
+INSERT INTO t1(id,msg) VALUES(4, 'four');
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+INSERT INTO t1(id,msg) VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1(id,msg) VALUES(72,'seventy two'),(20,'twenty'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 4
+2 4
+3 3
+SELECT * FROM t1;
+rwid rnum prtn tbn fid id msg
+1 1 1 t1 part1 4 four
+2 2 1 t1 part1 7 seven
+3 3 1 t1 part1 1 one
+4 4 1 t1 part1 8 eight
+1 1 2 t1 part2 10 ten
+2 2 2 t1 part2 40 forty
+3 3 2 t1 part2 20 twenty
+4 4 2 t1 part2 35 thirty five
+1 1 3 t1 part3 60 sixty
+2 2 3 t1 part3 81 eighty one
+3 3 3 t1 part3 72 seventy two
+SELECT * FROM t1 order by id;
+rwid rnum prtn tbn fid id msg
+3 3 1 t1 part1 1 one
+1 1 1 t1 part1 4 four
+2 2 1 t1 part1 7 seven
+4 4 1 t1 part1 8 eight
+1 1 2 t1 part2 10 ten
+3 3 2 t1 part2 20 twenty
+4 4 2 t1 part2 35 thirty five
+2 2 2 t1 part2 40 forty
+1 1 3 t1 part3 60 sixty
+3 3 3 t1 part3 72 seventy two
+2 2 3 t1 part3 81 eighty one
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 2 const PRIMARY PRIMARY 4 const 1
+SELECT * FROM t1 WHERE id = 10;
+rwid rnum prtn tbn fid id msg
+1 1 2 t1 part2 10 ten
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 7 Using where
+SELECT * FROM t1 WHERE id >= 10;
+rwid rnum prtn tbn fid id msg
+1 1 2 t1 part2 10 ten
+3 3 2 t1 part2 20 twenty
+4 4 2 t1 part2 35 thirty five
+2 2 2 t1 part2 40 forty
+1 1 3 t1 part3 60 sixty
+3 3 3 t1 part3 72 seventy two
+2 2 3 t1 part3 81 eighty one
+SELECT count(*) FROM t1 WHERE id < 10;
+count(*)
+4
+SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn;
+pn count(*)
+1 4
+2 4
+3 3
+SELECT prtn, count(*) FROM t1 group by prtn;
+prtn count(*)
+1 4
+2 4
+3 3
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 3 range PRIMARY PRIMARY 4 NULL 3 Using where
+SELECT * FROM t1 WHERE id = 35;
+rwid rnum prtn tbn fid id msg
+4 4 2 t1 part2 35 thirty five
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+# This does not change the partition file data and is WRONG
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+Warnings:
+Warning 1105 Data repartition in 1 is unchecked
+Warning 1105 Data repartition in 2 is unchecked
+Warning 1105 Data repartition in 3 is unchecked
+SELECT CASE WHEN id < 11 THEN 1 WHEN id < 70 THEN 2 ELSE 3 END AS pn, COUNT(*) FROM t1 GROUP BY pn;
+pn COUNT(*)
+1 5
+2 4
+3 2
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 4
+2 4
+3 3
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+#
+# This is the correct way to change partitioning:
+# Save table values, erase the table, then re-insert saved values in modified table
+#
+CREATE TABLE t2 (
+id INT NOT NULL,
+msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX;
+Warnings:
+Warning 1105 No file name. Table will use t2.fix
+INSERT INTO t2 SELECT id, msg FROM t1;
+DELETE FROM t1;
+INSERT INTO t1(id,msg) SELECT * FROM t2;
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 5
+2 4
+3 2
+SELECT * FROM t1;
+rwid rnum prtn tbn fid id msg
+1 1 1 t1 part1 4 four
+2 2 1 t1 part1 7 seven
+3 3 1 t1 part1 1 one
+4 4 1 t1 part1 8 eight
+5 5 1 t1 part1 10 ten
+1 1 2 t1 part2 40 forty
+2 2 2 t1 part2 20 twenty
+3 3 2 t1 part2 35 thirty five
+4 4 2 t1 part2 60 sixty
+1 1 3 t1 part3 81 eighty one
+2 2 3 t1 part3 72 seventy two
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# Testing partitioning on a populated outward table
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt'
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+Warnings:
+Warning 1105 Data repartition in 1 is unchecked
+Warning 1105 Data repartition in 2 is unchecked
+Warning 1105 Data repartition in 3 is unchecked
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 5
+2 4
+3 2
+SELECT * FROM t1 WHERE id < 11;
+id msg
+4 four
+7 seven
+1 one
+8 eight
+10 ten
+SELECT * FROM t1 WHERE id >= 70;
+id msg
+81 eighty one
+72 seventy two
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+#
+# Testing indexing on a partitioned table
+#
+CREATE INDEX XID ON t1(id);
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 1 XID 1 id A NULL NULL NULL XINDEX
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 1 ref XID XID 4 const 1
+DROP INDEX XID ON t1;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .txt
+part2 .txt
+part3 .txt
+ALTER TABLE t1 ADD PRIMARY KEY (id);
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 id A NULL NULL NULL XINDEX
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .fnx
+part1 .txt
+part2 .fnx
+part2 .txt
+part3 .fnx
+part3 .txt
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 1 const PRIMARY PRIMARY 4 const 1
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+SELECT * FROM dr1;
+FNAME FTYPE
+part1 .txt
+part2 .txt
+part3 .txt
+DROP TABLE t1;
+DROP TABLE dr1;
diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result
new file mode 100644
index 00000000000..03c130548fa
--- /dev/null
+++ b/storage/connect/mysql-test/connect/r/part_table.result
@@ -0,0 +1,180 @@
+CREATE TABLE xt1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=MyISAM;
+INSERT INTO xt1 VALUES(4, 'four'),(7,'seven'),(1,'one'),(8,'eight');
+SELECT * FROM xt1;
+id msg
+4 four
+7 seven
+1 one
+8 eight
+CREATE TABLE xt2 (
+id INT KEY NOT NULL,
+msg VARCHAR(32));
+INSERT INTO xt2 VALUES(10,'ten'),(40,'forty'),(11,'eleven'),(35,'thirty five');
+SELECT * FROM xt2;
+id msg
+10 ten
+40 forty
+11 eleven
+35 thirty five
+CREATE TABLE xt3 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=CSV;
+Warnings:
+Warning 1105 No file name. Table will use xt3.csv
+INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
+SELECT * FROM xt3;
+id msg
+60 sixty
+81 eighty one
+72 seventy two
+CREATE TABLE t1 (
+id INT NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+Warnings:
+Warning 1105 Data repartition in 1 is unchecked
+Warning 1105 Data repartition in 2 is unchecked
+Warning 1105 Data repartition in 3 is unchecked
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 4
+2 4
+3 3
+SELECT * FROM t1;
+id msg
+4 four
+7 seven
+1 one
+8 eight
+10 ten
+40 forty
+11 eleven
+35 thirty five
+60 sixty
+81 eighty one
+72 seventy two
+DELETE FROM t1;
+Warnings:
+Note 1105 xt1: 4 affected rows
+Note 1105 xt2: 4 affected rows
+ALTER TABLE t1 ADD INDEX XID(id);
+ERROR HY000: Table type PROXY is not indexable
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1 VALUES(72,'seventy two'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 4
+2 4
+3 3
+SELECT * FROM t1;
+id msg
+4 four
+7 seven
+1 one
+8 eight
+10 ten
+40 forty
+11 eleven
+35 thirty five
+60 sixty
+81 eighty one
+72 seventy two
+EXPLAIN PARTITIONS
+SELECT * FROM t1 WHERE id = 81;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 3 ALL NULL NULL NULL NULL 21 Using where
+DELETE FROM t1;
+Warnings:
+Note 1105 xt1: 4 affected rows
+Note 1105 xt2: 4 affected rows
+DROP TABLE t1;
+CREATE TABLE t1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+Warnings:
+Warning 1105 Data repartition in 1 is unchecked
+Warning 1105 Data repartition in 2 is unchecked
+Warning 1105 Data repartition in 3 is unchecked
+SHOW INDEX FROM t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
+t1 0 PRIMARY 1 id NULL NULL NULL NULL REMOTE
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(40, 'forty');
+INSERT INTO t1 VALUES(72,'seventy two');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(60,'sixty'),(81,'eighty one'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+partition_name table_rows
+1 4
+2 4
+3 3
+SELECT * FROM t1;
+id msg
+4 four
+7 seven
+1 one
+8 eight
+40 forty
+10 ten
+11 eleven
+35 thirty five
+72 seventy two
+60 sixty
+81 eighty one
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81;
+id select_type table partitions type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 3 const PRIMARY PRIMARY 4 const 1
+SELECT * FROM t1 WHERE id = 7;
+id msg
+7 seven
+SELECT * FROM t1 WHERE id = 35;
+id msg
+35 thirty five
+UPDATE t1 SET msg = 'number' WHERE id in (60,72);
+ERROR HY000: Got error 122 'Remote: Got error 122 'Cannot use indexing for this command' from CONNECT' from CONNECT
+UPDATE t1 SET msg = 'soixante' WHERE id = 60;
+Warnings:
+Note 1105 xt3: 1 affected rows
+SELECT * FROM t1 WHERE id > 50;
+id msg
+60 soixante
+72 seventy two
+81 eighty one
+UPDATE t1 SET msg = 'big' WHERE id > 50;
+Warnings:
+Note 1105 xt3: 3 affected rows
+UPDATE t1 SET msg = 'sept' WHERE id = 7;
+Warnings:
+Note 1105 xt1: 1 affected rows
+SELECT * FROM t1;
+id msg
+4 four
+7 sept
+1 one
+8 eight
+40 forty
+10 ten
+11 eleven
+35 thirty five
+72 big
+60 big
+81 big
+DELETE FROM t1 WHERE id in (60,72);
+ERROR HY000: Got error 122 'Remote: Got error 122 'Cannot use indexing for this command' from CONNECT' from CONNECT
+DROP TABLE t1;
+DROP TABLE xt1;
+DROP TABLE xt2;
+DROP TABLE xt3;
diff --git a/storage/connect/mysql-test/connect/t/part_file.test b/storage/connect/mysql-test/connect/t/part_file.test
new file mode 100644
index 00000000000..52225a3cead
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/part_file.test
@@ -0,0 +1,159 @@
+--source include/have_partition.inc
+let $MYSQLD_DATADIR= `select @@datadir`;
+
+--echo # This will be used to see what data files are created
+CREATE TABLE dr1 (
+ FNAME VARCHAR(256) NOT NULL FLAG=2,
+ FTYPE CHAR(8) NOT NULL FLAG=3
+# ,FSIZE INT(6) NOT NULL FLAG=5 removed because Unix size != Windows size
+) engine=CONNECT table_type=DIR file_name='t1#P#*.*';
+
+--echo #
+--echo # Testing partitioning on inward table
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=CSV
+PARTITION BY RANGE(id) (
+PARTITION first VALUES LESS THAN(10),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+INSERT INTO t1 VALUES(4, 'four'),(24, 'twenty four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+SELECT * FROM t1 WHERE id > 50;
+SHOW TABLE STATUS LIKE 't1';
+--error ER_GET_ERRMSG
+UPDATE t1 set id = 41 WHERE msg = 'four';
+UPDATE t1 set msg = 'quatre' WHERE id = 4;
+SELECT * FROM dr1;
+--echo #
+--echo # Altering partitioning on inward table
+--echo #
+ALTER TABLE t1
+PARTITION by range(id) (
+PARTITION first VALUES LESS THAN(11),
+PARTITION middle VALUES LESS THAN(50),
+PARTITION last VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM dr1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10;
+SELECT * FROM t1 WHERE id=10;
+DELETE FROM t1 WHERE id in (4,60);
+SELECT * FROM t1;
+DROP TABLE t1;
+SELECT * FROM dr1;
+
+--echo #
+--echo # Testing partitioning on a void outward table
+--echo #
+ALTER TABLE dr1 file_name='part*.*';
+CREATE TABLE t1 (
+ rwid INT(6) DEFAULT 0 SPECIAL=ROWID,
+ rnum INT(6) DEFAULT 0 SPECIAL=ROWNUM,
+ prtn VARCHAR(64) DEFAULT '' SPECIAL=PARTID,
+ tbn VARCHAR(64) DEFAULT '' SPECIAL=TABID,
+ fid VARCHAR(256) DEFAULT '' SPECIAL=FNAME,
+ id INT KEY NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt';
+--replace_result $MYSQLD_DATADIR "DATADIR/"
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SHOW INDEX FROM t1;
+SELECT * FROM dr1;
+INSERT INTO t1(id,msg) VALUES(4, 'four');
+SELECT * FROM dr1;
+INSERT INTO t1(id,msg) VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1(id,msg) VALUES(72,'seventy two'),(20,'twenty'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+SELECT * FROM t1 order by id;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE id = 10;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10;
+SELECT * FROM t1 WHERE id >= 10;
+SELECT count(*) FROM t1 WHERE id < 10;
+SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn;
+SELECT prtn, count(*) FROM t1 group by prtn;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
+SELECT * FROM t1 WHERE id = 35;
+SELECT * FROM dr1;
+--echo # This does not change the partition file data and is WRONG
+ALTER TABLE t1
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT CASE WHEN id < 11 THEN 1 WHEN id < 70 THEN 2 ELSE 3 END AS pn, COUNT(*) FROM t1 GROUP BY pn;
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM dr1;
+--echo #
+--echo # This is the correct way to change partitioning:
+--echo # Save table values, erase the table, then re-insert saved values in modified table
+--echo #
+CREATE TABLE t2 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX;
+INSERT INTO t2 SELECT id, msg FROM t1;
+DELETE FROM t1;
+INSERT INTO t1(id,msg) SELECT * FROM t2;
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+SELECT * FROM dr1;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # Testing partitioning on a populated outward table
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL,
+ msg VARCHAR(32)
+) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='part%s.txt'
+PARTITION by range columns(id) (
+PARTITION `1` VALUES LESS THAN(11),
+PARTITION `2` VALUES LESS THAN(70),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1 WHERE id < 11;
+SELECT * FROM t1 WHERE id >= 70;
+SELECT * FROM dr1;
+
+--echo #
+--echo # Testing indexing on a partitioned table
+--echo #
+CREATE INDEX XID ON t1(id);
+SHOW INDEX FROM t1;
+SELECT * FROM dr1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+DROP INDEX XID ON t1;
+SHOW INDEX FROM t1;
+SELECT * FROM dr1;
+ALTER TABLE t1 ADD PRIMARY KEY (id);
+SHOW INDEX FROM t1;
+SELECT * FROM dr1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10;
+ALTER TABLE t1 DROP PRIMARY KEY;
+SHOW INDEX FROM t1;
+SELECT * FROM dr1;
+DROP TABLE t1;
+DROP TABLE dr1;
+
+#
+# Clean up
+#
+--remove_file $MYSQLD_DATADIR/test/part1.txt
+--remove_file $MYSQLD_DATADIR/test/part2.txt
+--remove_file $MYSQLD_DATADIR/test/part3.txt
+#--remove_file $MYSQLD_DATADIR/test/part%s.fnx
+#--remove_file $MYSQLD_DATADIR/test/part1.fnx
+#--remove_file $MYSQLD_DATADIR/test/part2.fnx
+#--remove_file $MYSQLD_DATADIR/test/part3.fnx
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
new file mode 100644
index 00000000000..d6cb1e80fce
--- /dev/null
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -0,0 +1,85 @@
+--source include/have_partition.inc
+
+#
+# These will be used by the t1 table partition table
+#
+CREATE TABLE xt1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=MyISAM;
+INSERT INTO xt1 VALUES(4, 'four'),(7,'seven'),(1,'one'),(8,'eight');
+SELECT * FROM xt1;
+
+CREATE TABLE xt2 (
+id INT KEY NOT NULL,
+msg VARCHAR(32));
+INSERT INTO xt2 VALUES(10,'ten'),(40,'forty'),(11,'eleven'),(35,'thirty five');
+SELECT * FROM xt2;
+
+CREATE TABLE xt3 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=CSV;
+INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
+SELECT * FROM xt3;
+
+#
+# Based on PROXY the table is not indexable
+#
+CREATE TABLE t1 (
+id INT NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=PROXY TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+DELETE FROM t1;
+--error ER_UNKNOWN_ERROR
+ALTER TABLE t1 ADD INDEX XID(id);
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(40,'forty'),(60,'sixty'),(81,'eighty one');
+INSERT INTO t1 VALUES(72,'seventy two'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS
+SELECT * FROM t1 WHERE id = 81;
+DELETE FROM t1;
+DROP TABLE t1;
+
+#
+# Based on MYSQL the table is indexable
+#
+CREATE TABLE t1 (
+id INT KEY NOT NULL,
+msg VARCHAR(32))
+ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='xt%s'
+PARTITION BY RANGE COLUMNS(id) (
+PARTITION `1` VALUES LESS THAN(10),
+PARTITION `2` VALUES LESS THAN(50),
+PARTITION `3` VALUES LESS THAN(MAXVALUE));
+SHOW INDEX FROM t1;
+INSERT INTO t1 VALUES(4, 'four');
+INSERT INTO t1 VALUES(40, 'forty');
+INSERT INTO t1 VALUES(72,'seventy two');
+INSERT INTO t1 VALUES(7,'seven'),(10,'ten'),(60,'sixty'),(81,'eighty one'),(11,'eleven'),(1,'one'),(35,'thirty five'),(8,'eight');
+SELECT partition_name, table_rows FROM information_schema.partitions WHERE table_name = 't1';
+SELECT * FROM t1;
+EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 81;
+SELECT * FROM t1 WHERE id = 7;
+SELECT * FROM t1 WHERE id = 35;
+--error ER_GET_ERRMSG
+UPDATE t1 SET msg = 'number' WHERE id in (60,72);
+UPDATE t1 SET msg = 'soixante' WHERE id = 60;
+SELECT * FROM t1 WHERE id > 50;
+UPDATE t1 SET msg = 'big' WHERE id > 50;
+UPDATE t1 SET msg = 'sept' WHERE id = 7;
+SELECT * FROM t1;
+--error ER_GET_ERRMSG
+DELETE FROM t1 WHERE id in (60,72);
+DROP TABLE t1;
+DROP TABLE xt1;
+DROP TABLE xt2;
+DROP TABLE xt3;