Loading mysql-test/r/partition_innodb.result +15 −0 Original line number Diff line number Diff line Loading @@ -92,3 +92,18 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t0_aux; DROP TABLE IF EXISTS t0_definition; DROP TABLE IF EXISTS t0_template; create table t1 (id varchar(64) primary key) engine=innodb partition by key(id) partitions 5; insert into t1 values ('a'); insert into t1 values ('aa'); insert into t1 values ('aaa'); select * from t1 where id = 'a'; id a select * from t1 where id = 'aa'; id aa select * from t1 where id = 'aaa'; id aaa drop table t1; mysql-test/r/partition_pruning.result +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t2 where a=1 and b=1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where 1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where create table t3 ( a int ) Loading mysql-test/t/partition_innodb.test +12 −0 Original line number Diff line number Diff line Loading @@ -66,3 +66,15 @@ DROP TABLE IF EXISTS t0_definition; DROP TABLE IF EXISTS t0_template; --enable_warnings # # Bug#20086: Can't get data from key partitioned tables with VARCHAR key # create table t1 (id varchar(64) primary key) engine=innodb partition by key(id) partitions 5; insert into t1 values ('a'); insert into t1 values ('aa'); insert into t1 values ('aaa'); select * from t1 where id = 'a'; select * from t1 where id = 'aa'; select * from t1 where id = 'aaa'; drop table t1; sql/field.cc +30 −0 Original line number Diff line number Diff line Loading @@ -1243,6 +1243,21 @@ uint Field::offset() } void Field::hash(ulong *nr, ulong *nr2) { if (is_null()) { *nr^= (*nr << 1) | 1; } else { uint len= pack_length(); CHARSET_INFO *cs= charset(); cs->coll->hash_sort(cs, (uchar*) ptr, len, nr, nr2); } } void Field::copy_from_tmp(int row_offset) { memcpy(ptr,ptr+row_offset,pack_length()); Loading Loading @@ -6925,6 +6940,21 @@ uint Field_varstring::is_equal(create_field *new_field) } void Field_varstring::hash(ulong *nr, ulong *nr2) { if (is_null()) { *nr^= (*nr << 1) | 1; } else { uint len= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); CHARSET_INFO *cs= charset(); cs->coll->hash_sort(cs, (uchar*) ptr + length_bytes, len, nr, nr2); } } /**************************************************************************** ** blob type ** A blob is saved as a length and a pointer. The length is stored in the Loading sql/field.h +3 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,8 @@ class Field return field_length / charset()->mbmaxlen; } /* Hash value */ virtual void hash(ulong *nr, ulong *nr2); friend bool reopen_table(THD *,struct st_table *,bool); friend int cre_myisam(my_string name, register TABLE *form, uint options, ulonglong auto_increment_value); Loading Loading @@ -1120,6 +1122,7 @@ class Field_varstring :public Field_longstr { char *new_ptr, uchar *new_null_ptr, uint new_null_bit); uint is_equal(create_field *new_field); void hash(ulong *nr, ulong *nr2); }; Loading Loading
mysql-test/r/partition_innodb.result +15 −0 Original line number Diff line number Diff line Loading @@ -92,3 +92,18 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t0_aux; DROP TABLE IF EXISTS t0_definition; DROP TABLE IF EXISTS t0_template; create table t1 (id varchar(64) primary key) engine=innodb partition by key(id) partitions 5; insert into t1 values ('a'); insert into t1 values ('aa'); insert into t1 values ('aaa'); select * from t1 where id = 'a'; id a select * from t1 where id = 'aa'; id aa select * from t1 where id = 'aaa'; id aaa drop table t1;
mysql-test/r/partition_pruning.result +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0,p1 ALL NULL NULL NULL NULL 3 Using where explain partitions select * from t2 where a=1 and b=1; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 3 Using where 1 SIMPLE t2 p0 ALL NULL NULL NULL NULL 2 Using where create table t3 ( a int ) Loading
mysql-test/t/partition_innodb.test +12 −0 Original line number Diff line number Diff line Loading @@ -66,3 +66,15 @@ DROP TABLE IF EXISTS t0_definition; DROP TABLE IF EXISTS t0_template; --enable_warnings # # Bug#20086: Can't get data from key partitioned tables with VARCHAR key # create table t1 (id varchar(64) primary key) engine=innodb partition by key(id) partitions 5; insert into t1 values ('a'); insert into t1 values ('aa'); insert into t1 values ('aaa'); select * from t1 where id = 'a'; select * from t1 where id = 'aa'; select * from t1 where id = 'aaa'; drop table t1;
sql/field.cc +30 −0 Original line number Diff line number Diff line Loading @@ -1243,6 +1243,21 @@ uint Field::offset() } void Field::hash(ulong *nr, ulong *nr2) { if (is_null()) { *nr^= (*nr << 1) | 1; } else { uint len= pack_length(); CHARSET_INFO *cs= charset(); cs->coll->hash_sort(cs, (uchar*) ptr, len, nr, nr2); } } void Field::copy_from_tmp(int row_offset) { memcpy(ptr,ptr+row_offset,pack_length()); Loading Loading @@ -6925,6 +6940,21 @@ uint Field_varstring::is_equal(create_field *new_field) } void Field_varstring::hash(ulong *nr, ulong *nr2) { if (is_null()) { *nr^= (*nr << 1) | 1; } else { uint len= length_bytes == 1 ? (uint) (uchar) *ptr : uint2korr(ptr); CHARSET_INFO *cs= charset(); cs->coll->hash_sort(cs, (uchar*) ptr + length_bytes, len, nr, nr2); } } /**************************************************************************** ** blob type ** A blob is saved as a length and a pointer. The length is stored in the Loading
sql/field.h +3 −0 Original line number Diff line number Diff line Loading @@ -351,6 +351,8 @@ class Field return field_length / charset()->mbmaxlen; } /* Hash value */ virtual void hash(ulong *nr, ulong *nr2); friend bool reopen_table(THD *,struct st_table *,bool); friend int cre_myisam(my_string name, register TABLE *form, uint options, ulonglong auto_increment_value); Loading Loading @@ -1120,6 +1122,7 @@ class Field_varstring :public Field_longstr { char *new_ptr, uchar *new_null_ptr, uint new_null_bit); uint is_equal(create_field *new_field); void hash(ulong *nr, ulong *nr2); }; Loading