fix pdml cannot be enabled after rewrite generate joined table
This commit is contained in:
@ -338,6 +338,7 @@ int ObOptimizer::check_pdml_enabled(const ObDMLStmt &stmt,
|
||||
!static_cast< const ObInsertStmt &>(stmt).value_from_select()) {
|
||||
can_use_pdml = false;
|
||||
} else if ((stmt.is_update_stmt() || stmt.is_delete_stmt())
|
||||
&& static_cast<const ObDelUpdStmt &>(stmt).dml_source_from_join()
|
||||
&& static_cast<const ObDelUpdStmt &>(stmt).is_dml_table_from_join()) {
|
||||
can_use_pdml = false;
|
||||
} else if (OB_FAIL(check_pdml_supported_feature(static_cast<const ObDelUpdStmt&>(stmt),
|
||||
|
||||
@ -737,3 +737,17 @@ int ObDelUpdStmt::extract_need_filter_null_table(const JoinedTable *cur_table,
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDelUpdStmt::check_dml_source_from_join()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
TableItem *dml_table = nullptr;
|
||||
if (get_from_item_size() == 1 &&
|
||||
nullptr != (dml_table = get_table_item(get_from_item(0))) &&
|
||||
dml_table->is_basic_table()) {
|
||||
// do nothing
|
||||
} else {
|
||||
set_dml_source_from_join(true);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -401,7 +401,8 @@ public:
|
||||
has_global_index_(false),
|
||||
error_log_info_(),
|
||||
has_instead_of_trigger_(false),
|
||||
ab_stmt_id_expr_(nullptr)
|
||||
ab_stmt_id_expr_(nullptr),
|
||||
dml_source_from_join_(false)
|
||||
{ }
|
||||
virtual ~ObDelUpdStmt() { }
|
||||
int deep_copy_stmt_struct(ObIAllocator &allocator,
|
||||
@ -465,6 +466,9 @@ public:
|
||||
int has_dml_table_info(const uint64_t table_id, bool &has) const;
|
||||
int check_dml_need_filter_null();
|
||||
int extract_need_filter_null_table(const JoinedTable *cur_table, ObIArray<uint64_t> &table_ids);
|
||||
void set_dml_source_from_join(bool from_join) { dml_source_from_join_ = from_join; }
|
||||
inline bool dml_source_from_join() const { return dml_source_from_join_; }
|
||||
int check_dml_source_from_join();
|
||||
protected:
|
||||
common::ObSEArray<ObRawExpr*, common::OB_PREALLOCATED_NUM, common::ModulePageAllocator, true> returning_exprs_;
|
||||
common::ObSEArray<ObRawExpr*, common::OB_PREALLOCATED_NUM, common::ModulePageAllocator, true> returning_into_exprs_;
|
||||
@ -477,6 +481,7 @@ protected:
|
||||
// for insert and merge stmt
|
||||
common::ObSEArray<ObRawExpr *, 16, common::ModulePageAllocator, true> sharding_conditions_;
|
||||
ObRawExpr *ab_stmt_id_expr_; //for array binding batch execution to mark the stmt id
|
||||
bool dml_source_from_join_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +128,8 @@ int ObDeleteResolver::resolve(const ParseNode &parse_tree)
|
||||
LOG_WARN("failed to check view deletable", K(ret));
|
||||
} else if (OB_FAIL(delete_stmt->check_dml_need_filter_null())) {
|
||||
LOG_WARN("failed to check dml need filter null", K(ret));
|
||||
} else if (OB_FAIL(delete_stmt->check_dml_source_from_join())) {
|
||||
LOG_WARN("failed to check dml source from join");
|
||||
} else if (OB_FAIL(check_safe_update_mode(delete_stmt, is_multi_table_delete))) {
|
||||
LOG_WARN("failed to check safe update mode", K(ret));
|
||||
} else { /*do nothing */ }
|
||||
|
||||
@ -183,6 +183,8 @@ int ObUpdateResolver::resolve(const ParseNode &parse_tree)
|
||||
LOG_TRACE("view not updatable", K(ret));
|
||||
} else if (OB_FAIL(update_stmt->check_dml_need_filter_null())) {
|
||||
LOG_WARN("failed to check dml need filter null", K(ret));
|
||||
} else if (OB_FAIL(update_stmt->check_dml_source_from_join())) {
|
||||
LOG_WARN("failed to check dml source from join", K(ret));
|
||||
} else if (lib::is_mysql_mode() && OB_FAIL(check_safe_update_mode(update_stmt))) {
|
||||
LOG_WARN("failed to check fulfill safe update mode", K(ret));
|
||||
} else { /*do nothing*/ }
|
||||
|
||||
Reference in New Issue
Block a user