aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/ManyYamrOperations
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-11-20 17:37:57 +0000
committerGitHub <noreply@github.com>2024-11-20 17:37:57 +0000
commitf76323e9b295c15751e51e3443aa47a36bee8023 (patch)
tree4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/s-expressions/suites/ManyYamrOperations
parent753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff)
parenta7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff)
downloadydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'yql/essentials/tests/s-expressions/suites/ManyYamrOperations')
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.cfg6
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.sql181
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.yql192
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt1
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.sql5
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.yql47
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenGroup.yql39
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenSort.yql30
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapCombineMap.yql29
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenExtend.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenGroup.yql32
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenSort.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapWithReadTable.yql53
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenMap.yql26
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenSort.yql24
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/TakeThenMap.yql20
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_1.yql85
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_2.yql86
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/default.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt5
-rw-r--r--yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt.attr30
22 files changed, 936 insertions, 0 deletions
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.cfg b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.cfg
new file mode 100644
index 0000000000..ac8f608e62
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.cfg
@@ -0,0 +1,6 @@
+in hits Bug1465_hits.txt
+out out1 out1.txt
+out out2 out2.txt
+res result.txt
+udf url_udf
+udf python2_udf
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.sql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.sql
new file mode 100644
index 0000000000..f8488fb2e1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.sql
@@ -0,0 +1,181 @@
+USE hahn;
+
+$minus_date = Python::minus_date(
+ @@(String?,String?)->Int64@@,
+ @@
+from datetime import datetime, timedelta
+def minus_date(date1, date2):
+ return (datetime.strptime(date1, "%Y-%m-%d") - datetime.strptime(date2, "%Y-%m-%d")).days
+ @@
+);
+
+$normalize_list = Python::normalize_list(
+ @@(List<Tuple<Int64,Int64?>>)->List<Tuple<Int64,Int64>>@@,
+ @@
+def normalize_list(values):
+ return sorted((x, y) for x, y in values if y)
+ @@
+);
+
+$urls = (
+FROM hits
+SELECT url AS Url, "2016-10-25" AS Date
+GROUP BY url
+);
+
+$flatten_factors = (
+FROM $urls AS target
+INNER JOIN hits AS history
+ON target.Url == history.url
+SELECT
+ target.Url AS Url,
+ target.Date AS Date,
+ history.*
+);
+
+INSERT INTO [Out1] WITH TRUNCATE FROM $flatten_factors SELECT *;
+COMMIT;
+
+$pool = (
+FROM [Out1]
+SELECT
+ Url,
+ Date,
+ Url::GetHost(Url) AS Host
+/* $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_all_total]))) AS metrika_all_total
+/* $normalize_list(LIST(($minus_date(Date, [history.date]), [history.yabro_mobile_unique]))) AS yabro_mobile_unique,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_counter_count]))) AS metrika_counter_count,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_yabro_desktop_total]))) AS metrika_yabro_desktop_total,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_yabro_desktop_unique]))) AS metrika_yabro_desktop_unique,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_all_unique]))) AS metrika_all_unique,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_yabro_mobile_unique]))) AS metrika_yabro_mobile_unique,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.yabro_desktop_total]))) AS yabro_desktop_total,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.yabro_desktop_unique]))) AS yabro_desktop_unique,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.yabro_mobile_total]))) AS yabro_mobile_total,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.metrika_yabro_mobile_total]))) AS metrika_yabro_mobile_total,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.cs_clicks]))) AS cs_clicks,
+ $normalize_list(LIST(($minus_date(Date, [history.date]), [history.cs_shows]))) AS cs_shows*/
+GROUP BY Url, Date
+);
+
+$hosts = (
+FROM $pool
+SELECT Host, "2016-10-25" AS Date
+GROUP BY Host
+);
+
+$host_features = (
+FROM $hosts AS hosts
+LEFT JOIN hits AS all_hits
+ON hosts.Host == Url::GetHost(all_hits.url)
+SELECT
+ hosts.Host AS Host,
+ hosts.Date AS Date,
+/* SUM(all_hits.metrika_all_total) AS metrika_all_total_sum7,
+/* MAX(all_hits.metrika_all_total) AS metrika_all_total_max7,
+-- STDDEV(all_hits.metrika_all_total) AS metrika_all_total_stddev7,
+ MEDIAN(all_hits.metrika_all_total) AS metrika_all_total_median7,
+ PERCENTILE(all_hits.metrika_all_total, 0.25) AS metrika_all_total_25perc7,
+ PERCENTILE(all_hits.metrika_all_total, 0.75) AS metrika_all_total_75perc7,
+ COUNT_IF(all_hits.metrika_all_total > 0) AS metrika_all_total_nonzero7,
+ SUM(all_hits.yabro_mobile_unique) AS yabro_mobile_unique_sum7,
+ MAX(all_hits.yabro_mobile_unique) AS yabro_mobile_unique_max7,
+-- STDDEV(all_hits.yabro_mobile_unique) AS yabro_mobile_unique_stddev7,
+ MEDIAN(all_hits.yabro_mobile_unique) AS yabro_mobile_unique_median7,
+ PERCENTILE(all_hits.yabro_mobile_unique, 0.25) AS yabro_mobile_unique_25perc7,
+ PERCENTILE(all_hits.yabro_mobile_unique, 0.75) AS yabro_mobile_unique_75perc7,
+ COUNT_IF(all_hits.yabro_mobile_unique > 0) AS yabro_mobile_unique_nonzero7,
+ SUM(all_hits.metrika_counter_count) AS metrika_counter_count_sum7,
+ MAX(all_hits.metrika_counter_count) AS metrika_counter_count_max7,
+-- STDDEV(all_hits.metrika_counter_count) AS metrika_counter_count_stddev7,
+ MEDIAN(all_hits.metrika_counter_count) AS metrika_counter_count_median7,
+ PERCENTILE(all_hits.metrika_counter_count, 0.25) AS metrika_counter_count_25perc7,
+ PERCENTILE(all_hits.metrika_counter_count, 0.75) AS metrika_counter_count_75perc7,
+ COUNT_IF(all_hits.metrika_counter_count > 0) AS metrika_counter_count_nonzero7,
+ SUM(all_hits.metrika_yabro_desktop_total) AS metrika_yabro_desktop_total_sum7,
+ MAX(all_hits.metrika_yabro_desktop_total) AS metrika_yabro_desktop_total_max7,
+-- STDDEV(all_hits.metrika_yabro_desktop_total) AS metrika_yabro_desktop_total_stddev7,
+ MEDIAN(all_hits.metrika_yabro_desktop_total) AS metrika_yabro_desktop_total_median7,
+ PERCENTILE(all_hits.metrika_yabro_desktop_total, 0.25) AS metrika_yabro_desktop_total_25perc7,
+ PERCENTILE(all_hits.metrika_yabro_desktop_total, 0.75) AS metrika_yabro_desktop_total_75perc7,
+ COUNT_IF(all_hits.metrika_yabro_desktop_total > 0) AS metrika_yabro_desktop_total_nonzero7,
+ SUM(all_hits.metrika_yabro_desktop_unique) AS metrika_yabro_desktop_unique_sum7,
+ MAX(all_hits.metrika_yabro_desktop_unique) AS metrika_yabro_desktop_unique_max7,
+-- STDDEV(all_hits.metrika_yabro_desktop_unique) AS metrika_yabro_desktop_unique_stddev7,
+ MEDIAN(all_hits.metrika_yabro_desktop_unique) AS metrika_yabro_desktop_unique_median7,
+ PERCENTILE(all_hits.metrika_yabro_desktop_unique, 0.25) AS metrika_yabro_desktop_unique_25perc7,
+ PERCENTILE(all_hits.metrika_yabro_desktop_unique, 0.75) AS metrika_yabro_desktop_unique_75perc7,
+ COUNT_IF(all_hits.metrika_yabro_desktop_unique > 0) AS metrika_yabro_desktop_unique_nonzero7,
+ SUM(all_hits.metrika_all_unique) AS metrika_all_unique_sum7,
+ MAX(all_hits.metrika_all_unique) AS metrika_all_unique_max7,
+-- STDDEV(all_hits.metrika_all_unique) AS metrika_all_unique_stddev7,
+ MEDIAN(all_hits.metrika_all_unique) AS metrika_all_unique_median7,
+ PERCENTILE(all_hits.metrika_all_unique, 0.25) AS metrika_all_unique_25perc7,
+ PERCENTILE(all_hits.metrika_all_unique, 0.75) AS metrika_all_unique_75perc7,
+ COUNT_IF(all_hits.metrika_all_unique > 0) AS metrika_all_unique_nonzero7,
+ SUM(all_hits.metrika_yabro_mobile_unique) AS metrika_yabro_mobile_unique_sum7,
+ MAX(all_hits.metrika_yabro_mobile_unique) AS metrika_yabro_mobile_unique_max7,
+-- STDDEV(all_hits.metrika_yabro_mobile_unique) AS metrika_yabro_mobile_unique_stddev7,
+ MEDIAN(all_hits.metrika_yabro_mobile_unique) AS metrika_yabro_mobile_unique_median7,
+ PERCENTILE(all_hits.metrika_yabro_mobile_unique, 0.25) AS metrika_yabro_mobile_unique_25perc7,
+ PERCENTILE(all_hits.metrika_yabro_mobile_unique, 0.75) AS metrika_yabro_mobile_unique_75perc7,
+ COUNT_IF(all_hits.metrika_yabro_mobile_unique > 0) AS metrika_yabro_mobile_unique_nonzero7,
+ SUM(all_hits.yabro_desktop_total) AS yabro_desktop_total_sum7,
+ MAX(all_hits.yabro_desktop_total) AS yabro_desktop_total_max7,
+-- STDDEV(all_hits.yabro_desktop_total) AS yabro_desktop_total_stddev7,
+ MEDIAN(all_hits.yabro_desktop_total) AS yabro_desktop_total_median7,
+ PERCENTILE(all_hits.yabro_desktop_total, 0.25) AS yabro_desktop_total_25perc7,
+ PERCENTILE(all_hits.yabro_desktop_total, 0.75) AS yabro_desktop_total_75perc7,
+ COUNT_IF(all_hits.yabro_desktop_total > 0) AS yabro_desktop_total_nonzero7,
+ SUM(all_hits.yabro_desktop_unique) AS yabro_desktop_unique_sum7,
+ MAX(all_hits.yabro_desktop_unique) AS yabro_desktop_unique_max7,
+-- STDDEV(all_hits.yabro_desktop_unique) AS yabro_desktop_unique_stddev7,
+ MEDIAN(all_hits.yabro_desktop_unique) AS yabro_desktop_unique_median7,
+ PERCENTILE(all_hits.yabro_desktop_unique, 0.25) AS yabro_desktop_unique_25perc7,
+ PERCENTILE(all_hits.yabro_desktop_unique, 0.75) AS yabro_desktop_unique_75perc7,
+ COUNT_IF(all_hits.yabro_desktop_unique > 0) AS yabro_desktop_unique_nonzero7,
+ SUM(all_hits.yabro_mobile_total) AS yabro_mobile_total_sum7,
+ MAX(all_hits.yabro_mobile_total) AS yabro_mobile_total_max7,
+-- STDDEV(all_hits.yabro_mobile_total) AS yabro_mobile_total_stddev7,
+ MEDIAN(all_hits.yabro_mobile_total) AS yabro_mobile_total_median7,
+ PERCENTILE(all_hits.yabro_mobile_total, 0.25) AS yabro_mobile_total_25perc7,
+ PERCENTILE(all_hits.yabro_mobile_total, 0.75) AS yabro_mobile_total_75perc7,
+ COUNT_IF(all_hits.yabro_mobile_total > 0) AS yabro_mobile_total_nonzero7,
+ SUM(all_hits.metrika_yabro_mobile_total) AS metrika_yabro_mobile_total_sum7,
+ MAX(all_hits.metrika_yabro_mobile_total) AS metrika_yabro_mobile_total_max7,
+-- STDDEV(all_hits.metrika_yabro_mobile_total) AS metrika_yabro_mobile_total_stddev7,
+ MEDIAN(all_hits.metrika_yabro_mobile_total) AS metrika_yabro_mobile_total_median7,
+ PERCENTILE(all_hits.metrika_yabro_mobile_total, 0.25) AS metrika_yabro_mobile_total_25perc7,
+ PERCENTILE(all_hits.metrika_yabro_mobile_total, 0.75) AS metrika_yabro_mobile_total_75perc7,
+ COUNT_IF(all_hits.metrika_yabro_mobile_total > 0) AS metrika_yabro_mobile_total_nonzero7,*/
+ COUNT(*) AS url_day_count,
+ COUNT(DISTINCT(all_hits.url)) AS url_count
+GROUP BY hosts.Host, hosts.Date
+);
+
+INSERT INTO [Out2] WITH TRUNCATE
+FROM $pool AS pool
+LEFT JOIN $host_features AS host
+ON Url::GetHost(pool.Url) == host.Host AND pool.Date == host.Date
+SELECT *;
+/* pool.Date AS Date,
+ pool.yabro_mobile_unique AS yabro_mobile_unique,
+ pool.Url AS Url,
+ pool.cs_clicks AS cs_clicks,
+ pool.cs_shows AS cs_shows,
+ pool.metrika_all_total AS metrika_all_total,
+ pool.metrika_all_unique AS metrika_all_unique,
+ pool.Host AS Host,
+ pool.metrika_yabro_desktop_total AS metrika_yabro_desktop_total,
+ pool.metrika_yabro_desktop_unique AS metrika_yabro_desktop_unique,
+ pool.metrika_yabro_mobile_total AS metrika_yabro_mobile_total,
+ pool.metrika_yabro_mobile_unique AS metrika_yabro_mobile_unique,
+ pool.yabro_desktop_total AS yabro_desktop_total,
+ pool.yabro_desktop_unique AS yabro_desktop_unique,
+ pool.yabro_mobile_total AS yabro_mobile_total,
+ pool.metrika_counter_count AS metrika_counter_count,
+ host.*;*/
+
+COMMIT;
+DROP TABLE [Out1];
+
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.yql
new file mode 100644
index 0000000000..eaa0d95edb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465.yql
@@ -0,0 +1,192 @@
+(
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"hits"))) (Void) '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let values (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core (EquiJoin '((block '(
+ (let select (block '(
+ (let core table0)
+ (let core (block '(
+ (return (Aggregate core '('"url") '()))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"Url" (Member row '"url")))
+ (let res (AddMember res '"Date" (String '"2016-10-25")))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )) '"target") '(table0 '"history") '('Inner '"target" '"history" '('"target" '"Url") '('"history" '"url") '()) '()))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (SelectMembers row '('"history.")))
+ (let res (AddMember res '"Url" (Member row '"target.Url")))
+ (let res (AddMember res '"Date" (Member row '"target.Date")))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"out1"))) values '('('mode 'renew))))
+ (return world)
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let hahn_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world hahn_sink))
+ (return world)
+)))
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"out1"))) '('"Url" '"Date") '()))
+ (let world (Left! x))
+ (let table3 (Right! x))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"hits"))) '('"url") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let values (block '(
+ (let select (block '(
+ (let core (Map (EquiJoin '((Map (block '(
+ (let select (block '(
+ (let core table3)
+ (let core (block '(
+ (return (Aggregate core '('"Date" '"Url") '()))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"Url" (Member row '"Url")))
+ (let res (AddMember res '"Date" (Member row '"Date")))
+ (let res (AddMember res '"Host" ("Apply" ("Udf" '"Url.GetHost") (Member row '"Url"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )) (lambda '(row) (block '(
+ (let row (AddMember row '"_equijoin_column_0" ("Apply" ("Udf" '"Url.GetHost") (Member row '"Url"))))
+ (return row)
+ )))) '"pool") '((block '(
+ (let select (block '(
+ (let core (Map (EquiJoin '((block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table3)
+ (let core (block '(
+ (return (Aggregate core '('"Date" '"Url") '()))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"Url" (Member row '"Url")))
+ (let res (AddMember res '"Date" (Member row '"Date")))
+ (let res (AddMember res '"Host" ("Apply" ("Udf" '"Url.GetHost") (Member row '"Url"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let core (block '(
+ (return (Aggregate core '('"Host") '()))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"Host" (Member row '"Host")))
+ (let res (AddMember res '"Date" (String '"2016-10-25")))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )) '"hosts") '((Map table0 (lambda '(row) (block '(
+ (let row (AddMember row '"_equijoin_column_0" ("Apply" ("Udf" '"Url.GetHost") (Member row '"url"))))
+ (return row)
+ )))) '"all_hits") '('Left '"hosts" '"all_hits" '('"hosts" '"Host") '('"all_hits" '"_equijoin_column_0") '()) '()) (lambda '(row) (block '(
+ (let row (ForceRemoveMember row '"all_hits._equijoin_column_0"))
+ (return row)
+ )))))
+ (let core (block '(
+ (let Count4_create (lambda '(row) (Uint64 '1)))
+ (let Count4_update (lambda '(row state) (OptionalReduce state (Uint64 '1) (lambda '(a b) (+ a b)))))
+ (let Count4_save (lambda '(state) state))
+ (let Count4_load (lambda '(item) item))
+ (let Count4_merge (lambda '(a b) (OptionalReduce a b (lambda '(a b) (+ a b)))))
+ (let Count4_finish (lambda '(state) state))
+ (let Count5_create (lambda '(row) (Convert (Exists row) 'Uint64)))
+ (let Count5_update (lambda '(row state) (OptionalReduce state (Convert (Exists row) 'Uint64) (lambda '(a b) (+ a b)))))
+ (let Count5_save (lambda '(state) state))
+ (let Count5_load (lambda '(item) item))
+ (let Count5_merge (lambda '(a b) (OptionalReduce a b (lambda '(a b) (+ a b)))))
+ (let Count5_finish (lambda '(state) state))
+ (return (Aggregate core '('"hosts.Date" '"hosts.Host") '('('Count4 (AggregationTraits (ListItemType (TypeOf core)) Count4_create Count4_update Count4_save Count4_load Count4_merge Count4_finish (Uint64 '0))) '('Count5 (AggregationTraits (StructMemberType (ListItemType (TypeOf core)) '"all_hits.url") Count5_create Count5_update Count5_save Count5_load Count5_merge Count5_finish (Uint64 '0)) '"all_hits.url"))))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"Host" (Member row '"hosts.Host")))
+ (let res (AddMember res '"Date" (Member row '"hosts.Date")))
+ (let res (AddMember res '"url_day_count" (Member row 'Count4)))
+ (let res (AddMember res '"url_count" (Member row 'Count5)))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )) '"host") '('Left '"pool" '"host" '('"pool" '"_equijoin_column_0" '"pool" '"Date") '('"host" '"Host" '"host" '"Date") '()) '()) (lambda '(row) (block '(
+ (let row (ForceRemoveMember row '"pool._equijoin_column_0"))
+ (return row)
+ )))))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"out2"))) values '('('mode 'renew))))
+ (return world)
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let hahn_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world hahn_sink))
+ (return world)
+)))
+(let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"out1"))) (Void) '('('mode 'drop))))
+ (return world)
+)))
+(let world (block '(
+ (let hahn_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world hahn_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt
new file mode 100644
index 0000000000..d122076744
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt
@@ -0,0 +1 @@
+{"history.date"="20016-01-01";"url"="http://ya.ru"};
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt.attr b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt.attr
new file mode 100644
index 0000000000..56aac6ba29
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1465_hits.txt.attr
@@ -0,0 +1,3 @@
+{
+ "_yql_row_spec"={"Type"=["StructType";[["url";["OptionalType";["DataType";"String"]]];["history.date";["OptionalType";["DataType";"String"]]]]]}
+}
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.sql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.sql
new file mode 100644
index 0000000000..c5ed4796d9
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.sql
@@ -0,0 +1,5 @@
+USE plato;
+
+SELECT sum(count) from (
+select count(*) as count from Input WHERE key < "100"
+);
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.yql
new file mode 100644
index 0000000000..a8908a0100
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/Bug1941.yql
@@ -0,0 +1,47 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (MrTableConcat (Key '('table (String '"Input")))) '('"key") '()))
+ (let world (Left! x))
+ (let table1 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table1)
+ (let core (Filter core (lambda '(row) (Coalesce ("<" (Member row '"key") (String '"100")) (Bool 'false)))))
+ (let core (Just (AsStruct '('Count0 (Length core)))))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"count" (Member row 'Count0))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let core (Aggregate core '() '('('Sum2 (Apply (bind aggregate_module '"sum_traits_factory") (TypeOf core) (lambda '(row) (Member row '"count")))))))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" (Member row 'Sum2))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let world (block '(
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) output '('('type) '('autoref) '('columns '('"column0")))))
+ (return (Commit! world result_sink))
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenGroup.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenGroup.yql
new file mode 100644
index 0000000000..5a39b90887
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenGroup.yql
@@ -0,0 +1,39 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key" '"subkey" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+
+ (let preMap (lambda '(item) (Just item)))
+ (let keyExtractor (lambda '(item) (Member item 'key)))
+ (let init (lambda '(key item) (Member item 'value)))
+ (let update (lambda '(key item state) (Concat state (Member item 'value))))
+ (let finish (lambda '(key state) (block '(
+ (let s (Struct))
+ (let s (AddMember s 'key key))
+ (let s (AddMember s 'subkey (String '.)))
+ (let s (AddMember s 'value state))
+ (return (Just s))
+ ))))
+ (let combine (CombineByKey table0 preMap keyExtractor init update finish))
+
+ (let listHandler (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let list (ForwardList (Nth pair '1)))
+ (let s (Struct))
+ (let s (AddMember s 'key key))
+ (let s (AddMember s 'subkey (String '.)))
+ (let value (Fold1 list
+ (lambda '(item) (Member item 'value))
+ (lambda '(item state) (Concat state (Member item 'value)))
+ ))
+ (let s (AddMember s 'value (Coalesce value (String '""))))
+ (let ret (AsList s))
+ (return ret)
+ ))))))
+ (let reducedTable (PartitionByKey combine keyExtractor (Void) (Void) listHandler))
+ (let mr_sink (DataSink 'yt (quote plato)))
+ (let world (Write! world mr_sink (Key '('table (String 'Output))) reducedTable '('('mode 'append))))
+ (let world (Commit! world mr_sink))
+
+ (return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenSort.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenSort.yql
new file mode 100644
index 0000000000..c9f35934d8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/CombineThenSort.yql
@@ -0,0 +1,30 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key" '"subkey" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+
+ (let map (FlatMap table0 (lambda '(row) (block '(
+ (let key (MatchType (Member row '"key") 'Optional (lambda '(item) (Coalesce (Map item (lambda '(val) (IfType val (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Just (Convert item '"Int64")))))) (Nothing (OptionalType (DataType '"Int64"))))) (lambda '(item) (IfType item (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Convert item '"Int64"))))))
+ (let res (Struct))
+ (let res (AddMember res '"Avg1" '(key (Convert (Exists key) 'Uint64))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (let combine (CombineByKey map (lambda '(row) (Just row)) (lambda '(row) (Uint64 '0)) (lambda '(key row) row) (lambda '(key row state) state) (lambda '(key state) (Just state))))
+ (let result (FlatMap combine (lambda '(row) (block '(
+ (let p0 (Nth (Member row 'Avg1) '0))
+ (let p1 (Nth (Member row 'Avg1) '1))
+ (let res (Struct))
+ (let res (AddMember res '"keyAvg" (
+ FlatMap p0 (lambda '(value) (Just (Coalesce (Div (Convert value 'Double) (Convert p1 'Double)) (Double '0))))
+ )))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (let sortAfterCombine (Sort result (Bool 'false) (lambda '(x) (Member x 'keyAvg) )))
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) sortAfterCombine '('('type) '('autoref))))
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return (Commit! world result_sink))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapCombineMap.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapCombineMap.yql
new file mode 100644
index 0000000000..fd5d2eb0e7
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapCombineMap.yql
@@ -0,0 +1,29 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key" '"subkey" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+
+ (let map (FlatMap table0 (lambda '(row) (block '(
+ (let key (MatchType (Member row '"key") 'Optional (lambda '(item) (Coalesce (Map item (lambda '(val) (IfType val (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Just (Convert item '"Int64")))))) (Nothing (OptionalType (DataType '"Int64"))))) (lambda '(item) (IfType item (DataType 'String) (lambda '(item) (FromString item '"Int64")) (lambda '(item) (Convert item '"Int64"))))))
+ (let res (Struct))
+ (let res (AddMember res '"Avg1" '(key (Convert (Exists key) 'Uint64))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (let combine (CombineByKey map (lambda '(row) (Just row)) (lambda '(row) (Uint64 '0)) (lambda '(key row) row) (lambda '(key row state) state) (lambda '(key state) (Just state))))
+ (let result (FlatMap combine (lambda '(row) (block '(
+ (let p0 (Nth (Member row 'Avg1) '0))
+ (let p1 (Nth (Member row 'Avg1) '1))
+ (let res (Struct))
+ (let res (AddMember res '"keyAvg" (
+ FlatMap p0 (lambda '(value) (Just (Coalesce (Div (Convert value 'Double) (Convert p1 'Double)) (Double '0))))
+ )))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) result '('('type) '('autoref))))
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return (Commit! world result_sink))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenExtend.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenExtend.yql
new file mode 100644
index 0000000000..d8c639d055
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenExtend.yql
@@ -0,0 +1,18 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let table1map (Map table1 (lambda '(item) (block '(
+ (let s (Struct))
+ (let s (AddMember s 'key (Member item 'key)))
+ (let s (AddMember s 'subkey (String '1)))
+ (let s (AddMember s 'value (String 'v)))
+ (return s)
+)))))
+(let mr_sink (DataSink 'yt 'plato))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) (Extend table1map table1map) '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenGroup.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenGroup.yql
new file mode 100644
index 0000000000..6248b7416e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenGroup.yql
@@ -0,0 +1,32 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let tresh (Int32 'x"64000000"))
+(let table1low (FlatMap table1 (lambda '(item) (block '(
+ (let intValueOpt (FromString (Member item 'key) 'Int32))
+ (let ret (FlatMap intValueOpt (lambda '(item2) (block '(
+ (let s (ListIf (< item2 tresh) item))
+ (return s)
+ )))))
+ (return ret)
+)))))
+(let keySelector (lambda '(x) (Member x 'key)))
+(let listHandler (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let list (ForwardList (Nth pair '1)))
+ (let s (Struct))
+ (let s (AddMember s 'key key))
+ (let s (AddMember s 'subkey (String '.)))
+ (let s (AddMember s 'value (ToString (Length list))))
+ (let ret (AsList s))
+ (return ret)
+))))))
+(let reducedTable (PartitionByKey table1low keySelector (Void) (Void) listHandler))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) reducedTable '('('mode 'append))))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenSort.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenSort.yql
new file mode 100644
index 0000000000..fd736cacf2
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapThenSort.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let tresh (Int32 'x"64000000"))
+(let table1low (FlatMap table1 (lambda '(item) (block '(
+ (let intValueOpt (FromString (Member item 'key) 'Int32))
+ (let ret (FlatMap intValueOpt (lambda '(item2) (block '(
+ (let s (ListIf (< item2 tresh) item))
+ (return s)
+ )))))
+ (return ret)
+)))))
+(let table1sorted (Sort table1low (Bool 'true) (lambda '(item) (Member item 'key))))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) table1sorted '('('mode 'append))))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapWithReadTable.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapWithReadTable.yql
new file mode 100644
index 0000000000..c276a9e835
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/MapWithReadTable.yql
@@ -0,0 +1,53 @@
+(
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"key") '()))
+ (let world (Left! x))
+ (let table1 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core table1)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"column0" ("Concat" (Member row '"key") ("Coalesce" (Member (MatchType (block '(
+ (let select (block '(
+ (let core table1)
+ (let core (block '(
+ (let Min0_create (lambda '(row) (Member row '"key")))
+ (let Min0_update (lambda '(row state) (OptionalReduce state (Member row '"key") (lambda '(a b) (Min a b)))))
+ (let Min0_save (lambda '(state) state))
+ (let Min0_load (lambda '(item) item))
+ (let Min0_merge (lambda '(a b) (OptionalReduce a b (lambda '(a b) (Min a b)))))
+ (let Min0_finish (lambda '(state) state))
+ (return (Aggregate core '() '('('Min0 (AggregationTraits (ListItemType (TypeOf core)) Min0_create Min0_update Min0_save Min0_load Min0_merge Min0_finish (Null))))))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"key" (Member row 'Min0)))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )) 'Dict (lambda '(dict) (Lookup dict (Int64 '"0"))) (lambda '(list) (Lookup (ToIndexDict list) (Int64 '"0")))) '"key") (String '"")))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let world (block '(
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) output '('('type) '('autoref) '('columns '('"column0")))))
+ (return (Commit! world result_sink))
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenMap.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenMap.yql
new file mode 100644
index 0000000000..df91ac7aab
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenMap.yql
@@ -0,0 +1,26 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let keySelector (lambda '(x) (Member x 'key)))
+(let listHandler (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let list (ForwardList (Nth pair '1)))
+ (let s (Struct))
+ (let s (AddMember s 'key key))
+ (let s (AddMember s 'subkey (String '.)))
+ (let s (AddMember s 'value (ToString (Length list))))
+ (let ret (AsList s))
+ (return ret)
+))))))
+(let reducedTable (PartitionByKey table1 keySelector (Void) (Void) listHandler))
+(let filterAfterReduce (Filter reducedTable (lambda '(x) (block '(
+ (return (> (Member x 'value) (String '1)))
+)))))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) filterAfterReduce '('('mode 'append))))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenSort.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenSort.yql
new file mode 100644
index 0000000000..420d463be3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/ReduceThenSort.yql
@@ -0,0 +1,24 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let keySelector (lambda '(x) (Member x 'key)))
+(let listHandler (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let list (ForwardList (Nth pair '1)))
+ (let s (Struct))
+ (let s (AddMember s 'key key))
+ (let s (AddMember s 'subkey (String '.)))
+ (let s (AddMember s 'value (Concat (ToString (Length list)) key)))
+ (let ret (AsList s))
+ (return ret)
+))))))
+(let reducedTable (PartitionByKey table1 keySelector (Void) (Void) listHandler))
+(let sortAfterReduce (Sort reducedTable (Bool 'false) (lambda '(x) (Member x 'value) )))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) sortAfterReduce '('('mode 'append))))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/TakeThenMap.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/TakeThenMap.yql
new file mode 100644
index 0000000000..f1dfaf4ca4
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/TakeThenMap.yql
@@ -0,0 +1,20 @@
+(
+#comment
+(let mr_source (DataSource 'yt 'plato))
+(let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let tresh (Int32 'x"64000000"))
+(let table1low (FlatMap (Take table1 (Uint64 '3)) (lambda '(item) (block '(
+ (let intValueOpt (FromString (Member item 'key) 'Int32))
+ (let ret (FlatMap intValueOpt (lambda '(item2) (block '(
+ (let s (ListIf (< item2 tresh) item))
+ (return s)
+ )))))
+ (return ret)
+)))))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) table1low '('('mode 'append))))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_1.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_1.yql
new file mode 100644
index 0000000000..5e6aec09e8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_1.yql
@@ -0,0 +1,85 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (MrTableConcat (Key '('table (String '"Input")))) '('"key" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"key" (Member row '"key")))
+ (let res (AddMember res '"subkey" (String '"")))
+ (let res (AddMember res '"value" ("Concat" (String '"value:") (Member row '"value"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Sort select (Bool 'true) (lambda '(row) (Member row '"key"))))
+ (return select)
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Take select (Int32 '"2")))
+ (return select)
+ )))
+ (let world (block '(
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) output '('('type) '('autoref))))
+ (return (Commit! world result_sink))
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (MrTableConcat (Key '('table (String '"Input")))) '('"key" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let values (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"key" (Member row '"key")))
+ (let res (AddMember res '"subkey" (String '"")))
+ (let res (AddMember res '"value" ("Concat" (String '"value:") (Member row '"value"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Sort select (Bool 'true) (lambda '(row) (Member row '"key"))))
+ (return select)
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (return select)
+ )))
+ (let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"Output"))) values '('('mode 'append))))
+ (return world)
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_2.yql b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_2.yql
new file mode 100644
index 0000000000..6c2634f9ad
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/YQL-1733_2.yql
@@ -0,0 +1,86 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (MrTableConcat (Key '('table (String '"Input")))) '('"key" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"key" (Member row '"key")))
+ (let res (AddMember res '"subkey" (String '"")))
+ (let res (AddMember res '"value" ("Concat" (String '"value:") (Member row '"value"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Sort select (Bool 'true) (lambda '(row) (Member row '"key"))))
+ (return select)
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Take select (Int32 '"2")))
+ (return select)
+ )))
+ (let world (block '(
+ (let result_sink (DataSink 'result))
+ (let world (Write! world result_sink (Key) output '('('type) '('autoref))))
+ (return (Commit! world result_sink))
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (MrTableConcat (Key '('table (String '"Input")))) '('"key" '"value") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let values (block '(
+ (let select (block '(
+ (let core (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"key" (Member row '"key")))
+ (let res (AddMember res '"subkey" (String '"")))
+ (let res (AddMember res '"value" ("Concat" (String '"value:") (Member row '"value"))))
+ (let res (AsList res))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Sort select (Bool 'true) (lambda '(row) (Member row '"key"))))
+ (return select)
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (let select (Take select (Int32 '"3")))
+ (return select)
+ )))
+ (let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"Output"))) values '('('mode 'append))))
+ (return world)
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/default.cfg b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/default.cfg
new file mode 100644
index 0000000000..fe2b19a9ff
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/default.cfg
@@ -0,0 +1,3 @@
+in Input input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt
new file mode 100644
index 0000000000..d77d384ae6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt
@@ -0,0 +1,5 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="075";"subkey"="2";"value"="qqqw"};
+{"key"="800";"subkey"="3";"value"="ddd"};
+{"key"="020";"subkey"="4";"value"="q"};
+{"key"="150";"subkey"="5";"value"="qzz"};
diff --git a/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt.attr b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/ManyYamrOperations/input.txt.attr
@@ -0,0 +1,30 @@
+{
+ "_yql_row_spec" = {
+ "Type" = [
+ "StructType";
+ [
+ [
+ "key";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "subkey";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "value";
+ [
+ "DataType";
+ "String"
+ ]
+ ]
+ ]
+ ]
+ }
+} \ No newline at end of file