提交 68cc172f 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] fix spj bug when select exprs contain enum type

上级 19b1ebd0
......@@ -865,6 +865,8 @@ int ObRawExprWrapEnumSet::visit_query_ref_expr(
} else if (NULL != new_expr) {
// replace with new wrapped expr
ref_stmt->get_select_item(0).expr_ = new_expr;
expr.get_column_types().at(0) = new_expr->get_result_type();
LOG_TRACE("succeed to wrap enum to str", K(dest_type), K(*new_expr), K(expr));
} else { /*do nothing*/
}
}
......
......@@ -313,7 +313,7 @@ int ObTransformerImpl::choose_rewrite_rules(ObDMLStmt* stmt, uint64_t& need_type
LOG_WARN("failed to check stmt functions", K(ret));
} else {
// TODO::unpivot open
if (func.contain_unpivot_query_) {
if (func.contain_unpivot_query_ || func.contain_enum_set_values_) {
disable_list = ObTransformRule::ALL_TRANSFORM_RULES;
}
if (func.contain_sequence_) {
......@@ -345,6 +345,14 @@ int ObTransformerImpl::check_stmt_functions(ObDMLStmt* stmt, StmtFunc& func)
func.contain_for_update_ = func.contain_for_update_ || has_for_update;
func.contain_unpivot_query_ = func.contain_unpivot_query_ || stmt->is_unpivot_select();
}
for (int64_t i = 0; OB_SUCC(ret) && !func.contain_enum_set_values_ && i < stmt->get_column_items().count(); ++i) {
const ColumnItem &col = stmt->get_column_items().at(i);
if (OB_ISNULL(col.get_expr())) {
ret = OB_ERR_UNEXPECTED;
} else if (ob_is_enumset_tc(col.get_expr()->get_data_type())) {
func.contain_enum_set_values_ = true;
}
}
if (OB_SUCC(ret) &&
(stmt->is_delete_stmt() || stmt->is_update_stmt() || stmt->is_merge_stmt() || stmt->is_insert_stmt())) {
ObDelUpdStmt* del_upd_stmt = static_cast<ObDelUpdStmt*>(stmt);
......
......@@ -110,13 +110,14 @@ public:
contain_for_update_(false),
contain_domain_index_(false),
update_global_index_(false),
contain_unpivot_query_(false)
contain_unpivot_query_(false),
contain_enum_set_values_(false)
{}
bool all_found() const
{
return contain_hie_query_ && contain_sequence_ && contain_for_update_ && contain_domain_index_ &&
update_global_index_ && contain_unpivot_query_;
update_global_index_ && contain_unpivot_query_ && contain_enum_set_values_;
}
bool contain_hie_query_;
......@@ -125,6 +126,7 @@ public:
bool contain_domain_index_;
bool update_global_index_;
bool contain_unpivot_query_;
bool contain_enum_set_values_;
};
int check_stmt_functions(ObDMLStmt* stmt, StmtFunc& func);
inline ObTransformerCtx* get_trans_ctx()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册