Fix outline bug
This commit is contained in:
parent
a9b068daa1
commit
4ca1daa3c1
@ -2539,9 +2539,16 @@ bool ObTableInHint::is_match_table_items(ObCollationType cs_type,
|
||||
void ObTableInHint::set_table(const TableItem& table)
|
||||
{
|
||||
qb_name_.assign_ptr(table.qb_name_.ptr(), table.qb_name_.length());
|
||||
table_name_.assign_ptr(table.get_table_name().ptr(), table.get_table_name().length());
|
||||
if (table.is_basic_table()) {
|
||||
db_name_.assign_ptr(table.database_name_.ptr(), table.database_name_.length());
|
||||
if (!table.alias_name_.empty()) {
|
||||
table_name_.assign_ptr(table.alias_name_.ptr(), table.alias_name_.length());
|
||||
} else if (table.is_synonym()) {
|
||||
table_name_.assign_ptr(table.synonym_name_.ptr(), table.synonym_name_.length());
|
||||
db_name_.assign_ptr(table.synonym_db_name_.ptr(), table.synonym_db_name_.length());
|
||||
} else {
|
||||
table_name_.assign_ptr(table.table_name_.ptr(), table.table_name_.length());
|
||||
if (table.is_basic_table()) {
|
||||
db_name_.assign_ptr(table.database_name_.ptr(), table.database_name_.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1760,7 +1760,6 @@ int ObTransformOrExpansion::is_valid_topk_cond(const ObDMLStmt &stmt,
|
||||
col_expr = static_cast<ObColumnRefRawExpr*>(expr);
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret) && NULL != col_expr) {
|
||||
ObSEArray<ObColumnRefRawExpr*, 4> col_exprs;
|
||||
bool is_match = false;
|
||||
@ -1898,16 +1897,15 @@ int ObTransformOrExpansion::is_condition_valid(const ObDMLStmt *stmt,
|
||||
LOG_WARN("failed to check condition valid basic", K(ret));
|
||||
} else if (!is_valid) {
|
||||
/*do nothing*/
|
||||
} else if (NULL != ctx.hint_ && ctx.hint_->is_enable_hint()) {
|
||||
// 1. match basic condition, do transform if use hint.
|
||||
if (OB_FAIL(get_use_hint_expand_type(*expr, !common_cols.empty(),
|
||||
can_set_distinct, trans_info))) {
|
||||
LOG_WARN("failed to get expand type use hint", K(ret));
|
||||
}
|
||||
} else if (!common_cols.empty() && // 2. topk: can eliminate ordering
|
||||
} else if (!common_cols.empty() && // 1. topk: can eliminate ordering
|
||||
OB_FAIL(is_valid_topk_cond(*stmt, expect_ordering, common_cols,
|
||||
equal_sets, const_exprs, trans_info))) {
|
||||
LOG_WARN("failed to check is valid topk cond", K(ret));
|
||||
} else if (NULL != ctx.hint_ && ctx.hint_->is_enable_hint()) {
|
||||
// 2. match basic condition, do transform if use hint.
|
||||
if (OB_FAIL(get_use_hint_expand_type(*expr, can_set_distinct, trans_info))) {
|
||||
LOG_WARN("failed to get expand type use hint", K(ret));
|
||||
}
|
||||
} else if (INVALID_OR_EXPAND_TYPE != trans_info.or_expand_type_) {
|
||||
/*do nothing*/
|
||||
LOG_TRACE("valid topk condition", K(*expr), K(trans_info));
|
||||
@ -1977,7 +1975,6 @@ int ObTransformOrExpansion::is_condition_valid(const ObDMLStmt *stmt,
|
||||
}
|
||||
|
||||
int ObTransformOrExpansion::get_use_hint_expand_type(const ObRawExpr &expr,
|
||||
const bool is_topk,
|
||||
const bool can_set_distinct,
|
||||
OrExpandInfo &trans_info)
|
||||
{
|
||||
@ -1986,7 +1983,7 @@ int ObTransformOrExpansion::get_use_hint_expand_type(const ObRawExpr &expr,
|
||||
if (!can_set_distinct) {
|
||||
trans_info.is_set_distinct_ = false;
|
||||
} else {
|
||||
trans_info.is_set_distinct_ = is_topk;
|
||||
trans_info.is_set_distinct_ |= (T_OP_IN == expr.get_expr_type());
|
||||
int64_t sub_num = 0;
|
||||
int64_t N = expr.get_param_count();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && !trans_info.is_set_distinct_ && i < N; i++) {
|
||||
|
@ -261,7 +261,6 @@ private:
|
||||
bool &using_same_cols);
|
||||
|
||||
int get_use_hint_expand_type(const ObRawExpr &expr,
|
||||
const bool is_topk,
|
||||
const bool can_set_distinct,
|
||||
OrExpandInfo &trans_info);
|
||||
|
||||
|
@ -2071,8 +2071,8 @@ Outline Data:
|
||||
BEGIN_OUTLINE_DATA
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$3" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "t2"@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
OPTIMIZER_FEATURES_ENABLE('4.0.0.0')
|
||||
@ -2193,8 +2193,8 @@ Outline Data:
|
||||
BEGIN_OUTLINE_DATA
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$3" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "t2"@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
OPTIMIZER_FEATURES_ENABLE('4.0.0.0')
|
||||
@ -2315,8 +2315,8 @@ Outline Data:
|
||||
BEGIN_OUTLINE_DATA
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$3" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "t2"@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$2")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
@ -2438,8 +2438,8 @@ Outline Data:
|
||||
BEGIN_OUTLINE_DATA
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$3" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "t2"@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$2")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
@ -2568,10 +2568,10 @@ Outline Data:
|
||||
BEGIN_OUTLINE_DATA
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
FULL(@"SEL$3" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$3" "t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "t2"@"SEL$4")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$2")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
@ -2745,18 +2745,18 @@ Outline Data:
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$2")
|
||||
USE_DAS(@"SEL$69480C90" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$DD143F72" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$DD143F72" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
FULL(@"SEL$DD143F72" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$DD143F72" "t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "t2"@"SEL$8")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$2")
|
||||
PRED_DEDUCE(@"SEL$3")
|
||||
@ -2975,18 +2975,18 @@ Outline Data:
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
USE_DAS(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$69480C90" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
FULL(@"SEL$69480C90" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$69480C90" "t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "t2"@"SEL$8")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
@ -3204,18 +3204,18 @@ Outline Data:
|
||||
FULL(@"SEL$26211548" "test"."t1"@"SEL$1")
|
||||
FULL(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
USE_DAS(@"SEL$2" "test"."t2"@"SEL$2")
|
||||
FULL(@"SEL$69480C90" "test"."t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$69480C90" "test"."t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "test"."t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "test"."t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "test"."t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "test"."t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "test"."t2"@"SEL$8")
|
||||
FULL(@"SEL$69480C90" "t2"@"SEL$3")
|
||||
USE_DAS(@"SEL$69480C90" "t2"@"SEL$3")
|
||||
FULL(@"SEL$4" "t2"@"SEL$4")
|
||||
USE_DAS(@"SEL$4" "t2"@"SEL$4")
|
||||
FULL(@"SEL$5" "t2"@"SEL$5")
|
||||
USE_DAS(@"SEL$5" "t2"@"SEL$5")
|
||||
FULL(@"SEL$6" "t2"@"SEL$6")
|
||||
USE_DAS(@"SEL$6" "t2"@"SEL$6")
|
||||
FULL(@"SEL$7" "t2"@"SEL$7")
|
||||
USE_DAS(@"SEL$7" "t2"@"SEL$7")
|
||||
FULL(@"SEL$8" "t2"@"SEL$8")
|
||||
USE_DAS(@"SEL$8" "t2"@"SEL$8")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$1")
|
||||
PRED_DEDUCE(@"SEL$3")
|
||||
SIMPLIFY_SUBQUERY(@"SEL$4D615D57")
|
||||
|
Loading…
x
Reference in New Issue
Block a user