Hi Varun, The commit comment says:
MDEV-16695: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with optimizer_use_condition_selectivity>=3
While the comment in testcase shows the correct commit number:
+# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +# optimizer_use_condition_selectivity>=3 +#
Please fix and then push. On Fri, Aug 24, 2018 at 01:51:51PM +0530, Varun wrote:
revision-id: 3e7f949508210b5cc308468d5775b5e2c7063ded (mariadb-10.0.36-10-g3e7f9495082) parent(s): 0cafc1316410d118c0b6298daf4d923b3258c502 author: Varun Gupta committer: Varun Gupta timestamp: 2018-08-24 13:50:16 +0530 message:
MDEV-16695: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with optimizer_use_condition_selectivity>=3
Selectivity analysis should be disabled for Geometrical columns.
--- mysql-test/r/gis.result | 16 ++++++++++++++++ mysql-test/t/gis.test | 15 +++++++++++++++ sql/opt_range.cc | 9 ++++++++- 3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index f77cd4d14bf..40d3117de38 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -1659,5 +1659,21 @@ c2 DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; # +# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +# optimizer_use_condition_selectivity>=3 +# +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +COUNT(*) +0 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; +# # End 10.0 tests # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 4192a3284b7..e3b264b8194 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -1516,6 +1516,21 @@ SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FR DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch;
+--echo # +--echo # MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +--echo # optimizer_use_condition_selectivity>=3 +--echo # + +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1;
--echo # --echo # End 10.0 tests diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 734adfbc9d1..303f92f9bb6 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3326,13 +3326,17 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param,
for (field_ptr= table->field; *field_ptr; field_ptr++) { - if (bitmap_is_set(used_fields, (*field_ptr)->field_index)) + if (bitmap_is_set(used_fields, (*field_ptr)->field_index) && + !((*field_ptr)->type() == MYSQL_TYPE_GEOMETRY)) parts++; }
KEY_PART *key_part; uint keys= 0;
+ if (!parts) + return TRUE; + if (!(key_part= (KEY_PART *) alloc_root(param->mem_root, sizeof(KEY_PART) * parts))) return TRUE; @@ -3344,6 +3348,9 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param, if (bitmap_is_set(used_fields, (*field_ptr)->field_index)) { Field *field= *field_ptr; + if (field->type() == MYSQL_TYPE_GEOMETRY) + continue; + uint16 store_length; uint16 max_key_part_length= (uint16) table->file->max_key_part_length(); key_part->key= keys; _______________________________________________ commits mailing list commits@mariadb.org https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
-- BR Sergei -- Sergei Petrunia, Software Developer MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog