bugfix: support use SEMI_TO_INNER and COALESCE_SQ with no param specified
This commit is contained in:
@ -9396,6 +9396,10 @@ NO_REWRITE opt_qb_name
|
|||||||
{
|
{
|
||||||
malloc_non_terminal_node($$, result->malloc_pool_, T_MATERIALIZE, 2, $3, $4);
|
malloc_non_terminal_node($$, result->malloc_pool_, T_MATERIALIZE, 2, $3, $4);
|
||||||
}
|
}
|
||||||
|
| SEMI_TO_INNER opt_qb_name
|
||||||
|
{
|
||||||
|
malloc_non_terminal_node($$, result->malloc_pool_, T_SEMI_TO_INNER, 1, $2);
|
||||||
|
}
|
||||||
| SEMI_TO_INNER '(' qb_name_option relation_factor_in_use_join_hint_list ')'
|
| SEMI_TO_INNER '(' qb_name_option relation_factor_in_use_join_hint_list ')'
|
||||||
{
|
{
|
||||||
malloc_non_terminal_node($$, result->malloc_pool_, T_SEMI_TO_INNER, 2, $3, $4);
|
malloc_non_terminal_node($$, result->malloc_pool_, T_SEMI_TO_INNER, 2, $3, $4);
|
||||||
@ -9404,6 +9408,10 @@ NO_REWRITE opt_qb_name
|
|||||||
{
|
{
|
||||||
malloc_non_terminal_node($$, result->malloc_pool_, T_NO_SEMI_TO_INNER, 1, $2);
|
malloc_non_terminal_node($$, result->malloc_pool_, T_NO_SEMI_TO_INNER, 1, $2);
|
||||||
}
|
}
|
||||||
|
| COALESCE_SQ opt_qb_name
|
||||||
|
{
|
||||||
|
malloc_non_terminal_node($$, result->malloc_pool_, T_COALESCE_SQ, 1, $2);
|
||||||
|
}
|
||||||
| COALESCE_SQ '(' qb_name_option multi_qb_name_list ')'
|
| COALESCE_SQ '(' qb_name_option multi_qb_name_list ')'
|
||||||
{
|
{
|
||||||
malloc_non_terminal_node($$, result->malloc_pool_, T_COALESCE_SQ, 2, $3, $4);
|
malloc_non_terminal_node($$, result->malloc_pool_, T_COALESCE_SQ, 2, $3, $4);
|
||||||
|
|||||||
@ -760,6 +760,7 @@ class ObCoalesceSqHint : public ObTransHint
|
|||||||
|
|
||||||
virtual int print_hint_desc(PlanText &plan_text) const override;
|
virtual int print_hint_desc(PlanText &plan_text) const override;
|
||||||
ObIArray<QbNameList> &get_qb_name_list() { return qb_name_list_; }
|
ObIArray<QbNameList> &get_qb_name_list() { return qb_name_list_; }
|
||||||
|
const ObIArray<QbNameList> &get_qb_name_list() const { return qb_name_list_; }
|
||||||
int add_qb_name_list(const QbNameList& qb_names);
|
int add_qb_name_list(const QbNameList& qb_names);
|
||||||
int get_qb_name_list(const ObString& qb_name, QbNameList &qb_names) const;
|
int get_qb_name_list(const ObString& qb_name, QbNameList &qb_names) const;
|
||||||
bool enable_coalesce_sq(const ObIArray<ObString> &subqueries) const
|
bool enable_coalesce_sq(const ObIArray<ObString> &subqueries) const
|
||||||
|
|||||||
@ -1650,7 +1650,8 @@ int ObTransformSemiToInner::construct_transform_hint(ObDMLStmt &stmt, void *tran
|
|||||||
LOG_WARN("failed to push back table hint", K(ret));
|
LOG_WARN("failed to push back table hint", K(ret));
|
||||||
} else if (OB_FAIL(ctx_->add_src_hash_val(table_item->get_table_name()))) {
|
} else if (OB_FAIL(ctx_->add_src_hash_val(table_item->get_table_name()))) {
|
||||||
LOG_WARN("failed to add src hash val", K(ret));
|
LOG_WARN("failed to add src hash val", K(ret));
|
||||||
} else if (NULL != myhint && myhint->enable_semi_to_inner(query_hint->cs_type_, *table_item)) {
|
} else if (NULL != myhint && (myhint->get_tables().count() == 0 ||
|
||||||
|
myhint->enable_semi_to_inner(query_hint->cs_type_, *table_item))) {
|
||||||
use_hint = true;
|
use_hint = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1680,7 +1681,8 @@ int ObTransformSemiToInner::check_hint_valid(const ObDMLStmt &stmt,
|
|||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("unexpected null", K(ret), K(query_hint));
|
LOG_WARN("unexpected null", K(ret), K(query_hint));
|
||||||
} else {
|
} else {
|
||||||
force_trans = NULL != myhint && myhint->enable_semi_to_inner(query_hint->cs_type_, table);
|
force_trans = NULL != myhint && (myhint->get_tables().count() == 0 ||
|
||||||
|
myhint->enable_semi_to_inner(query_hint->cs_type_, table));
|
||||||
force_no_trans = !force_trans && query_hint->has_outline_data();
|
force_no_trans = !force_trans && query_hint->has_outline_data();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@ -2460,7 +2460,8 @@ int ObTransformSubqueryCoalesce::construct_transform_hint(ObDMLStmt &stmt, void
|
|||||||
if (OB_FAIL(ret)) {
|
if (OB_FAIL(ret)) {
|
||||||
} else if (OB_FAIL(hint->add_qb_name_list(qb_names))) {
|
} else if (OB_FAIL(hint->add_qb_name_list(qb_names))) {
|
||||||
LOG_WARN("failed to add qb names", K(ret));
|
LOG_WARN("failed to add qb names", K(ret));
|
||||||
} else if (NULL != myhint && myhint->enable_coalesce_sq(qb_names.qb_names_)) {
|
} else if (NULL != myhint && (myhint->get_qb_name_list().count() == 0 ||
|
||||||
|
myhint->enable_coalesce_sq(qb_names.qb_names_))) {
|
||||||
use_hint = true;
|
use_hint = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2525,7 +2526,8 @@ int ObTransformSubqueryCoalesce::check_hint_valid(const ObDMLStmt &stmt,
|
|||||||
LOG_WARN("unexpected null", K(ret), K(query_hint));
|
LOG_WARN("unexpected null", K(ret), K(query_hint));
|
||||||
} else {
|
} else {
|
||||||
const ObCoalesceSqHint *myhint = static_cast<const ObCoalesceSqHint*>(get_hint(stmt.get_stmt_hint()));
|
const ObCoalesceSqHint *myhint = static_cast<const ObCoalesceSqHint*>(get_hint(stmt.get_stmt_hint()));
|
||||||
force_trans = NULL != myhint && myhint->enable_coalesce_sq(qb_names);
|
force_trans = NULL != myhint && (myhint->get_qb_name_list().count() == 0 ||
|
||||||
|
myhint->enable_coalesce_sq(qb_names));
|
||||||
force_no_trans = !force_trans && query_hint->has_outline_data();
|
force_no_trans = !force_trans && query_hint->has_outline_data();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user