[CP] regexp use const pattern uncorrectly in non-static engine
This commit is contained in:
committed by
wangyunlai.wyl
parent
9e83856389
commit
a43efe3742
@ -597,9 +597,11 @@ inline int ObExprGeneratorImpl::visit_regex_expr(ObOpRawExpr& expr, ObExprRegexp
|
|||||||
} else {
|
} else {
|
||||||
// The value && pattern are const, it is calculated in pre_calculate
|
// The value && pattern are const, it is calculated in pre_calculate
|
||||||
regexp_op->set_value_is_const(value_expr->has_flag(IS_CONST) || value_expr->has_flag(IS_CONST_EXPR));
|
regexp_op->set_value_is_const(value_expr->has_flag(IS_CONST) || value_expr->has_flag(IS_CONST_EXPR));
|
||||||
|
if (!pattern_expr->has_flag(CNT_EXEC_PARAM)) {
|
||||||
regexp_op->set_pattern_is_const(pattern_expr->has_flag(IS_CONST) || pattern_expr->has_flag(IS_CONST_EXPR));
|
regexp_op->set_pattern_is_const(pattern_expr->has_flag(IS_CONST) || pattern_expr->has_flag(IS_CONST_EXPR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6287,3 +6287,18 @@ insert into t values ('');
|
|||||||
select c1 regexp 'ddd' from t;
|
select c1 regexp 'ddd' from t;
|
||||||
c1 regexp 'ddd'
|
c1 regexp 'ddd'
|
||||||
0
|
0
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
create table t1(c1 int, c2 varchar(10));
|
||||||
|
insert into t1 values(1, '1');
|
||||||
|
create table t2(c1 int);
|
||||||
|
insert into t2 values(1), (2);
|
||||||
|
select t2.*, (select t1.c1 from t1 where t1.c2 REGEXP t2.c1 limit 1 ) from t2;
|
||||||
|
c1 (select t1.c1 from t1 where t1.c2 REGEXP t2.c1 limit 1 )
|
||||||
|
1 1
|
||||||
|
2 NULL
|
||||||
|
select t2.*, (select t1.c1 from t1 where t1.c2 REGEXP t2.c1+1-1 limit 1 ) from t2;
|
||||||
|
c1 (select t1.c1 from t1 where t1.c2 REGEXP t2.c1+1-1 limit 1 )
|
||||||
|
1 1
|
||||||
|
2 NULL
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
||||||
|
|||||||
@ -442,3 +442,20 @@ drop table if exists t;
|
|||||||
create table t (c1 char(20));
|
create table t (c1 char(20));
|
||||||
insert into t values ('');
|
insert into t values ('');
|
||||||
select c1 regexp 'ddd' from t;
|
select c1 regexp 'ddd' from t;
|
||||||
|
|
||||||
|
##bug:https://work.aone.alibaba-inc.com/issue/43976234
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop table if exists t1, t2;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
create table t1(c1 int, c2 varchar(10));
|
||||||
|
insert into t1 values(1, '1');
|
||||||
|
create table t2(c1 int);
|
||||||
|
insert into t2 values(1), (2);
|
||||||
|
|
||||||
|
select t2.*, (select t1.c1 from t1 where t1.c2 REGEXP t2.c1 limit 1 ) from t2;
|
||||||
|
select t2.*, (select t1.c1 from t1 where t1.c2 REGEXP t2.c1+1-1 limit 1 ) from t2;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
drop table t2;
|
||||||
Reference in New Issue
Block a user