fix partition wise calculate error

This commit is contained in:
ChangerR
2023-06-27 06:12:49 +00:00
committed by ob-robot
parent aa56c530cf
commit 4085b6c0c6

View File

@ -221,31 +221,24 @@ int ObShardingInfo::is_join_key_cover_partition_key(const EqualSets &equal_sets,
} else if (!is_compatible) { } else if (!is_compatible) {
/* do nothing */ /* do nothing */
} else { } else {
uint64_t first_masks = 0; is_cover = true;
uint64_t second_masks = 0; for (int64_t i = 0; OB_SUCC(ret) && is_cover && i < first_part_keys.count(); i++) {
uint64_t expected_masks = std::pow(2, first_part_keys.count()) - 1;
for (int64_t i = 0; OB_SUCC(ret) && i < first_part_keys.count(); i++) {
for (int64_t j = 0; OB_SUCC(ret) && j < second_part_keys.count(); j++) {
bool is_equal = false; bool is_equal = false;
for(int64_t k = 0; OB_SUCC(ret) && !is_equal && k < first_keys.count(); k++) { for(int64_t j = 0; OB_SUCC(ret) && !is_equal && j < first_keys.count(); j++) {
if (OB_FAIL(is_expr_equivalent(equal_sets, if (OB_FAIL(is_expr_equivalent(equal_sets,
first_part_keys.at(i), first_part_keys.at(i),
second_part_keys.at(j), second_part_keys.at(i),
first_keys.at(k), first_keys.at(j),
second_keys.at(k), second_keys.at(j),
is_equal))) { is_equal))) {
LOG_WARN("failed to check expr equivalent", K(ret)); LOG_WARN("failed to check expr equivalent", K(ret));
} else if (is_equal) { } else { /*do nothing*/ }
first_masks += 1 << i;
second_masks += 1 << j;
} }
if (OB_SUCC(ret) && !is_equal) {
is_cover = false;
} }
} }
} }
if (OB_SUCC(ret)) {
is_cover = (first_masks == expected_masks) && (second_masks == expected_masks);
}
}
return ret; return ret;
} }