make regexp functions be valid for generated column in mysql
This commit is contained in:
@ -28,7 +28,7 @@ namespace sql
|
||||
{
|
||||
|
||||
ObExprRegexp::ObExprRegexp(ObIAllocator &alloc)
|
||||
: ObFuncExprOperator(alloc, T_OP_REGEXP, N_REGEXP, 2, NOT_VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION),
|
||||
: ObFuncExprOperator(alloc, T_OP_REGEXP, N_REGEXP, 2, VALID_FOR_GENERATED_COL, NOT_ROW_DIMENSION),
|
||||
regexp_idx_(OB_COMPACT_INVALID_INDEX),
|
||||
pattern_is_const_(false),
|
||||
value_is_const_(false)
|
||||
|
@ -318,5 +318,13 @@ int ObExprRegexpInstr::eval_regexp_instr(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprRegexpInstr::is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const {
|
||||
int ret = OB_SUCCESS;
|
||||
is_valid = lib::is_mysql_mode();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
virtual bool need_rt_ctx() const override { return true; }
|
||||
|
||||
static int eval_regexp_instr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
virtual int is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprRegexpInstr);
|
||||
};
|
||||
|
@ -237,5 +237,13 @@ int ObExprRegexpLike::eval_regexp_like(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprRegexpLike::is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const {
|
||||
int ret = OB_SUCCESS;
|
||||
is_valid = lib::is_mysql_mode();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
virtual bool need_rt_ctx() const override { return true; }
|
||||
|
||||
static int eval_regexp_like(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
virtual int is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprRegexpLike);
|
||||
};
|
||||
|
@ -419,5 +419,13 @@ int ObExprRegexpReplace::eval_regexp_replace(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprRegexpReplace::is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const {
|
||||
int ret = OB_SUCCESS;
|
||||
is_valid = lib::is_mysql_mode();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
virtual bool need_rt_ctx() const override { return true; }
|
||||
|
||||
static int eval_regexp_replace(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
virtual int is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprRegexpReplace);
|
||||
};
|
||||
|
@ -356,5 +356,13 @@ int ObExprRegexpSubstr::eval_regexp_substr(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprRegexpSubstr::is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const {
|
||||
int ret = OB_SUCCESS;
|
||||
is_valid = lib::is_mysql_mode();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -35,6 +35,9 @@ public:
|
||||
ObExpr &rt_expr) const override;
|
||||
|
||||
static int eval_regexp_substr(const ObExpr &expr, ObEvalCtx &ctx, ObDatum &expr_datum);
|
||||
virtual int is_valid_for_generated_column(const ObRawExpr*expr,
|
||||
const common::ObIArray<ObRawExpr *> &exprs,
|
||||
bool &is_valid) const override;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExprRegexpSubstr);
|
||||
};
|
||||
|
@ -845,11 +845,6 @@ int ObRawExpr::is_non_pure_sys_func_expr(bool &is_non_pure) const
|
||||
|| T_FUN_SYS_LAST_INSERT_ID == type_
|
||||
|| T_FUN_SYS_ROW_COUNT == type_
|
||||
|| T_FUN_SYS_FOUND_ROWS == type_
|
||||
|| T_FUN_SYS_REGEXP_INSTR == type_
|
||||
// TODO:@sean.yyj#273971, will sort out exprs not deterministic in mysql mode later,
|
||||
// || T_FUN_SYS_REGEXP_LIKE == type_ // create table t1(c1 int, c2 int generated always as(regexp_like(1, 2))); success in mysql
|
||||
|| T_FUN_SYS_REGEXP_REPLACE == type_
|
||||
|| T_FUN_SYS_REGEXP_SUBSTR == type_
|
||||
|| T_FUN_SYS_CURRENT_USER_PRIV == type_) {
|
||||
is_non_pure = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user