diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2022-12-05 17:07:43 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2022-12-05 17:07:43 +0300 |
commit | 2bcafecb6458e7aa1ae930599f061cc01e3ba59b (patch) | |
tree | 8cf53549474d134e79a8a9d1c0315fc8f5543b4b | |
parent | e962cf51046a42137a0c3177ea395e2c7d502be2 (diff) | |
download | ydb-2bcafecb6458e7aa1ae930599f061cc01e3ba59b.tar.gz |
fix.
-rw-r--r-- | ydb/library/yql/core/common_opt/yql_co_simple1.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp index 619f0696447..d2bbe59db5e 100644 --- a/ydb/library/yql/core/common_opt/yql_co_simple1.cpp +++ b/ydb/library/yql/core/common_opt/yql_co_simple1.cpp @@ -135,18 +135,17 @@ TExprNode::TPtr KeepSortedConstraint(TExprNode::TPtr node, const TSortedConstrai TExprNode::TPtr KeepConstraints(TExprNode::TPtr node, const TExprNode& src, TExprContext& ctx) { auto res = KeepSortedConstraint(node, src.GetConstraint<TSortedConstraintNode>(), ctx); if (const auto uniq = src.GetConstraint<TUniqueConstraintNode>()) { - for (const auto& set : uniq->GetAllSets()) { + TExprNode::TListType columns; + for (const auto& set : uniq->GetAllSets()) + for (const auto& path : set) + if (!path.empty()) + columns.emplace_back(ctx.NewAtom(node->Pos(), path.front())); + if (!columns.empty()) { // TODO: AssumeUnique must support any set of columns. res = ctx.Builder(node->Pos()) .Callable("AssumeUnique") .Add(0, std::move(res)) .List(1) - .Do([&](TExprNodeBuilder& parent) -> TExprNodeBuilder& { - size_t index = 0; - for (const auto& path : set) { - parent.Atom(index++, path.front()); - } - return parent; - }) + .Add(std::move(columns)) .Seal() .Seal() .Build(); |