fix mysqltest in master

This commit is contained in:
jingtaoye35 2024-10-09 07:45:48 +00:00 committed by ob-robot
parent 8c275c1897
commit abe7980b2a
3 changed files with 36 additions and 3 deletions

View File

@ -3919,6 +3919,26 @@ int ObDMLStmt::check_if_table_exists(uint64_t table_id, bool &is_existed) const
return ret;
}
int ObDMLStmt::has_special_expr(const ObExprInfoFlag flag, bool &has) const
{
int ret = OB_SUCCESS;
ObSEArray<ObRawExpr*, 16> exprs;
has = false;
if (OB_FAIL(get_relation_exprs(exprs))) {
LOG_WARN("failed to get relation exprs", K(ret));
} else {
for (int64_t i = 0; OB_SUCC(ret) && !has && i < exprs.count(); i++) {
if (OB_ISNULL(exprs.at(i))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected null", K(ret));
} else if (exprs.at(i)->has_flag(flag)) {
has = true;
}
}
}
return ret;
}
int ObDMLStmt::rebuild_tables_hash()
{
int ret = OB_SUCCESS;

View File

@ -1161,6 +1161,7 @@ public:
int get_rownum_expr(ObRawExpr *&expr) const;
int has_rownum(bool &has_rownum) const;
bool has_ora_rowscn() const;
int has_special_expr(const ObExprInfoFlag flag, bool &has) const;
int get_sequence_expr(ObRawExpr *&expr,
const common::ObString seq_name, // sequence object name
const common::ObString seq_action, // NEXTVAL or CURRVAL

View File

@ -127,13 +127,25 @@ int ObMVChecker::check_mv_stmt_refresh_type_basic(const ObSelectStmt &stmt, bool
if (OB_SUCC(ret)) {
bool has_rownum = false;
bool is_deterministic_query = true;
if (OB_FAIL(stmt.has_rownum(has_rownum))) {
bool has_cur_time = false;
if (OB_ISNULL(stmt.get_query_ctx())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("git unexpected null ptr", K(ret));
} else if (OB_FAIL(stmt.has_rownum(has_rownum))) {
LOG_WARN("failed to check has rownum", K(ret));
} else if (has_rownum || stmt.has_ora_rowscn()) {
is_valid = false;
append_fast_refreshable_note("rownum/ora_rowscn not support");
} else if (OB_FAIL(stmt.is_query_deterministic(is_deterministic_query))) {
LOG_WARN("failed to check mv stmt use special expr", K(ret));
} else if (!is_deterministic_query || has_rownum || stmt.has_ora_rowscn()) {
} else if (!is_deterministic_query) {
is_valid = false;
append_fast_refreshable_note("rownum/ora_rowscn/rand_func not support");
append_fast_refreshable_note("no deterministic query not support");
} else if (OB_FAIL(stmt.has_special_expr(CNT_CUR_TIME, has_cur_time))) {
LOG_WARN("failed to check stmt has special expr", K(ret));
} else if (has_cur_time) {
is_valid = false;
append_fast_refreshable_note("cur_time not support");
}
}