diff options
author | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-09 11:38:23 +0300 |
---|---|---|
committer | a-romanov <Anton.Romanov@ydb.tech> | 2023-10-09 12:22:54 +0300 |
commit | 1376331995d16f9fed16d5c84799d212469e7b7c (patch) | |
tree | e99b532f67eb05d59fb2490b0372029ca9d75cea | |
parent | 1a23ec84d8ea29be4a09a32204202ccdf0fb9802 (diff) | |
download | ydb-1376331995d16f9fed16d5c84799d212469e7b7c.tar.gz |
YQL-16800 +test.
-rw-r--r-- | ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp b/ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp index 273a715f8d..bd5e661a88 100644 --- a/ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp +++ b/ydb/library/yql/core/ut/yql_expr_constraint_ut.cpp @@ -233,6 +233,26 @@ Y_UNIT_TEST_SUITE(TYqlExprConstraints) { CheckConstraint<TSortedConstraintNode>(exprRoot, "OrderedMap", "Sorted(tuple/1[asc];tuple/0[asc];tuple/2[asc])"); } + Y_UNIT_TEST(SortByTupleWithSingleElementAndCopyOfElement) { + const auto s = R"(( + (let mr_sink (DataSink 'yt (quote plato))) + (let list (AsList + (AsStruct '('key (String '4)) '('subkey (String 'c)) '('value '((String 'x)))) + (AsStruct '('key (String '1)) '('subkey (String 'd)) '('value '((String 'y)))) + (AsStruct '('key (String '3)) '('subkey (String 'b)) '('value '((String 'z)))) + )) + (let sorted (Sort list (Bool 'False) (lambda '(item) '((Nth (Member item 'value) '0))))) + (let map (OrderedMap sorted (lambda '(item) (AsStruct '('tuple (Member item 'value)) '('element (Nth (Member item 'value) '0)))))) + (let world (Write! world mr_sink (Key '('table (String 'Output))) map '('('mode 'renew)))) + (let world (Commit! world mr_sink)) + (return world) + ))"; + + TExprContext exprCtx; + const auto exprRoot = ParseAndAnnotate(s, exprCtx); + CheckConstraint<TSortedConstraintNode>(exprRoot, "OrderedMap", "Sorted(element,tuple[desc])"); + } + Y_UNIT_TEST(SortByColumnAndExpr) { const auto s = R"(( (let mr_sink (DataSink 'yt (quote plato))) |