aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora-romanov <Anton.Romanov@ydb.tech>2023-04-05 20:47:44 +0300
committera-romanov <Anton.Romanov@ydb.tech>2023-04-05 20:47:44 +0300
commitd7c113da5d787bb26c443ffc29ab87d0567fbfdc (patch)
tree43e23a51c334045ac174c715e6b6763be76fd0d6
parent5d16c9eace1f49cd4575bcf6f538d6242b1f48aa (diff)
downloadydb-d7c113da5d787bb26c443ffc29ab87d0567fbfdc.tar.gz
YQL-15832 Hotfix make common sorted constraint over all empty inputs.
-rw-r--r--ydb/library/yql/ast/yql_constraint.cpp44
1 files changed, 21 insertions, 23 deletions
diff --git a/ydb/library/yql/ast/yql_constraint.cpp b/ydb/library/yql/ast/yql_constraint.cpp
index 4ffe62e4b6b..ac248dd7c02 100644
--- a/ydb/library/yql/ast/yql_constraint.cpp
+++ b/ydb/library/yql/ast/yql_constraint.cpp
@@ -340,33 +340,31 @@ const TSortedConstraintNode* TSortedConstraintNode::MakeCommon(const std::vector
std::optional<TContainerType> content;
for (size_t i = 0U; i < constraints.size(); ++i) {
- if (!constraints[i]->GetConstraint<TEmptyConstraintNode>()) {
- if (const auto sort = constraints[i]->GetConstraint<TSortedConstraintNode>()) {
- const auto& nextContent = sort->GetContent();
- if (content) {
- const auto size = std::min(content->size(), nextContent.size());
- content->resize(size);
- for (auto j = 0U; j < size; ++j) {
- auto& one = (*content)[j];
- auto& two = nextContent[j];
- TSetType common;
- common.reserve(std::min(one.first.size(), two.first.size()));
- std::set_intersection(one.first.cbegin(), one.first.cend(), two.first.cbegin(), two.first.cend(), std::back_inserter(common));
- if (common.empty() || one.second != two.second) {
- content->resize(j);
- break;
- } else
- one.first = std::move(common);
- }
- if (content->empty())
+ if (const auto sort = constraints[i]->GetConstraint<TSortedConstraintNode>()) {
+ const auto& nextContent = sort->GetContent();
+ if (content) {
+ const auto size = std::min(content->size(), nextContent.size());
+ content->resize(size);
+ for (auto j = 0U; j < size; ++j) {
+ auto& one = (*content)[j];
+ auto& two = nextContent[j];
+ TSetType common;
+ common.reserve(std::min(one.first.size(), two.first.size()));
+ std::set_intersection(one.first.cbegin(), one.first.cend(), two.first.cbegin(), two.first.cend(), std::back_inserter(common));
+ if (common.empty() || one.second != two.second) {
+ content->resize(j);
break;
- } else {
- content = nextContent;
+ } else
+ one.first = std::move(common);
}
+ if (content->empty())
+ break;
} else {
- content.reset();
- break;
+ content = nextContent;
}
+ } else if (!constraints[i]->GetConstraint<TEmptyConstraintNode>()) {
+ content.reset();
+ break;
}
}