提交 a3fa322b 编写于 作者: Y yb0 提交者: LINGuanRen

modify large stack variable to heap variable for pwj compare

上级 b79cea0c
......@@ -593,51 +593,55 @@ int ObDistPlans::check_inner_constraints(const ObIArray<ObPlanPwjConstraint>& st
if (strict_cons.count() > 0 || non_strict_cons.count() > 0) {
const int64_t tbl_count = phy_tbl_infos.count();
ObSEArray<PwjTable, 8> pwj_tables;
ObPwjComparer strict_pwj_comparer(true);
ObPwjComparer non_strict_pwj_comparer(false);
if (OB_FAIL(pwj_tables.prepare_allocate(tbl_count))) {
LOG_WARN("failed to prepare allocate pwj tables", K(ret));
}
HEAP_VAR(ObPwjComparer, strict_pwj_comparer, true)
{
HEAP_VAR(ObPwjComparer, non_strict_pwj_comparer, false)
{
if (OB_FAIL(pwj_tables.prepare_allocate(tbl_count))) {
LOG_WARN("failed to prepare allocate pwj tables", K(ret));
}
/* Traverse strict pwj constraints and non-strict pwj constraints, and generate a partition id
* mapping that can do partition wise join.
* Because there may be constraints in the following forms
* strict_pwj_cons = [0,1], [2,3]
* non_strict_pwj_cons = [0,2]
* If you traverse strict_pwj_cons first, and then traverse non_strict_pwj_cons, there may be a situation:
* After traversing strict_pwj_cons, the mapping of [part_array0, part_array1, part_array2, part_array3] is set in
* pwj_map, But when traversing non_strict_pwj_cons, it is found that partition_array2 needs to be adjusted, then
* all the arrays related to it must be adjusted recursively, The adjustment is very complicated. Traverse in
* strict_pwj_cons and non_strict_pwj_cons separately in the order of the base table to avoid this situation:
* Traverse all constraints starting with 0, and set the mapping of [part_array0, part_array1, part_array2] in
* pwj_map; Traverse all the constraints starting with 1, and find that there are no related constraints; To
* traverse all constraints starting with 2, you need to set part_array3 in pwj_map, because part_array2 has been
* set, so The mapping of part_array3 generated by part_array2 does not need to be adjusted Traverse all the
* constraints starting with 3 and find that there are no related constraints
*/
for (int64_t i = 0; OB_SUCC(ret) && i < tbl_count; ++i) {
for (int64_t j = 0; OB_SUCC(ret) && j < strict_cons.count(); ++j) {
const ObPlanPwjConstraint& pwj_cons = strict_cons.at(j);
if (OB_UNLIKELY(pwj_cons.count() <= 1)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected pwj constraint", K(ret), K(pwj_cons));
} else if (pwj_cons.at(0) == i) {
if (OB_FAIL(
check_pwj_cons(pc_ctx, pwj_cons, phy_tbl_infos, pwj_tables, strict_pwj_comparer, pwj_map, is_same))) {
LOG_WARN("failed to check pwj cons", K(ret));
/* Traverse strict pwj constraints and non-strict pwj constraints, and generate a partition id
* mapping that can do partition wise join.
* Because there may be constraints in the following forms
* strict_pwj_cons = [0,1], [2,3]
* non_strict_pwj_cons = [0,2]
* If you traverse strict_pwj_cons first, and then traverse non_strict_pwj_cons, there may be a situation:
* After traversing strict_pwj_cons, the mapping of [part_array0, part_array1, part_array2, part_array3] is set in
* pwj_map, But when traversing non_strict_pwj_cons, it is found that partition_array2 needs to be adjusted, then
* all the arrays related to it must be adjusted recursively, The adjustment is very complicated. Traverse in
* strict_pwj_cons and non_strict_pwj_cons separately in the order of the base table to avoid this situation:
* Traverse all constraints starting with 0, and set the mapping of [part_array0, part_array1, part_array2] in
* pwj_map; Traverse all the constraints starting with 1, and find that there are no related constraints; To
* traverse all constraints starting with 2, you need to set part_array3 in pwj_map, because part_array2 has been
* set, so The mapping of part_array3 generated by part_array2 does not need to be adjusted Traverse all the
* constraints starting with 3 and find that there are no related constraints
*/
for (int64_t i = 0; OB_SUCC(ret) && i < tbl_count; ++i) {
for (int64_t j = 0; OB_SUCC(ret) && j < strict_cons.count(); ++j) {
const ObPlanPwjConstraint& pwj_cons = strict_cons.at(j);
if (OB_UNLIKELY(pwj_cons.count() <= 1)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected pwj constraint", K(ret), K(pwj_cons));
} else if (pwj_cons.at(0) == i) {
if (OB_FAIL(check_pwj_cons(
pc_ctx, pwj_cons, phy_tbl_infos, pwj_tables, strict_pwj_comparer, pwj_map, is_same))) {
LOG_WARN("failed to check pwj cons", K(ret));
}
}
}
}
}
for (int64_t j = 0; OB_SUCC(ret) && j < non_strict_cons.count(); ++j) {
const ObPlanPwjConstraint& pwj_cons = non_strict_cons.at(j);
if (OB_UNLIKELY(pwj_cons.count() <= 1)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected pwj constraint", K(ret), K(pwj_cons));
} else if (pwj_cons.at(0) == i) {
if (OB_FAIL(check_pwj_cons(
pc_ctx, pwj_cons, phy_tbl_infos, pwj_tables, non_strict_pwj_comparer, pwj_map, is_same))) {
LOG_WARN("failed to check pwj cons", K(ret));
for (int64_t j = 0; OB_SUCC(ret) && j < non_strict_cons.count(); ++j) {
const ObPlanPwjConstraint& pwj_cons = non_strict_cons.at(j);
if (OB_UNLIKELY(pwj_cons.count() <= 1)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unexpected pwj constraint", K(ret), K(pwj_cons));
} else if (pwj_cons.at(0) == i) {
if (OB_FAIL(check_pwj_cons(
pc_ctx, pwj_cons, phy_tbl_infos, pwj_tables, non_strict_pwj_comparer, pwj_map, is_same))) {
LOG_WARN("failed to check pwj cons", K(ret));
}
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册