[bug]Join order changed when execute with the udf by different parallel hint

This commit is contained in:
akaError
2023-01-10 05:08:04 +00:00
committed by ob-robot
parent 040304870f
commit c0acd5e468
4 changed files with 11 additions and 1 deletions

View File

@ -499,6 +499,7 @@ enum PXParallelRule
MANUAL_TABLE_HINT, // /*+ parallel(t1 3) */ MANUAL_TABLE_HINT, // /*+ parallel(t1 3) */
SESSION_FORCE_PARALLEL, // alter session force parallel query parallel 3; SESSION_FORCE_PARALLEL, // alter session force parallel query parallel 3;
MANUAL_TABLE_DOP, // create table t1 (...) parallel 3; MANUAL_TABLE_DOP, // create table t1 (...) parallel 3;
PL_UDF_DAS_FORCE_SERIALIZE, //stmt has_pl_udf will use das, force serialize;
MAX_OPTION MAX_OPTION
}; };
@ -513,6 +514,7 @@ inline const char *ob_px_parallel_rule_str(PXParallelRule px_parallel_ruel)
"MANUAL_TABLE_HINT", "MANUAL_TABLE_HINT",
"SESSION_FORCE_PARALLEL", "SESSION_FORCE_PARALLEL",
"MANUAL_TABLE_DOP", "MANUAL_TABLE_DOP",
"PL_UDF_DAS_FORCE_SERIALIZE",
"MAX_OPTION", "MAX_OPTION",
}; };
if (OB_LIKELY(px_parallel_ruel >= NOT_USE_PX) if (OB_LIKELY(px_parallel_ruel >= NOT_USE_PX)

View File

@ -30,6 +30,7 @@ namespace sql
#define PARALLEL_ENABLED_BY_TABLE_HINT "Degree of Parallelism is %ld because of hint" #define PARALLEL_ENABLED_BY_TABLE_HINT "Degree of Parallelism is %ld because of hint"
#define PARALLEL_ENABLED_BY_SESSION "Degree of Parallelism is %ld because of session" #define PARALLEL_ENABLED_BY_SESSION "Degree of Parallelism is %ld because of session"
#define PARALLEL_ENABLED_BY_TABLE_PROPERTY "Degree of Parallelisim is %ld because of table property" #define PARALLEL_ENABLED_BY_TABLE_PROPERTY "Degree of Parallelisim is %ld because of table property"
#define PARALLEL_DISABLED_BY_PL_UDF_DAS "Degree of Parallelisim is %ld because stmt contain pl_udf which force das scan"
} }
} }

View File

@ -667,6 +667,12 @@ int ObOptimizer::init_env_info(ObDMLStmt &stmt)
ctx_.set_parallel_rule(PXParallelRule::USE_PX_DEFAULT); ctx_.set_parallel_rule(PXParallelRule::USE_PX_DEFAULT);
ctx_.set_parallel(ObGlobalHint::DEFAULT_PARALLEL); ctx_.set_parallel(ObGlobalHint::DEFAULT_PARALLEL);
} }
//following above rule, but if stmt contain pl_udf, force das, parallel should be 1
if (parallel > 1 && ctx_.has_pl_udf()) {
ctx_.set_parallel_rule(PXParallelRule::PL_UDF_DAS_FORCE_SERIALIZE);
ctx_.set_parallel(1);
ctx_.add_plan_note(PARALLEL_DISABLED_BY_PL_UDF_DAS, 1);
}
} }
// init column usage info // init column usage info

View File

@ -225,7 +225,8 @@ ObOptimizerContext(ObSQLSessionInfo *session_info,
return px_parallel_rule_ == MANUAL_HINT || return px_parallel_rule_ == MANUAL_HINT ||
px_parallel_rule_ == MANUAL_TABLE_HINT || px_parallel_rule_ == MANUAL_TABLE_HINT ||
px_parallel_rule_ == SESSION_FORCE_PARALLEL || px_parallel_rule_ == SESSION_FORCE_PARALLEL ||
px_parallel_rule_ == MANUAL_TABLE_DOP; px_parallel_rule_ == MANUAL_TABLE_DOP ||
px_parallel_rule_ == PL_UDF_DAS_FORCE_SERIALIZE;
} }
inline bool use_intra_parallel() const inline bool use_intra_parallel() const
{ {