aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Scheme
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-11-20 11:14:58 +0000
commit31773f157bf8164364649b5f470f52dece0a4317 (patch)
tree33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /yql/essentials/tests/s-expressions/suites/Scheme
parent2c7938962d8689e175574fc1e817c05049f27905 (diff)
parenteff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff)
downloadydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'yql/essentials/tests/s-expressions/suites/Scheme')
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/Bug635.yql46
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.cfg1
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.yql4
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.yql6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.yql6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.yql6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FieldNames.yql32
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/FieldNamesAndTypes.yql20
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.cfg1
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt.attr34
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.yql7
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt.attr8
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt.attr8
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt.attr8
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt.attr9
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt.attr9
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.cfg1
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.yql7
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/MapDict.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/MapDict.yql20
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.yql19
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.yql5
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.yql23
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.yql23
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValueAndMap.yql41
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.yql33
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.yql17
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortInts.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortTuples.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.yql33
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.yql33
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WriteNumbers.yql15
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.cfg4
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.yql27
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/default.cfg3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt.attr30
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/dict.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/dict.txt.attr27
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt7
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt.attr30
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/empty.txt0
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/empty.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt1
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt.attr30
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/input.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/input.txt.attr30
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt4
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt.attr3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt6
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt.attr30
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt.attr14
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt3
-rw-r--r--yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt.attr13
110 files changed, 1159 insertions, 0 deletions
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/Bug635.yql b/yql/essentials/tests/s-expressions/suites/Scheme/Bug635.yql
new file mode 100644
index 0000000000..d2aee30dd8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/Bug635.yql
@@ -0,0 +1,46 @@
+(
+(let world (block '(
+ (let values (block '(
+ (let values (Struct))
+ (let values (AddMember values '"key" ("Just" (Cast ("Minus" (Int64 '"1")) 'Int32))))
+ (let values (AddMember values '"x" (String '"2")))
+ (return (AsList values))
+ )))
+ (let world (block '(
+ (let sink (DataSink '"yt" '"plato"))
+ (let world (Write! world sink (Key '('table (String '"Output"))) values '('('mode 'append))))
+ (return (Commit! world sink))
+ )))
+ (return world)
+)))
+(let world (block '(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Output"))) '('"key") '()))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (block '(
+ (return (Aggregate core '('"key") '()))
+ )))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res '"column0" ("ToString" ("Coalesce" (Member row '"key") (Int64 '"34")))))
+ (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")))))
+ (let plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return (Commit! world result_sink))
+ )))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.cfg
new file mode 100644
index 0000000000..ed153c6223
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.cfg
@@ -0,0 +1 @@
+out Output empty.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.yql
new file mode 100644
index 0000000000..6c9fb4ca13
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/DropEmpty.yql
@@ -0,0 +1,4 @@
+(
+ (let world (Write! world (DataSink '"yt" '"plato") (Key '('table (String '"Output"))) (Void) '('('mode 'drop))))
+ (return (Commit! world (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.cfg
new file mode 100644
index 0000000000..2047856002
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.cfg
@@ -0,0 +1,2 @@
+xfail
+in Input empty_row.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.yql b/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.yql
new file mode 100644
index 0000000000..2080bede74
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailInferEmptyRow.yql
@@ -0,0 +1,6 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '('('infer_scheme))))
+ (let result (DataSink 'result))
+ (let world (Write! (Left! x) result (Key) (FlatMap (Right! x) (lambda '(item) (AsList item))) '('('type) '('autoref))))
+ (return (Commit! (Commit! world result) (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.cfg
new file mode 100644
index 0000000000..3091572fb8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.cfg
@@ -0,0 +1,2 @@
+xfail
+in Input empty.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.yql
new file mode 100644
index 0000000000..921334c2cb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadEmpty.yql
@@ -0,0 +1,6 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '()))
+ (let result (DataSink 'result))
+ (let world (Write! (Left! x) result (Key) (FlatMap (Right! x) (lambda '(item) (AsList item))) '('('type) '('autoref))))
+ (return (Commit! (Commit! world result) (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.cfg
new file mode 100644
index 0000000000..1e9928289c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.cfg
@@ -0,0 +1,2 @@
+xfail
+in Input no_scheme.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.yql b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.yql
new file mode 100644
index 0000000000..921334c2cb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FailReadWithoutScheme.yql
@@ -0,0 +1,6 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '()))
+ (let result (DataSink 'result))
+ (let world (Write! (Left! x) result (Key) (FlatMap (Right! x) (lambda '(item) (AsList item))) '('('type) '('autoref))))
+ (return (Commit! (Commit! world result) (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FieldNames.yql b/yql/essentials/tests/s-expressions/suites/Scheme/FieldNames.yql
new file mode 100644
index 0000000000..ab951ab11b
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FieldNames.yql
@@ -0,0 +1,32 @@
+(
+# read data from Input table
+(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))
+
+# filter keys less than 100
+(let tresh (Int32 '100))
+(let table1low (Map table1 (lambda '(item) (block '(
+ (let val (Struct))
+ (let val (AddMember val 'foo (Member item 'key)))
+ (let val (AddMember val 'bar (Member item 'value)))
+ (let ret (Struct))
+ (let ret (AddMember ret 'key (Member item 'value)))
+ (let ret (AddMember ret 'subkey (String '"")))
+ (let ret (AddMember ret 'value val))
+ (return ret)
+)))))
+
+# write table1low to result sink
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink
+ (Key)
+ table1low '()))
+
+# finish
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/FieldNamesAndTypes.yql b/yql/essentials/tests/s-expressions/suites/Scheme/FieldNamesAndTypes.yql
new file mode 100644
index 0000000000..9db3af4c99
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/FieldNamesAndTypes.yql
@@ -0,0 +1,20 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (FlatMap input (lambda '(item) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'foo (Member item 'key)))
+ (let res (AddMember res 'bar (Member item 'subkey)))
+ (return (AsList res))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
+
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.cfg
new file mode 100644
index 0000000000..b156037a24
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.cfg
@@ -0,0 +1 @@
+in Input ForceInferPragma.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt
new file mode 100644
index 0000000000..4f5501a315
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt
@@ -0,0 +1,2 @@
+{"key"="023";"subkey"="3";"value"="aaa"};
+{"key"="037";"subkey"="5";"value"=1};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt.attr
new file mode 100644
index 0000000000..376c9c6bf6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.txt.attr
@@ -0,0 +1,34 @@
+{
+ "_yql_row_spec" = {
+ "Type" = [
+ "StructType";
+ [
+ [
+ "key";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "subkey";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "value1";
+ [
+ "DataType";
+ "String"
+ ]
+ ]
+ ]
+ ]
+ };
+ "schema"=<"strict" = %false> [
+ {"type"="string"; "name"="key"};
+ {"type"="string"; "name"="subkey"};
+ ]
+} \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.yql b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.yql
new file mode 100644
index 0000000000..33f40d279a
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferPragma.yql
@@ -0,0 +1,7 @@
+(
+ (let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"forceinferschema" '"2"))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '()))
+ (let result (DataSink 'result))
+ (let world (Write! (Left! x) result (Key) (Right! x) '('('type) '('autoref))))
+ (return (Commit! (Commit! world result) (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.cfg
new file mode 100644
index 0000000000..02f8cd81f4
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.cfg
@@ -0,0 +1,2 @@
+in Input ForceInferSchemaSort.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt
new file mode 100644
index 0000000000..1e61934b94
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; "c"="c1"};
+{"a"="a"; "b"="b"; "c"="c2"};
+{"a"="a"; "b"="b"; "c"="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt.attr
new file mode 100644
index 0000000000..35c55ae0f6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.txt.attr
@@ -0,0 +1,8 @@
+{
+ "schema"=<"strict" = %true; "unique_keys" = %true>
+ [
+ {"type"="string"; "name"="a"; "sort_order"="ascending"};
+ {"type"="string"; "name"="b"; "sort_order"="ascending"};
+ {"type"="string"; "name"="c"; "sort_order"="ascending"}
+ ]
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.yql b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.yql
new file mode 100644
index 0000000000..3ef24c07f7
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSort.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"forceinferschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.cfg
new file mode 100644
index 0000000000..a02e32d085
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.cfg
@@ -0,0 +1,2 @@
+in Input ForceInferSchemaSortNullPrefix.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt
new file mode 100644
index 0000000000..01081ba8ce
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt
@@ -0,0 +1,3 @@
+{"a"=#; "b"=#; "c"="c1"};
+{"a"="a"; "b"="b"; "c"="c2"};
+{"a"="a"; "b"="b"; "c"="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt.attr
new file mode 100644
index 0000000000..35c55ae0f6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.txt.attr
@@ -0,0 +1,8 @@
+{
+ "schema"=<"strict" = %true; "unique_keys" = %true>
+ [
+ {"type"="string"; "name"="a"; "sort_order"="ascending"};
+ {"type"="string"; "name"="b"; "sort_order"="ascending"};
+ {"type"="string"; "name"="c"; "sort_order"="ascending"}
+ ]
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.yql b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.yql
new file mode 100644
index 0000000000..3ef24c07f7
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullPrefix.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"forceinferschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.cfg
new file mode 100644
index 0000000000..a956100087
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.cfg
@@ -0,0 +1,2 @@
+in Input ForceInferSchemaSortNullSuffix.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt
new file mode 100644
index 0000000000..449b660552
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; "c"=#};
+{"a"="a"; "b"="b"; "c"="c2"};
+{"a"="a"; "b"="b"; "c"="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt.attr
new file mode 100644
index 0000000000..35c55ae0f6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.txt.attr
@@ -0,0 +1,8 @@
+{
+ "schema"=<"strict" = %true; "unique_keys" = %true>
+ [
+ {"type"="string"; "name"="a"; "sort_order"="ascending"};
+ {"type"="string"; "name"="b"; "sort_order"="ascending"};
+ {"type"="string"; "name"="c"; "sort_order"="ascending"}
+ ]
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.yql b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.yql
new file mode 100644
index 0000000000..3ef24c07f7
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/ForceInferSchemaSortNullSuffix.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"forceinferschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.cfg
new file mode 100644
index 0000000000..f11401b640
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.cfg
@@ -0,0 +1,2 @@
+in Input IgnoreWeakSchemaOnWeak.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.yql b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.yql
new file mode 100644
index 0000000000..aaf61a9163
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaForceInfer.yql
@@ -0,0 +1,18 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"ignoreweakschema" '""))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"forceinferschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.cfg
new file mode 100644
index 0000000000..f11401b640
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.cfg
@@ -0,0 +1,2 @@
+in Input IgnoreWeakSchemaOnWeak.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.yql b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.yql
new file mode 100644
index 0000000000..85f3775676
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaInfer.yql
@@ -0,0 +1,18 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"ignoreweakschema" '""))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"inferschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.cfg
new file mode 100644
index 0000000000..1b9a911d74
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.cfg
@@ -0,0 +1,2 @@
+in Input IgnoreWeakSchemaOnStrong.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt
new file mode 100644
index 0000000000..1e61934b94
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; "c"="c1"};
+{"a"="a"; "b"="b"; "c"="c2"};
+{"a"="a"; "b"="b"; "c"="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt.attr
new file mode 100644
index 0000000000..c78fe74feb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.txt.attr
@@ -0,0 +1,9 @@
+{
+ "schema"=<"strict" = %false; "unique_keys" = %false>
+ [
+ {"type"="any"; "name"="a"; "sort_order"="ascending"};
+ {"type"="any"; "name"="b"; "sort_order"="ascending"};
+ {"type"="any"; "name"="c"; "sort_order"="ascending"}
+ ];
+ "schema_mode"="strong"
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.yql b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.yql
new file mode 100644
index 0000000000..40addc79c3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnStrong.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"ignoreweakschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.cfg
new file mode 100644
index 0000000000..0c64f31555
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.cfg
@@ -0,0 +1,2 @@
+in Input IgnoreWeakSchemaOnWeak.txt
+xfail
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt
new file mode 100644
index 0000000000..1e61934b94
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; "c"="c1"};
+{"a"="a"; "b"="b"; "c"="c2"};
+{"a"="a"; "b"="b"; "c"="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt.attr
new file mode 100644
index 0000000000..1574638558
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.txt.attr
@@ -0,0 +1,9 @@
+{
+ "schema"=<"strict" = %false; "unique_keys" = %false>
+ [
+ {"type"="any"; "name"="a"; "sort_order"="ascending"};
+ {"type"="any"; "name"="b"; "sort_order"="ascending"};
+ {"type"="any"; "name"="c"; "sort_order"="ascending"}
+ ];
+ "schema_mode"="weak"
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.yql b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.yql
new file mode 100644
index 0000000000..40addc79c3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/IgnoreWeakSchemaOnWeak.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"ignoreweakschema" '""))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.cfg
new file mode 100644
index 0000000000..cfe28950fc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.cfg
@@ -0,0 +1 @@
+in Input InferPragma.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt
new file mode 100644
index 0000000000..4f5501a315
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt
@@ -0,0 +1,2 @@
+{"key"="023";"subkey"="3";"value"="aaa"};
+{"key"="037";"subkey"="5";"value"=1};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt.attr
new file mode 100644
index 0000000000..3c0f7e55c1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.txt.attr
@@ -0,0 +1,3 @@
+{
+ "infer_schema" = %true
+} \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.yql b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.yql
new file mode 100644
index 0000000000..cd6fe7c84c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/InferPragma.yql
@@ -0,0 +1,7 @@
+(
+ (let world (Configure! world (DataSource '"yt" '"$all") '"Attr" '"inferschema" '"2"))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '()))
+ (let result (DataSink 'result))
+ (let world (Write! (Left! x) result (Key) (Right! x) '('('type) '('autoref))))
+ (return (Commit! (Commit! world result) (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.cfg
new file mode 100644
index 0000000000..5f5d93efe2
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.cfg
@@ -0,0 +1,3 @@
+in Input dict.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.yql b/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.yql
new file mode 100644
index 0000000000..c04cb6b397
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/MapDict.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 table1low (Map table1 (lambda '(item) (block '(
+ (let s (Struct))
+ (let s (AddMember s 'key (Member item 'key)))
+ (let s (AddMember s 'subkey (Member item 'subkey)))
+ (let keys (DictKeys (Member item 'value)))
+ (let keys (Sort keys (Bool 'True) (lambda '(x) x)))
+ (let s (AddMember s 'value keys))
+ (return s)
+)))))
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) table1low '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.cfg
new file mode 100644
index 0000000000..42f62f4dfb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.cfg
@@ -0,0 +1,3 @@
+in Input non_ksv_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.yql b/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.yql
new file mode 100644
index 0000000000..cc664b337a
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/NonKsvSortByKeyDesc.yql
@@ -0,0 +1,19 @@
+(
+(let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) '('"age" '"name") '()))
+(let data (lambda '(item) (block '(
+ (let s (Struct))
+ (let s (AddMember s '"age" (Cast (Member item '"age") 'Uint64)))
+ (let s (AddMember s '"name" (Member item '"name")))
+ (return (AsList s))
+))))
+(let data (FlatMap (Right! x) data))
+(let key (lambda '(item) (block '(
+ (let age (Member item '"age"))
+ (let name (Member item '"name"))
+ (return '(age name))
+))))
+(let res (Sort data '((Bool 'false) (Bool 'false)) key))
+(let mr_sink (DataSink '"yt" '"plato"))
+(let res (Write! (Left! x) mr_sink (Key '('table (String '"Output"))) res '('('mode 'append))))
+(return (Commit! res mr_sink))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.cfg
new file mode 100644
index 0000000000..bad9ad9043
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.cfg
@@ -0,0 +1,2 @@
+in Input input.txt
+out Output empty.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.yql
new file mode 100644
index 0000000000..ad8e17ad01
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/OverrideEmpty.yql
@@ -0,0 +1,5 @@
+(
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (String '"Input"))) (Void) '()))
+ (let world (Write! (Left! x) (DataSink '"yt" '"plato") (Key '('table (String '"Output"))) (FlatMap (Right! x) (lambda '(item) (AsList item))) '('('mode 'renew))))
+ (return (Commit! world (DataSink '"yt" '"plato")))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.cfg
new file mode 100644
index 0000000000..4f895b9823
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.cfg
@@ -0,0 +1,2 @@
+in Input group_by_tuple_input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.yql b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.yql
new file mode 100644
index 0000000000..5b0236af0c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByTuple.yql
@@ -0,0 +1,23 @@
+(
+#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 table (Right! x))
+(let keySelector (lambda '(x) '((Member x 'value) (Member x 'subkey))))
+(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 (Nth key '0)))
+ (let s (AddMember s 'subkey (Nth key '1)))
+ (let s (AddMember s 'value (ToString (Length list))))
+ (let ret (AsList s))
+ (return ret)
+))))))
+(let result (PartitionByKey table keySelector (Void) (Void) listHandler))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) result '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.cfg
new file mode 100644
index 0000000000..ad52c79527
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.cfg
@@ -0,0 +1,2 @@
+in Input input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.yql b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.yql
new file mode 100644
index 0000000000..b6bb863891
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValue.yql
@@ -0,0 +1,23 @@
+(
+#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 'value)))
+(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 mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) reducedTable '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValueAndMap.yql b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValueAndMap.yql
new file mode 100644
index 0000000000..bc7222e7e1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionByValueAndMap.yql
@@ -0,0 +1,41 @@
+(
+(let x (Read! world (DataSource 'yt 'plato) (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let yt.plato.Input (Right! x))
+(let select@0:0_input yt.plato.Input)
+(let output (block '(
+ (let select@0:0_output (Map select@0:0_input (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'foo (Member row 'value)))
+ (let res (AddMember res 'bar (Member row 'key)))
+ (return res)
+)
+))))
+ (let select@0:0_output (PartitionByKey select@0:0_output (lambda '(row) (block '(
+ (let res (Member row 'foo))
+ (return res)
+)
+)) (Void) (Void) (lambda '(stream) (FlatMap stream (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let group (Collect (Nth pair '1)))
+ (let res (FlatMap group (lambda '(row) (block '(
+ (let res (Struct))
+ (let res (AddMember res 'subkey (ToString (Length group))))
+ (let res (AddMember res 'value (Member row 'bar)))
+ (let res (AddMember res 'key (Member row 'foo)))
+ (let res (AsList res))
+ (return res)
+)
+))))
+ (return res)
+)))))
+))
+ (return select@0:0_output)
+)
+))
+(let output (Sort output (Bool 'true) (lambda '(x) (Concat (Member x 'subkey) (Member x 'value)))))
+(let sink (DataSink 'result))
+(let world (Write! world sink (Key) output '()))
+(let world (Commit! world sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.cfg
new file mode 100644
index 0000000000..4f895b9823
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.cfg
@@ -0,0 +1,2 @@
+in Input group_by_tuple_input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.yql b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.yql
new file mode 100644
index 0000000000..acd5dca2d2
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByTuple.yql
@@ -0,0 +1,13 @@
+(
+#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 table (Right! x))
+(let keySelector (lambda '(x) '((Member x 'value) (Member x 'subkey))))
+(let result (PartitionsByKeys table keySelector (Void) (Void) (lambda '(x) x)))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) result '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.cfg
new file mode 100644
index 0000000000..ad52c79527
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.cfg
@@ -0,0 +1,2 @@
+in Input input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.yql b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.yql
new file mode 100644
index 0000000000..227eeaa709
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/PartitionsByValue.yql
@@ -0,0 +1,13 @@
+(
+#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 'value)))
+(let reducedTable (PartitionsByKeys table1 keySelector (Void) (Void) (lambda '(x) x)))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) reducedTable '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.cfg
new file mode 100644
index 0000000000..effc27a938
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.cfg
@@ -0,0 +1,3 @@
+xfail
+in Input1 empty.txt
+in Input2 input.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.yql
new file mode 100644
index 0000000000..954ed3d61f
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/RangeFailEmpty.yql
@@ -0,0 +1,33 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let filter (lambda '(name) (And (>= name (String '"Input1")) (<= name (String '"Input2")))))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (MrTableRangeStrict '"" filter))) (Void) '('('infer_scheme))))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (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 plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.cfg
new file mode 100644
index 0000000000..f3b77c80df
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.cfg
@@ -0,0 +1,3 @@
+in Input sort_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.yql
new file mode 100644
index 0000000000..6c106597e1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortAndTake.yql
@@ -0,0 +1,17 @@
+# do not check tmp here (YQL-130, YQL-131)
+(
+(let x (Read! world (DataSource 'yt 'plato) (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+(let world (Left! x))
+(let yt.plato.Input (Right! x))
+(let input yt.plato.Input)
+(let output (Sort input (Bool 'true) (lambda '(row) (block '(
+ (let res (Member row 'value))
+ (return res)
+)
+))))
+(let output (Take output (Uint64 '5)))
+(let sink (DataSink 'result))
+(let world (Write! world sink (Key) output '()))
+(let world (Commit! world sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.cfg
new file mode 100644
index 0000000000..f3b77c80df
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.cfg
@@ -0,0 +1,3 @@
+in Input sort_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.yql
new file mode 100644
index 0000000000..01624bc527
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByDouble.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input (Bool 'true) (lambda '(item) (block '(
+ (return (/ (FromString (Member item 'key) 'Double) (FromString (Member item 'subkey) 'Double)))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.cfg
new file mode 100644
index 0000000000..c9fc780575
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.cfg
@@ -0,0 +1,3 @@
+in Input desc_sort_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.yql
new file mode 100644
index 0000000000..6b98c46713
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByKeyDesc.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input (Bool 'false) (lambda '(item) (block '(
+ (return (Member item 'key))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.cfg
new file mode 100644
index 0000000000..f3b77c80df
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.cfg
@@ -0,0 +1,3 @@
+in Input sort_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.yql
new file mode 100644
index 0000000000..3d74c7388a
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortByValue.yql
@@ -0,0 +1,17 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input (Bool 'true) (lambda '(item) (block '(
+ (return (Member item 'value))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
+
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.cfg
new file mode 100644
index 0000000000..d1e6db2a43
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.cfg
@@ -0,0 +1,3 @@
+in Input doubles_input.txt
+out Output output.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.yql
new file mode 100644
index 0000000000..6508146c9e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortDoubles.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input (Bool 'true) (lambda '(item) (block '(
+ (return (Coalesce (FromString (Member item 'key) 'Double) (Double '0)))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortInts.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortInts.yql
new file mode 100644
index 0000000000..a2266c98de
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortInts.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input (Bool 'true) (lambda '(item) (block '(
+ (return (Coalesce (FromString (Member item 'subkey) 'Uint64) (Uint64 '0)))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortTuples.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuples.yql
new file mode 100644
index 0000000000..0275b2d11d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuples.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input '((Bool 'true) (Bool 'true)) (lambda '(item) (block '(
+ (return '((Member item 'value) (Member item 'subkey)))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'result))
+(let world (Write! world mr_sink (Key) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.cfg
new file mode 100644
index 0000000000..ad52c79527
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.cfg
@@ -0,0 +1,2 @@
+in Input input.txt
+out Output output.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.yql b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.yql
new file mode 100644
index 0000000000..05e9777d03
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/SortTuplesAndWrite.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+(let data (block '(
+ (let x (Read! world mr_source (Key '('table (String 'Input))) '('key 'subkey 'value) '()))
+ (let world (Left! x))
+ (let input (Right! x))
+ (let output (Sort input '((Bool 'true) (Bool 'true)) (lambda '(item) (block '(
+ (return '((Member item 'value) (Member item 'subkey)))
+ )))))
+ (return output)
+)))
+(let mr_sink (DataSink 'yt (quote plato)))
+(let world (Write! world mr_sink (Key '('table (String 'Output))) data '()))
+(let world (Commit! world mr_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.cfg
new file mode 100644
index 0000000000..590d6de49e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.cfg
@@ -0,0 +1,2 @@
+in Input unique_keys.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.yql b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.yql
new file mode 100644
index 0000000000..c65fa8f8ac
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeys.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.cfg
new file mode 100644
index 0000000000..5318593448
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.cfg
@@ -0,0 +1,2 @@
+in Input unique_keys_strip.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.yql b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.yql
new file mode 100644
index 0000000000..c65fa8f8ac
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/UniqueKeysStrip.yql
@@ -0,0 +1,16 @@
+(
+(let mr_source (DataSource 'yt 'plato))
+
+(let x (Read! world mr_source
+ (Key '('tablescheme (String 'Input)))
+ (Void) '()
+))
+
+(let world (Left! x))
+(let scheme (Right! x))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) scheme '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.cfg
new file mode 100644
index 0000000000..e39613226c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.cfg
@@ -0,0 +1,3 @@
+in Input1 empty.txt
+in Input2 empty.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.yql
new file mode 100644
index 0000000000..b27b58aa03
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeOnlyEmpty.yql
@@ -0,0 +1,33 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let filter (lambda '(name) (And (>= name (String '"Input1")) (<= name (String '"Input2")))))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (MrTableRange '"" filter))) (Void) '('('infer_scheme))))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (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 plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.cfg
new file mode 100644
index 0000000000..abafdbeb96
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.cfg
@@ -0,0 +1,3 @@
+in Input1 empty.txt
+in Input2 input.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.yql b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.yql
new file mode 100644
index 0000000000..b27b58aa03
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WeakRangeSkipEmpty.yql
@@ -0,0 +1,33 @@
+(
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(let world (block '(
+ (let filter (lambda '(name) (And (>= name (String '"Input1")) (<= name (String '"Input2")))))
+ (let x (Read! world (DataSource '"yt" '"plato") (Key '('table (MrTableRange '"" filter))) (Void) '('('infer_scheme))))
+ (let world (Left! x))
+ (let table0 (Right! x))
+ (let output (block '(
+ (let select (block '(
+ (let core table0)
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsList row))
+ (return res)
+ )))))
+ (return core)
+ )))
+ (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 plato_sink (DataSink '"yt" '"plato"))
+ (let world (Commit! world plato_sink))
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WriteNumbers.yql b/yql/essentials/tests/s-expressions/suites/Scheme/WriteNumbers.yql
new file mode 100644
index 0000000000..d9bfcea077
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WriteNumbers.yql
@@ -0,0 +1,15 @@
+(
+(let output5 (block '(
+ (let row (Struct))
+ (let row (AddMember row 'x (Int64 '1)))
+ (let row (AddMember row 'y (Int64 '2)))
+ (let row (AddMember row 'z (Int64 '3)))
+ (let insert1_output (AsList row))
+ (return insert1_output)
+)
+))
+(let sink (DataSink 'yt 'plato))
+(let world (Write! world sink (Key '('table (String 'Output))) output5 '('('mode 'append))))
+(let world (Commit! world sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.cfg
new file mode 100644
index 0000000000..d611f0155e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.cfg
@@ -0,0 +1,4 @@
+in Input input.txt
+out Output output.txt
+out Output2 output2.txt
+res result.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.yql b/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.yql
new file mode 100644
index 0000000000..7af6edc4ca
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/WriteStructThenCopyOneField.yql
@@ -0,0 +1,27 @@
+(
+(let output1 (block '(
+ (let row (Struct))
+ (let row (AddMember row 'x (String 'abc)))
+ (let row (AddMember row 'y (Int32 '2)))
+ (let row (AddMember row 'z (Int64 '3)))
+ (let insert1_output (AsList row))
+ (return insert1_output)
+)
+))
+(let sink (DataSink 'yt 'plato))
+(let world (Write! world sink (Key '('table (String 'Output))) output1 '('('mode 'append))))
+(let world (Commit! world sink))
+(let source (DataSource 'yt 'plato))
+(let x (Read! world source (Key '('table (String 'Output))) '('y) '()))
+(let world (Left! x))
+(let table1 (Right! x))
+(let world (Write! world sink (Key '('table (String 'Output2))) table1 '('('mode 'append))))
+(let world (Commit! world sink))
+(let x (Read! world source (Key '('table (String 'Output2))) (Void) '()))
+(let world (Left! x))
+(let table2 (Right! x))
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) table2 '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/default.cfg b/yql/essentials/tests/s-expressions/suites/Scheme/default.cfg
new file mode 100644
index 0000000000..fe2b19a9ff
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/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/Scheme/desc_sort_input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt
new file mode 100644
index 0000000000..48706ed4c9
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt
@@ -0,0 +1,6 @@
+{"key"="abc";"subkey"="1";"value"="075"};
+{"key"="ddd";"subkey"="2";"value"="800"};
+{"key"="q";"subkey"="3";"value"="020"};
+{"key"="qzz";"subkey"="4";"value"="150"};
+{"key"="qw";"subkey"="5";"value"="075"};
+{"key"="dddx";"subkey"="6";"value"="100"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/desc_sort_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
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt b/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt
new file mode 100644
index 0000000000..c189e76627
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt
@@ -0,0 +1,6 @@
+{"key"="075";"subkey"="1";"value"={"b"=11;"a"=1;}};
+{"key"="800";"subkey"="2";"value"={"a"=2;}};
+{"key"="020";"subkey"="3";"value"={}};
+{"key"="150";"subkey"="4";"value"={"b"=13;"a"=4;}};
+{"key"="075";"subkey"="5";"value"={"b"=14;"a"=5;}};
+{"key"="100";"subkey"="6";"value"={"c"=15;"a"=6;}};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt.attr
new file mode 100644
index 0000000000..6dd8d28db1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/dict.txt.attr
@@ -0,0 +1,27 @@
+{
+ "_yql_row_spec" = {
+ "Type" = [
+ "StructType";
+ [
+ [
+ "key";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "subkey";
+ [
+ "DataType";
+ "String"
+ ]
+ ];
+ [
+ "value";
+ ["DictType"; ["DataType";"String"]; ["DataType";"Int32"];]
+ ]
+ ]
+ ]
+ }
+} \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt
new file mode 100644
index 0000000000..54b881cf72
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt
@@ -0,0 +1,7 @@
+{"key"="1";"subkey"="6";"value"="a"};
+{"key"="1.1";"subkey"="7";"value"="b"};
+{"key"="0.1";"subkey"="5";"value"="c"};
+{"key"="-1";"subkey"="2";"value"="d"};
+{"key"="-1.1";"subkey"="1";"value"="e"};
+{"key"="-0.1";"subkey"="3";"value"="f"};
+{"key"="0";"subkey"="4";"value"="z"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/doubles_input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/doubles_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
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt b/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt.attr
new file mode 100644
index 0000000000..ada1f836f8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/empty.txt.attr
@@ -0,0 +1,3 @@
+{
+ "infer_schema"=%true
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt b/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt
new file mode 100644
index 0000000000..d268b7d3ae
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt
@@ -0,0 +1 @@
+{};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt.attr
new file mode 100644
index 0000000000..3c0f7e55c1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/empty_row.txt.attr
@@ -0,0 +1,3 @@
+{
+ "infer_schema" = %true
+} \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt
new file mode 100644
index 0000000000..613ebe7f0d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt
@@ -0,0 +1,6 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="800";"subkey"="2";"value"="ddd"};
+{"key"="020";"subkey"="3";"value"="q"};
+{"key"="150";"subkey"="4";"value"="qzz"};
+{"key"="075";"subkey"="3";"value"="q"};
+{"key"="100";"subkey"="2";"value"="ddd"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/group_by_tuple_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
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/input.txt
new file mode 100644
index 0000000000..7d4ce31a5d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/input.txt
@@ -0,0 +1,6 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="800";"subkey"="2";"value"="ddd"};
+{"key"="020";"subkey"="3";"value"="q"};
+{"key"="150";"subkey"="4";"value"="qzz"};
+{"key"="075";"subkey"="5";"value"="q"};
+{"key"="100";"subkey"="6";"value"="ddd"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/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
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt b/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt
new file mode 100644
index 0000000000..65949ea745
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt
@@ -0,0 +1,4 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="800";"subkey"="2";"value"="ddd"};
+{"key"="020";"subkey"="3";"value"="q"};
+{"key"="150";"subkey"="4";"value"="qzz"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt.attr
new file mode 100644
index 0000000000..3c0f7e55c1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/no_scheme.txt.attr
@@ -0,0 +1,3 @@
+{
+ "infer_schema" = %true
+} \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt
new file mode 100644
index 0000000000..acb15b8973
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt
@@ -0,0 +1,6 @@
+{"age"="30";"name"="bob"};
+{"age"="16";"name"="alice"};
+{"age"="55";"name"="jone"};
+{"age"="45";"name"="silver"};
+{"age"="45";"name"="smith"};
+{"age"="90";"name"="stive"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt.attr
new file mode 100644
index 0000000000..db02940d83
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/non_ksv_input.txt.attr
@@ -0,0 +1,3 @@
+{
+ "_yql_row_spec"={"Type"=["StructType";[["age";["DataType";"String"]];["name";["DataType";"String"]]]]}
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt b/yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt
new file mode 100644
index 0000000000..fe02ecfe9e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt
@@ -0,0 +1,6 @@
+{"key"="075";"subkey"="1";"value"="abc"};
+{"key"="800";"subkey"="2";"value"="ddd"};
+{"key"="020";"subkey"="3";"value"="q"};
+{"key"="150";"subkey"="4";"value"="qzz"};
+{"key"="075";"subkey"="5";"value"="qw"};
+{"key"="100";"subkey"="6";"value"="dddx"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/sort_input.txt.attr
new file mode 100644
index 0000000000..b6100e5fd0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/sort_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
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt
new file mode 100644
index 0000000000..6e7e05cd2e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; c="c1"};
+{"a"="a"; "b"="b"; c="c2"};
+{"a"="a"; "b"="b"; c="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt.attr
new file mode 100644
index 0000000000..8d0816e3f5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys.txt.attr
@@ -0,0 +1,14 @@
+{
+ "_read_schema"=<"strict"=%false>
+ [
+ {"type"="string"; "name"="a"};
+ {"type"="string"; "name"="b"};
+ {"type"="string"; "name"="c"}
+ ];
+ "schema"=<"strict" = %true; "unique_keys" = %true>
+ [
+ {"type"="string"; "name"="a"; "sort_order"="ascending"};
+ {"type"="string"; "name"="b"; "sort_order"="ascending"};
+ {"type"="string"; "name"="c"; "sort_order"="ascending"}
+ ]
+}
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt
new file mode 100644
index 0000000000..6e7e05cd2e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt
@@ -0,0 +1,3 @@
+{"a"="a"; "b"="b"; c="c1"};
+{"a"="a"; "b"="b"; c="c2"};
+{"a"="a"; "b"="b"; c="c3"};
diff --git a/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt.attr b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt.attr
new file mode 100644
index 0000000000..b709a3f991
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/Scheme/unique_keys_strip.txt.attr
@@ -0,0 +1,13 @@
+{
+ "_read_schema"=<"strict"=%false>
+ [
+ {"type"="string"; "name"="a"};
+ {"type"="string"; "name"="b"}
+ ];
+ "schema"=<"strict" = %true; "unique_keys" = %true>
+ [
+ {"type"="string"; "name"="a"; "sort_order"="ascending"};
+ {"type"="string"; "name"="b"; "sort_order"="ascending"};
+ {"type"="string"; "name"="c"; "sort_order"="ascending"}
+ ]
+}