Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuqin1998 committed Aug 15, 2023
1 parent ca35493 commit efc3c8b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 44 deletions.
25 changes: 9 additions & 16 deletions src/sql/engine/px/ob_dfo_scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,11 @@ int ObSerialDfoScheduler::init_all_dfo_channel(ObExecContext &ctx) const
} else if (parent->is_root_dfo() && !parent->is_thread_inited() &&
OB_FAIL(ObPXServerAddrUtil::alloc_by_local_distribution(ctx, *parent))) {
LOG_WARN("fail to alloc local distribution", K(ret));
} else if (!parent->is_root_dfo() &&
ObPQDistributeMethod::PARTITION_HASH == child->get_dist_method()) {
} else if (!parent->is_root_dfo() && parent->is_related_pair()) {
if (OB_FAIL(ObPXServerAddrUtil::alloc_by_reference_child_distribution(
coord_info_.pruning_table_location_,
ctx,
*child, *parent))) {
*parent))) {
LOG_WARN("fail alloc addr by data distribution", K(parent), K(child), K(ret));
}
} else if (!parent->is_root_dfo() && !parent->is_thread_inited() &&
Expand Down Expand Up @@ -1409,12 +1408,13 @@ int ObParallelDfoScheduler::schedule_pair(ObExecContext &exec_ctx,
// sqc。
//
// 下面只实现了第一种、第二种情况,第三种需求不明确,列为 TODO
if (parent.is_related_pair() &&
OB_FAIL(ObPXServerAddrUtil::alloc_by_reference_child_distribution(
coord_info_.pruning_table_location_,
exec_ctx,
parent))) {
LOG_WARN("fail alloc addr by reference child distribution", K(parent), K(child), K(ret));
if (parent.is_related_pair()) {
if (OB_FAIL(ObPXServerAddrUtil::alloc_by_reference_child_distribution(
coord_info_.pruning_table_location_,
exec_ctx,
parent))) {
LOG_WARN("fail alloc addr by reference child distribution", K(parent), K(child), K(ret));
}
} else if (parent.has_scan_op() || parent.has_dml_op()) { // 参考 Partial Partition Wise Join
// 当DFO中存在TSC或者pdml中的global index maintain op:
// 1. 当存在TSC情况下,sqcs的location信息使用tsc表的location信息
Expand All @@ -1432,13 +1432,6 @@ int ObParallelDfoScheduler::schedule_pair(ObExecContext &exec_ctx,
LOG_WARN("fail alloc addr by data distribution", K(parent), K(ret));
}
LOG_TRACE("alloc_by_local_distribution", K(parent));
} else if (ObPQDistributeMethod::PARTITION_HASH == child.get_dist_method()) {
if (OB_FAIL(ObPXServerAddrUtil::alloc_by_reference_child_distribution(
coord_info_.pruning_table_location_,
exec_ctx,
child, parent))) {
LOG_WARN("fail alloc addr by data distribution", K(parent), K(child), K(ret));
}
} else if (OB_FAIL(ObPXServerAddrUtil::alloc_by_random_distribution(exec_ctx, child, parent))) {
LOG_WARN("fail alloc addr by data distribution", K(parent), K(child), K(ret));
}
Expand Down
24 changes: 0 additions & 24 deletions src/sql/engine/px/ob_px_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,30 +866,6 @@ int ObPXServerAddrUtil::alloc_by_local_distribution(ObExecContext &exec_ctx,
* dfo2的sqc来进行构建。
*
*/
int ObPXServerAddrUtil::alloc_by_reference_child_distribution(
const ObIArray<ObTableLocation> *table_locations,
ObExecContext &exec_ctx,
ObDfo &child,
ObDfo &parent)
{
int ret = OB_SUCCESS;
ObDfo *reference_child = nullptr;
if (2 != parent.get_child_count()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("parent should has two child", K(ret));
} else if (OB_FAIL(parent.get_child_dfo(0, reference_child))) {
LOG_WARN("failed to get reference_child", K(ret));
} else if (reference_child->get_dfo_id() == child.get_dfo_id()
&& OB_FAIL(parent.get_child_dfo(1, reference_child))) {
LOG_WARN("failed to get reference_child", K(ret));
} else if (OB_FAIL(alloc_by_data_distribution(table_locations, exec_ctx, *reference_child))) {
LOG_WARN("failed to alloc by data", K(ret));
} else if (OB_FAIL(alloc_by_child_distribution(*reference_child, parent))) {
LOG_WARN("failed to alloc by child distribution", K(ret));
}
return ret;
}

int ObPXServerAddrUtil::alloc_by_reference_child_distribution(
const ObIArray<ObTableLocation> *table_locations,
ObExecContext &exec_ctx,
Expand Down
4 changes: 0 additions & 4 deletions src/sql/engine/px/ob_px_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ class ObPXServerAddrUtil
ObDfo &child);
static int alloc_by_local_distribution(ObExecContext &exec_ctx,
ObDfo &root);
static int alloc_by_reference_child_distribution(const ObIArray<ObTableLocation> *table_locations,
ObExecContext &exec_ctx,
ObDfo &child,
ObDfo &parent);
static int alloc_by_reference_child_distribution(const ObIArray<ObTableLocation> *table_locations,
ObExecContext &exec_ctx,
ObDfo &parent);
Expand Down
2 changes: 2 additions & 0 deletions src/sql/optimizer/ob_log_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4504,6 +4504,7 @@ int ObLogPlan::compute_join_exchange_info(JoinPath &join_path,
} else {
left_exch_info.dist_method_ = ObPQDistributeMethod::PARTITION_HASH;
right_exch_info.dist_method_ = ObPQDistributeMethod::HASH;
right_exch_info.is_related_child_ = true;
left_exch_info.slave_mapping_type_ = sm_type;
right_exch_info.slave_mapping_type_ = sm_type;
}
Expand Down Expand Up @@ -4535,6 +4536,7 @@ int ObLogPlan::compute_join_exchange_info(JoinPath &join_path,
} else {
left_exch_info.dist_method_ = ObPQDistributeMethod::HASH;
right_exch_info.dist_method_ = ObPQDistributeMethod::PARTITION_HASH;
left_exch_info.is_related_child_ = true;
left_exch_info.slave_mapping_type_ = sm_type;
right_exch_info.slave_mapping_type_ = sm_type;
}
Expand Down

0 comments on commit efc3c8b

Please sign in to comment.