提交 a43efe37 编写于 作者: W wangt1xiuyi 提交者: wangyunlai.wyl

[CP] regexp use const pattern uncorrectly in non-static engine

上级 9e838563
......@@ -597,7 +597,9 @@ inline int ObExprGeneratorImpl::visit_regex_expr(ObOpRawExpr& expr, ObExprRegexp
} else {
// 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_pattern_is_const(pattern_expr->has_flag(IS_CONST) || pattern_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));
}
}
}
return ret;
......
......@@ -6287,3 +6287,18 @@ insert into t values ('');
select c1 regexp 'ddd' from t;
c1 regexp 'ddd'
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));
insert into t values ('');
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;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册