MDEV-32986 Make regexp operator work in spider group by handler
In spider_db_mbase_util::print_item_func(), if the sql item_func has an UNKNOWN_FUNC type, by default the spider group by handler (gbh) transform infix to prefix. But regexp should remain infix, so we add an if condition to account for this.
This commit is contained in:
parent
96e49c76a8
commit
c73417c68e
23
storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result
Normal file
23
storage/spider/mysql-test/spider/bugfix/r/mdev_32986.result
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# MDEV-32907
|
||||
#
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
create table t2 (c varchar(16));
|
||||
create table t1 (c varchar(16)) ENGINE=Spider
|
||||
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
|
||||
insert into t1 values ('TestSpiderRegex');
|
||||
select c from t1 where c regexp '(Test|Spider|Regex)';
|
||||
c
|
||||
TestSpiderRegex
|
||||
drop table t1, t2;
|
||||
drop server srv;
|
||||
for master_1
|
||||
for child2
|
||||
for child3
|
||||
#
|
||||
# end of test mdev_32907
|
||||
#
|
28
storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test
Normal file
28
storage/spider/mysql-test/spider/bugfix/t/mdev_32986.test
Normal file
@ -0,0 +1,28 @@
|
||||
--echo #
|
||||
--echo # MDEV-32907
|
||||
--echo #
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
|
||||
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
|
||||
|
||||
create table t2 (c varchar(16));
|
||||
create table t1 (c varchar(16)) ENGINE=Spider
|
||||
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
|
||||
|
||||
insert into t1 values ('TestSpiderRegex');
|
||||
select c from t1 where c regexp '(Test|Spider|Regex)';
|
||||
drop table t1, t2;
|
||||
drop server srv;
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
--echo #
|
||||
--echo # end of test mdev_32907
|
||||
--echo #
|
@ -5856,12 +5856,17 @@ int spider_db_mbase_util::print_item_func(
|
||||
item_count -= 2;
|
||||
break;
|
||||
}
|
||||
} else if (func_name_length == 6 &&
|
||||
!strncasecmp("istrue", func_name, func_name_length)
|
||||
) {
|
||||
last_str = SPIDER_SQL_IS_TRUE_STR;
|
||||
last_str_length = SPIDER_SQL_IS_TRUE_LEN;
|
||||
break;
|
||||
} else if (func_name_length == 6)
|
||||
{
|
||||
if (!strncasecmp("istrue", func_name, func_name_length))
|
||||
{
|
||||
last_str= SPIDER_SQL_IS_TRUE_STR;
|
||||
last_str_length= SPIDER_SQL_IS_TRUE_LEN;
|
||||
break;
|
||||
}
|
||||
else if (!strncasecmp("regexp", func_name, func_name_length))
|
||||
/* Keep the infix expression */
|
||||
break;
|
||||
} else if (func_name_length == 7)
|
||||
{
|
||||
if (!strncasecmp("isfalse", func_name, func_name_length))
|
||||
|
Loading…
x
Reference in New Issue
Block a user