fix optimizer trace bug and fix format sql plan bug

This commit is contained in:
zzg19950727
2023-02-07 11:37:22 +08:00
committed by ob-robot
parent 4f31f2a715
commit 9bbe05b4b4
5 changed files with 92 additions and 29 deletions

View File

@ -9863,25 +9863,11 @@ int ObJoinOrder::get_valid_path_info(const ObJoinOrder &left_tree,
}
OPT_TRACE("candi distribute methods:");
int64_t distributed_methods = path_info.distributed_methods_;
const ObString dist_algo_str[] =
{
"BASIC",
"PULL TO LOCAL",
"HASH HASH",
"BROADCAST NONE",
"NONE BROADCAST",
"BC2HOST NONE",
"PARTITION NONE",
"NONE PARTITION",
"PARTITION WISE",
"UNKNOWN ALGO",
"RANDOM"
};
for (int idx = 0; idx < sizeof(dist_algo_str) / sizeof(ObString); ++idx) {
if (distributed_methods & 1) {
OPT_TRACE(dist_algo_str[idx]);
for (int64_t k = 1; k < DistAlgo::DIST_MAX_JOIN_METHOD; k = k << 1) {
if (distributed_methods & k) {
DistAlgo dist_algo = get_dist_algo(k);
OPT_TRACE(ob_dist_algo_str(dist_algo));
}
distributed_methods >>= 1;
}
}
}

View File

@ -102,6 +102,10 @@ enum SetAlgo
HASH_SET
};
/********
* When modifying DistAlgo, the function ob_dist_algo_str
* needs to be modified synchronously !!!
************/
enum DistAlgo
{
DIST_INVALID_METHOD = 0,
@ -132,15 +136,21 @@ inline const ObString &ob_dist_algo_str(DistAlgo algo)
"UNKNOWN ALGO",
"BASIC",
"PULL TO LOCAL",
"HASH NONE",
"NONE HASH",
"HASH HASH",
"BROADCAST NONE",
"NONE BROADCAST",
"BC2HOST NONE",
"PARTITION NONE",
"NONE PARTITION",
"NONE ALL",
"ALL NONE",
"PARTITION WISE",
"EXTEND PARTITION WISE",
"UNKNOWN ALGO",
"RANDOM"
"SET RANDOM",
"SET PARTITION WISE"
};
int64_t idx = 0;
int64_t value = algo;
@ -148,7 +158,7 @@ inline const ObString &ob_dist_algo_str(DistAlgo algo)
value >>= 1;
++idx;
}
if (OB_LIKELY(idx >= 0) && OB_LIKELY(idx <= 11)) {
if (OB_LIKELY(idx >= 0) && OB_LIKELY(idx <= sizeof(dist_algo_str) / sizeof(ObString))) {
return dist_algo_str[idx];
} else {
return dist_algo_str[0];