check type of raw expr before static_cast
This commit is contained in:
@ -167,6 +167,7 @@ int ObExprIsBase::cg_expr_internal(ObExprCGCtx &op_cg_ctx, const ObRawExpr &raw_
|
||||
UNUSED(op_cg_ctx);
|
||||
int ret = OB_SUCCESS;
|
||||
const ObOpRawExpr *op_raw_expr = static_cast<const ObOpRawExpr*>(&raw_expr);
|
||||
const ObRawExpr *child = NULL;
|
||||
if (rt_expr.arg_cnt_ != 2) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("isnot expr should have 2 params", K(ret), K(rt_expr.arg_cnt_));
|
||||
@ -174,9 +175,12 @@ int ObExprIsBase::cg_expr_internal(ObExprCGCtx &op_cg_ctx, const ObRawExpr &raw_
|
||||
|| OB_ISNULL(rt_expr.args_[1])) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("children of isnot expr is null", K(ret), K(rt_expr.args_));
|
||||
} else if (OB_ISNULL(child = op_raw_expr->get_param_expr(1))
|
||||
|| OB_UNLIKELY(!child->is_const_raw_expr())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("child is null", K(ret), KPC(child));
|
||||
} else {
|
||||
const ObRawExpr *param2 = op_raw_expr->get_param_expr(1);
|
||||
const_param2 = static_cast<const ObConstRawExpr *>(param2);
|
||||
const_param2 = static_cast<const ObConstRawExpr *>(child);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -550,3 +550,20 @@ select c26, c26 is not true, c26 is not false, c26 is not null, c26 is not unkno
|
||||
drop table t1;
|
||||
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
`c2` varbinary(25) NOT NULL,
|
||||
`c3` bigint(4) DEFAULT NULL,
|
||||
`c4` varbinary(15) NOT NULL,
|
||||
`c5` int(11) NOT NULL,
|
||||
`c6` decimal(10,8) NOT NULL DEFAULT '3.14159200',
|
||||
PRIMARY KEY (`c4`),
|
||||
UNIQUE KEY `c5` (`c5`) BLOCK_SIZE 16384 LOCAL
|
||||
);
|
||||
|
||||
SELECT null AS a FROM t1 GROUP BY a with ROLLUP HAVING a IS not NULL;
|
||||
+------+
|
||||
| a |
|
||||
+------+
|
||||
+------+
|
||||
drop table t1;
|
||||
|
@ -1,10 +1,7 @@
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
--result_format 4
|
||||
connect (conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT);
|
||||
connection conn_admin;
|
||||
--sleep 2
|
||||
connection default;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
@ -81,9 +78,6 @@ insert into t1 values(11, 11,
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'11', '11.0');
|
||||
|
||||
connection conn_admin;
|
||||
--sleep 2
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
|
||||
|
||||
@ -100,5 +94,16 @@ drop table t1;
|
||||
|
||||
|
||||
|
||||
connection conn_admin;
|
||||
--sleep 2
|
||||
CREATE TABLE `t1` (
|
||||
`c1` int(11) DEFAULT NULL,
|
||||
`c2` varbinary(25) NOT NULL,
|
||||
`c3` bigint(4) DEFAULT NULL,
|
||||
`c4` varbinary(15) NOT NULL,
|
||||
`c5` int(11) NOT NULL,
|
||||
`c6` decimal(10,8) NOT NULL DEFAULT '3.14159200',
|
||||
PRIMARY KEY (`c4`),
|
||||
UNIQUE KEY `c5` (`c5`) BLOCK_SIZE 16384 LOCAL
|
||||
);
|
||||
|
||||
SELECT null AS a FROM t1 GROUP BY a with ROLLUP HAVING a IS not NULL;
|
||||
drop table t1;
|
Reference in New Issue
Block a user