Commit fed7ddde authored by Sergei Golubchik's avatar Sergei Golubchik

portability fix for vcol.vcol_partition_myisam test

parent ce73ebb4
...@@ -36,27 +36,14 @@ insert into t1 values ('2007-01-01',default); ...@@ -36,27 +36,14 @@ insert into t1 values ('2007-01-01',default);
insert into t1 values ('2005-01-01',default); insert into t1 values ('2005-01-01',default);
select * from t1; select * from t1;
# Specifically for MyISAM, check that data is written into correct select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
# $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD files
let $myisam_engine = `select @@session.storage_engine='myisam'`;
if ($myisam_engine)
{
--echo # Check how data is physically partitioned.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
}
--echo # Modify the expression of virtual column b --echo # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
if ($myisam_engine) select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
{
--echo # Check how data is physically partitioned.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
}
drop table t1; drop table t1;
...@@ -67,12 +54,7 @@ PARTITION BY LIST (a+1) ...@@ -67,12 +54,7 @@ PARTITION BY LIST (a+1)
(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2));
insert into t1 values (1,default); insert into t1 values (1,default);
if ($myisam_engine) select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
{
--echo # Check how data is physically partitioned.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
}
select * from t1; select * from t1;
# #
...@@ -115,12 +97,7 @@ select * from t1; ...@@ -115,12 +97,7 @@ select * from t1;
#alter table t1 change b b int as ((a % 3)+1) persistent; #alter table t1 change b b int as ((a % 3)+1) persistent;
#--error ER_NO_PARTITION_FOR_GIVEN_VALUE #--error ER_NO_PARTITION_FOR_GIVEN_VALUE
#alter table t1 change b b int as (a % 2) persistent; #alter table t1 change b b int as (a % 2) persistent;
#if ($myisam_engine) #select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
#{
# --echo # Check how data is physically partitioned.
# --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
# --exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
#}
select * from t1; select * from t1;
...@@ -138,23 +115,13 @@ insert into t1 values ('2005-01-01',default); ...@@ -138,23 +115,13 @@ insert into t1 values ('2005-01-01',default);
insert into t1 values ('2006-01-01',default); insert into t1 values ('2006-01-01',default);
select * from t1; select * from t1;
if ($myisam_engine) select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
{
--echo # Check how data is physically partitioned.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
}
--echo # Modify the expression of virtual column b --echo # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
if ($myisam_engine) select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
{
--echo # Check how data is physically partitioned.
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec du -b $MYSQLTEST_VARDIR/mysqld.1/data/test/t1*p?.MYD
}
drop table t1; drop table t1;
...@@ -17,6 +17,10 @@ a b ...@@ -17,6 +17,10 @@ a b
2005-01-01 2005 2005-01-01 2005
2006-01-01 2006 2006-01-01 2006
2007-01-01 2007 2007-01-01 2007
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 1 16384
p2 2 16384
# Modify the expression of virtual column b # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
...@@ -24,12 +28,20 @@ a b ...@@ -24,12 +28,20 @@ a b
2005-01-01 2004 2005-01-01 2004
2006-01-01 2005 2006-01-01 2005
2007-01-01 2006 2007-01-01 2006
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 2 16384
p2 1 16384
drop table t1; drop table t1;
# Case 2. Partitioning by LIST based on a stored virtual column. # Case 2. Partitioning by LIST based on a stored virtual column.
CREATE TABLE t1 (a int, b int as (a % 3 ) persistent) CREATE TABLE t1 (a int, b int as (a % 3 ) persistent)
PARTITION BY LIST (a+1) PARTITION BY LIST (a+1)
(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2));
insert into t1 values (1,default); insert into t1 values (1,default);
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p1 0 16384
p2 1 16384
select * from t1; select * from t1;
a b a b
1 1 1 1
...@@ -49,10 +61,20 @@ select * from t1; ...@@ -49,10 +61,20 @@ select * from t1;
a b a b
2005-01-01 2005 2005-01-01 2005
2006-01-01 2006 2006-01-01 2006
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 0 16384
p1 1 16384
p2 1 16384
# Modify the expression of virtual column b # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
a b a b
2005-01-01 2004 2005-01-01 2004
2006-01-01 2005 2006-01-01 2005
select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
partition_name table_rows data_length
p0 1 16384
p1 1 16384
p2 0 16384
drop table t1; drop table t1;
...@@ -17,9 +17,10 @@ a b ...@@ -17,9 +17,10 @@ a b
2005-01-01 2005 2005-01-01 2005
2006-01-01 2006 2006-01-01 2006
2007-01-01 2007 2007-01-01 2007
# Check how data is physically partitioned. select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p0.MYD partition_name table_rows data_length
14 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p2.MYD p0 1 7
p2 2 14
# Modify the expression of virtual column b # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
...@@ -27,18 +28,20 @@ a b ...@@ -27,18 +28,20 @@ a b
2005-01-01 2004 2005-01-01 2004
2006-01-01 2005 2006-01-01 2005
2007-01-01 2006 2007-01-01 2006
# Check how data is physically partitioned. select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
14 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p0.MYD partition_name table_rows data_length
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p2.MYD p0 2 14
p2 1 7
drop table t1; drop table t1;
# Case 2. Partitioning by LIST based on a stored virtual column. # Case 2. Partitioning by LIST based on a stored virtual column.
CREATE TABLE t1 (a int, b int as (a % 3 ) persistent) CREATE TABLE t1 (a int, b int as (a % 3 ) persistent)
PARTITION BY LIST (a+1) PARTITION BY LIST (a+1)
(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); (PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2));
insert into t1 values (1,default); insert into t1 values (1,default);
# Check how data is physically partitioned. select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
0 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p1.MYD partition_name table_rows data_length
9 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p2.MYD p1 0 0
p2 1 9
select * from t1; select * from t1;
a b a b
1 1 1 1
...@@ -58,18 +61,20 @@ select * from t1; ...@@ -58,18 +61,20 @@ select * from t1;
a b a b
2005-01-01 2005 2005-01-01 2005
2006-01-01 2006 2006-01-01 2006
# Check how data is physically partitioned. select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
0 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p0.MYD partition_name table_rows data_length
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p1.MYD p0 0 0
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p2.MYD p1 1 7
p2 1 7
# Modify the expression of virtual column b # Modify the expression of virtual column b
ALTER TABLE t1 modify b int as (year(a)-1); ALTER TABLE t1 modify b int as (year(a)-1);
select * from t1; select * from t1;
a b a b
2005-01-01 2004 2005-01-01 2004
2006-01-01 2005 2006-01-01 2005
# Check how data is physically partitioned. select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1';
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p0.MYD partition_name table_rows data_length
7 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p1.MYD p0 1 7
0 MYSQLTEST_VARDIR/mysqld.1/data/test/t1#P#p2.MYD p1 1 7
p2 0 0
drop table t1; drop table t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment