fix user variable not do eval

This commit is contained in:
jh0
2022-04-01 16:52:17 +08:00
committed by LINxiansheng
parent 6cdf0345c6
commit b9fc792163
5 changed files with 34 additions and 13 deletions

View File

@ -56,6 +56,7 @@ enum ObExprInfoFlag {
IS_VOLATILE_CONST, // the const expr may be altered by overwrite, non-const in execution.
IS_ORA_ROWSCN_EXPR,
IS_VAR_EXPR,
IS_ASSIGN_EXPR,
IS_CONST_EXPR, // expression contains calculable expression
CNT_CONST_EXPR, // IS_CONST_EXPR and CNT_CONST_EXPR at most one is true
@ -98,6 +99,7 @@ enum ObExprInfoFlag {
CNT_VOLATILE_CONST,
CNT_ORA_ROWSCN_EXPR,
CNT_VAR_EXPR,
CNT_ASSIGN_EXPR,
BE_USED, // expression has been applied
IS_SIMPLE_COND, // column = const
@ -117,11 +119,11 @@ enum ObExprInfoFlag {
};
#define IS_INFO_MASK_BEGIN IS_CONST
#define IS_INFO_MASK_END IS_VAR_EXPR
#define IS_INFO_MASK_END IS_ASSIGN_EXPR
#define CNT_INFO_MASK_BEGIN CNT_CONST
#define CNT_INFO_MASK_END CNT_VAR_EXPR
#define CNT_INFO_MASK_END CNT_ASSIGN_EXPR
#define INHERIT_MASK_BEGIN CNT_CONST_EXPR
#define INHERIT_MASK_END CNT_VAR_EXPR
#define INHERIT_MASK_END CNT_ASSIGN_EXPR
inline const char* get_expr_info_flag_str(const ObExprInfoFlag flag)
{

View File

@ -161,7 +161,8 @@ int ObRawExprInfoExtractor::add_const(ObRawExpr& expr)
T_FUN_SYS_ROWKEY_TO_ROWID == expr.get_expr_type() || T_OP_CONNECT_BY_ROOT == expr.get_expr_type() ||
T_FUN_SYS_CONNECT_BY_PATH == expr.get_expr_type() || T_FUN_SYS_GUID == expr.get_expr_type() ||
T_FUN_SYS_STMT_ID == expr.get_expr_type() || T_FUN_SYS_SLEEP == expr.get_expr_type() ||
T_OP_PRIOR == expr.get_expr_type() || T_OP_GET_USER_VAR == expr.get_expr_type())) {
T_OP_ASSIGN == expr.get_expr_type() || T_OP_PRIOR == expr.get_expr_type() ||
T_OP_GET_USER_VAR == expr.get_expr_type())) {
is_const_expr = false;
}
if (is_const_expr) {
@ -233,7 +234,7 @@ bool ObRawExprInfoExtractor::not_calculable_expr(const ObRawExpr& expr)
expr.has_flag(CNT_ALIAS) || expr.has_flag(CNT_ENUM_OR_SET) || expr.has_flag(CNT_VALUES) ||
expr.has_flag(CNT_SEQ_EXPR) || expr.has_flag(CNT_SYS_CONNECT_BY_PATH) || expr.has_flag(CNT_RAND_FUNC) ||
expr.has_flag(CNT_SO_UDF) || expr.has_flag(CNT_PRIOR) || expr.has_flag(CNT_EXEC_PARAM) ||
expr.has_flag(CNT_VOLATILE_CONST) || expr.has_flag(CNT_VAR_EXPR);
expr.has_flag(CNT_VOLATILE_CONST) || expr.has_flag(CNT_VAR_EXPR) || expr.has_flag(CNT_ASSIGN_EXPR);
}
int ObRawExprInfoExtractor::visit(ObOpRawExpr& expr)
@ -314,6 +315,10 @@ int ObRawExprInfoExtractor::visit(ObOpRawExpr& expr)
if (OB_FAIL(expr.add_flag(IS_OR))) {
LOG_WARN("failed to add flag IS_OR", K(ret));
}
} else if (expr.get_expr_type() == T_OP_ASSIGN) {
if (OB_FAIL(expr.add_flag(IS_ASSIGN_EXPR))) {
LOG_WARN("failed to add flag IS_ASSIGN_EXPR", K(ret));
}
}
} else if (3 == expr.get_param_count()) {
// triple operator