Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -163,8 +163,6 @@ int ObTransformTempTable::generate_with_clause(ObDMLStmt *&stmt, bool &trans_hap
|
||||
OPT_TRACE("stmt containt oversize set stmt");
|
||||
} else if (!enable_temp_table_transform || force_temp_table_inline) {
|
||||
OPT_TRACE("session variable disable temp table transform");
|
||||
} else if (stmt->has_for_update()) {
|
||||
OPT_TRACE("stmt has for update, can not extract CTE");
|
||||
} else if (OB_FAIL(parent_map.create(128, "TempTable"))) {
|
||||
LOG_WARN("failed to init stmt map", K(ret));
|
||||
} else if (OB_FAIL(ObTransformUtils::get_all_child_stmts(stmt, child_stmts, &parent_map))) {
|
||||
@ -210,23 +208,14 @@ int ObTransformTempTable::expand_temp_table(ObIArray<TempTableInfo> &temp_table_
|
||||
bool force_materia = false;
|
||||
bool force_inline = false;
|
||||
bool is_oversize_stmt = false;
|
||||
bool has_for_update = false;
|
||||
int64_t stmt_size = 0;
|
||||
bool need_expand = false;
|
||||
bool can_expand = true;
|
||||
OPT_TRACE("try to expand temp table:", helper.temp_table_query_);
|
||||
if (OB_ISNULL(helper.temp_table_query_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpect null ref query", K(helper), K(ret));
|
||||
} else if (OB_FAIL(check_stmt_size(helper.temp_table_query_, stmt_size, is_oversize_stmt))) {
|
||||
LOG_WARN("check stmt size failed", K(ret));
|
||||
} else if (OB_FAIL(ObTransformUtils::check_expand_temp_table_valid(helper.temp_table_query_, can_expand))) {
|
||||
LOG_WARN("failed to check expand temp table valid", K(ret));
|
||||
} else if (OB_FAIL(check_has_for_update(helper, has_for_update))) {
|
||||
LOG_WARN("failed to check has for update", K(ret));
|
||||
} else if (!can_expand) {
|
||||
// do nothing
|
||||
OPT_TRACE("CTE can not be expanded");
|
||||
} else if (OB_FAIL(check_hint_allowed_trans(*helper.temp_table_query_,
|
||||
force_inline,
|
||||
force_materia))) {
|
||||
@ -234,9 +223,6 @@ int ObTransformTempTable::expand_temp_table(ObIArray<TempTableInfo> &temp_table_
|
||||
} else if (force_inline) {
|
||||
need_expand = true;
|
||||
OPT_TRACE("hint force inline CTE");
|
||||
} else if (lib::is_oracle_mode() && has_for_update) {
|
||||
need_expand = true;
|
||||
OPT_TRACE("stmt has FOR UPDATE, force inline CTE");
|
||||
} else if (force_materia) {
|
||||
//do nothing
|
||||
OPT_TRACE("hint force materialize CTE");
|
||||
@ -303,7 +289,7 @@ int ObTransformTempTable::check_stmt_can_materialize(ObSelectStmt *stmt, bool is
|
||||
ObAggFunRawExpr *dummy = NULL;
|
||||
bool can_use_fast_min_max = false;
|
||||
STOP_OPT_TRACE;
|
||||
if (OB_FAIL(ObTransformMinMax::check_transform_validity(*ctx_, stmt, dummy, can_use_fast_min_max))) {
|
||||
if (ObTransformMinMax::check_transform_validity(*ctx_, stmt, dummy, can_use_fast_min_max)) {
|
||||
LOG_WARN("failed to check fast min max", K(ret));
|
||||
}
|
||||
RESUME_OPT_TRACE;
|
||||
@ -418,24 +404,6 @@ int ObTransformTempTable::check_stmt_has_cross_product(ObSelectStmt *stmt, bool
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObTransformTempTable::check_has_for_update(const ObDMLStmt::TempTableInfo &helper,
|
||||
bool &has_for_update)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
has_for_update = false;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < helper.upper_stmts_.count(); ++i) {
|
||||
const ObDMLStmt *upper_stmt = helper.upper_stmts_.at(i);
|
||||
if (OB_ISNULL(upper_stmt)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("upper stmt is NULL", K(ret), K(i));
|
||||
} else if (upper_stmt->has_for_update()) {
|
||||
has_for_update = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief extract_common_subquery_as_cte
|
||||
* 比较当前stmt的所有child stmt,
|
||||
@ -1181,7 +1149,7 @@ int ObTransformTempTable::create_temp_table(ObDMLStmt &root_stmt,
|
||||
if (OB_FAIL(ObTransformUtils::deep_copy_stmt(*ctx_->stmt_factory_, *ctx_->expr_factory_,
|
||||
table->ref_query_, temp_table_stmt))) {
|
||||
LOG_WARN("failed to deep copy stmt", K(ret));
|
||||
} else if (OB_FAIL(temp_table_stmt->update_stmt_table_id(ctx_->allocator_, *table->ref_query_))) {
|
||||
} else if (OB_FAIL(temp_table_stmt->update_stmt_table_id(*table->ref_query_))) {
|
||||
LOG_WARN("failed to update table id", K(ret));
|
||||
} else if (OB_FAIL(stmt->generate_view_name(*ctx_->allocator_,
|
||||
temp_table->table_name_,
|
||||
@ -1208,8 +1176,7 @@ int ObTransformTempTable::create_temp_table(ObDMLStmt &root_stmt,
|
||||
if (OB_ISNULL(stmt)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("unexpect null stmt", K(ret));
|
||||
} else if (OB_FAIL(stmt->formalize_stmt_expr_reference(ctx_->expr_factory_,
|
||||
ctx_->session_info_))) {
|
||||
} else if (OB_FAIL(stmt->formalize_stmt_expr_reference())) {
|
||||
LOG_WARN("failed to formalize stmt reference", K(ret));
|
||||
}
|
||||
}
|
||||
@ -1219,8 +1186,7 @@ int ObTransformTempTable::create_temp_table(ObDMLStmt &root_stmt,
|
||||
LOG_WARN("failed to adjust pseudo column like exprs", K(ret));
|
||||
} else if (OB_FAIL(temp_table_query->formalize_stmt(ctx_->session_info_))) {
|
||||
LOG_WARN("failed to formalize stmt", K(ret));
|
||||
} else if (OB_FAIL(temp_table_query->formalize_stmt_expr_reference(ctx_->expr_factory_,
|
||||
ctx_->session_info_))) {
|
||||
} else if (OB_FAIL(temp_table_query->formalize_stmt_expr_reference())) {
|
||||
LOG_WARN("failed to formalize stmt reference", K(ret));
|
||||
}
|
||||
}
|
||||
@ -1698,7 +1664,7 @@ int ObTransformTempTable::apply_temp_table(ObSelectStmt *parent_stmt,
|
||||
if (OB_SUCC(ret) && !find) {
|
||||
ObSEArray<ObAggFunRawExpr*, 8> aggr_items;
|
||||
ObSEArray<ObWinFunRawExpr*, 8> win_func_exprs;
|
||||
if (OB_FAIL(ObTransformUtils::replace_expr(view_column_list, new_column_list, view_select))) {
|
||||
if (ObTransformUtils::replace_expr(view_column_list, new_column_list, view_select)) {
|
||||
LOG_WARN("failed to replace expr", K(ret));
|
||||
} else if (OB_FAIL(new_select_list.push_back(view_select))) {
|
||||
LOG_WARN("failed to push back expr", K(ret));
|
||||
@ -2629,8 +2595,7 @@ int ObTransformTempTable::prepare_eval_cte_cost_stmt(ObDMLStmt &root_stmt,
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(copied_stmt->formalize_stmt(ctx_->session_info_))) {
|
||||
LOG_WARN("failed to formalize stmt", K(ret));
|
||||
} else if (OB_FAIL(copied_stmt->formalize_stmt_expr_reference(ctx_->expr_factory_,
|
||||
ctx_->session_info_))) {
|
||||
} else if (OB_FAIL(copied_stmt->formalize_stmt_expr_reference())) {
|
||||
LOG_WARN("failed to formalize stmt", K(ret));
|
||||
}
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user