3139 Martin Skold 2010-11-11 [merge]
Merge
modified:
mysql-test/suite/ndb/r/ndb_condition_pushdown.result
mysql-test/suite/ndb/t/ndb_condition_pushdown.test
sql/ha_ndbcluster_cond.cc
sql/ha_ndbcluster_cond.h
3138 Martin Skold 2010-11-09 [merge]
Merge
modified:
mysql-test/suite/ndb/r/ndb_condition_pushdown.result
mysql-test/suite/ndb/t/ndb_condition_pushdown.test
sql/ha_ndbcluster_cond.cc
=== modified file 'mysql-test/suite/ndb/r/ndb_condition_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2010-11-09 13:51:48 +0000
+++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result 2010-11-11 07:58:10 +0000
@@ -2050,5 +2050,28 @@ pk x
4 4
5 5
drop table t;
+set engine_condition_pushdown = on;
+create table t (x enum ('yes','yep','no')) engine = ndb;
+insert into t values ('yes'),('yep'),('no');
+explain select * from t where x like 'yes' order by x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t ALL NULL NULL NULL NULL # Using where; Using filesort
+select * from t where x like 'yes' order by x;
+x
+yes
+explain select * from t where x like 'ye%' order by x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t ALL NULL NULL NULL NULL # Using where; Using filesort
+select * from t where x like 'ye%' order by x;
+x
+yes
+yep
+explain select * from t where x not like 'ye%' order by x;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t ALL NULL NULL NULL NULL # Using where; Using filesort
+select * from t where x not like 'ye%' order by x;
+x
+no
+drop table t;
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
=== modified file 'mysql-test/suite/ndb/t/ndb_condition_pushdown.test'
--- a/mysql-test/suite/ndb/t/ndb_condition_pushdown.test 2010-11-09 13:51:48 +0000
+++ b/mysql-test/suite/ndb/t/ndb_condition_pushdown.test 2010-11-11 07:58:10 +0000
@@ -2139,5 +2139,20 @@ explain select * from t where 3 between
select * from t where 3 between -1 and x order by pk;
drop table t;
+# Bug#53360 No result for requests using LIKE condition on ENUM fields
+set engine_condition_pushdown = on;
+create table t (x enum ('yes','yep','no')) engine = ndb;
+insert into t values ('yes'),('yep'),('no');
+--replace_column 9 #
+explain select * from t where x like 'yes' order by x;
+select * from t where x like 'yes' order by x;
+--replace_column 9 #
+explain select * from t where x like 'ye%' order by x;
+select * from t where x like 'ye%' order by x;
+--replace_column 9 #
+explain select * from t where x not like 'ye%' order by x;
+select * from t where x not like 'ye%' order by x;
+drop table t;
+
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4,t5;
=== modified file 'sql/ha_ndbcluster_cond.cc'
--- a/sql/ha_ndbcluster_cond.cc 2010-11-09 13:51:48 +0000
+++ b/sql/ha_ndbcluster_cond.cc 2010-11-11 07:58:10 +0000
@@ -258,7 +258,7 @@ void ndb_serialize_cond(const Item *item
{
Item_field *field_item= (Item_field *) item;
Field *field= field_item->field;
- enum_field_types type= field->type();
+ enum_field_types type= field->real_type();
/*
Check that the field is part of the table of the handler
instance and that we expect a field with of this result type.
@@ -270,18 +270,19 @@ void ndb_serialize_cond(const Item *item
DBUG_PRINT("info", ("table %s", tab->getName()));
DBUG_PRINT("info", ("column %s", field->field_name));
DBUG_PRINT("info", ("column length %u", field->field_length));
- DBUG_PRINT("info", ("type %d", field->type()));
+ DBUG_PRINT("info", ("type %d", field->real_type()));
DBUG_PRINT("info", ("result type %d", field->result_type()));
// Check that we are expecting a field and with the correct
// result type and of length that can store the item value
if (context->expecting(Item::FIELD_ITEM) &&
- context->expecting_field_type(field->type()) &&
+ context->expecting_field_type(field->real_type()) &&
context->expecting_max_length(field->field_length) &&
(context->expecting_field_result(field->result_type()) ||
// Date and year can be written as string or int
((type == MYSQL_TYPE_TIME ||
type == MYSQL_TYPE_DATE ||
+ type == MYSQL_TYPE_NEWDATE ||
type == MYSQL_TYPE_YEAR ||
type == MYSQL_TYPE_DATETIME)
? (context->expecting_field_result(STRING_RESULT) ||
@@ -305,6 +306,7 @@ void ndb_serialize_cond(const Item *item
// We have not seen second argument yet
if (type == MYSQL_TYPE_TIME ||
type == MYSQL_TYPE_DATE ||
+ type == MYSQL_TYPE_NEWDATE ||
type == MYSQL_TYPE_YEAR ||
type == MYSQL_TYPE_DATETIME)
{
@@ -348,6 +350,7 @@ void ndb_serialize_cond(const Item *item
!context->expecting_collation(item->collation.collation)
&& type != MYSQL_TYPE_TIME
&& type != MYSQL_TYPE_DATE
+ && type != MYSQL_TYPE_NEWDATE
&& type != MYSQL_TYPE_YEAR
&& type != MYSQL_TYPE_DATETIME)
{
=== modified file 'sql/ha_ndbcluster_cond.h'
--- a/sql/ha_ndbcluster_cond.h 2009-12-15 13:28:55 +0000
+++ b/sql/ha_ndbcluster_cond.h 2010-11-11 07:58:10 +0000
@@ -143,7 +143,7 @@ public:
Ndb_item(Field *field, int column_no) : type(NDB_FIELD)
{
NDB_ITEM_FIELD_VALUE *field_value= new NDB_ITEM_FIELD_VALUE();
- qualification.field_type= field->type();
+ qualification.field_type= field->real_type();
field_value->field= field;
field_value->column_no= column_no;
value.field_value= field_value;
| Thread |
|---|
| • bzr push into mysql-5.1-telco-6.2 branch (Martin.Skold:3138 to 3139)Bug#53360 | Martin Skold | 11 Nov |