aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/InMem
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/InMem
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/InMem')
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/AccessDictOpt.yql29
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/AggrMinMaxTuple.yql35
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/BitCore.yql30
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ByteAt.yql15
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Collect.yql12
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/CompareNulls.yql24
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/CompareStruct.yql39
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/CompareStruct2.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/CompareTuple.yql45
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.sql36
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.yql572
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/CountBits.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Default.yql38
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Demux.yql44
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/DictOpt.yql33
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/DictOptTuple.yql30
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeContains.yql81
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeLookup.yql81
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ExtractMembers.yql15
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FilterNullMembers.yql15
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FilterWithLimit.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FlatMapFiltersSortedList.yql22
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FloatsIncDec.yql14
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FloatsMod.yql14
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Fold.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Fold1Map.yql42
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverPreservedStream.yql63
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverUnboundedPreservedStream.yql63
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/FoldMap.yql32
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ForwardList.yql14
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/GroupOpt.yql23
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/GroupOptTuple.yql23
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Guess.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Guess.yql54
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Hopping.yql51
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/IndexDictOpt.yql20
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Iterator.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/LMap.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ListExtendMany.yql22
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ListFromRangeForDates.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/MemberOpt.yql25
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Merge.yql47
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/MultiMap.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Mux.yql20
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/NthOpt.yql25
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/PartitionByKey.yql27
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/PartitionByKeySorted.yql28
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeys.yql24
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeysSorted.yql25
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Queue.yql25
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/QueueCheckDependent.yql33
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/QueueMixedTypes.yql30
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/QueueRangeWithPreservedStream.yql32
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/QueueSimpleStrings.yql19
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ReplaceMember.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Seq.yql31
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/SkipNullMembers.yql15
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/SortOpt.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/SortOptTuple.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/SqlAccess.yql74
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StaticMap.yql18
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamDiscard.yql11
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamExtend.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamFilter.yql12
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamFlatMap.yql21
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamFold1Map.yql42
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamFoldMap.yql32
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamInCombineByKey.yql16
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamInGroupByKey.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamMap.yql12
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamSkip.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StreamTake.yql13
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StringContains.yql19
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/StringWith.yql28
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Switch.yql34
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/TimezoneIdName.yql10
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql82
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToDict.yql35
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToDictOpt.yql39
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToDictOptTuple.yql41
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToDictOverOptList.yql35
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/ToOptional.yql29
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Top.yql27
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/VariantItem.yql50
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Visit.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Visit.yql59
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Way.cfg2
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/Way.yql50
-rw-r--r--yql/essentials/tests/s-expressions/suites/InMem/default.cfg1
89 files changed, 3066 insertions, 0 deletions
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/AccessDictOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/AccessDictOpt.yql
new file mode 100644
index 0000000000..e41c01a7b4
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/AccessDictOpt.yql
@@ -0,0 +1,29 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t (ToDict (AsList '((String 'dkey1) (String 'dvalue1)) '((String 'dkey2) (String 'dvalue2)))
+ (lambda '(x) (Nth x '0)) (lambda '(x) (Nth x '1)) '('Sorted 'One)
+))
+
+(let jt (Just t))
+(let n (Nothing (TypeOf jt)))
+
+(let world (Write! world res_sink (Key) (Contains jt (String 'dkey1)) '('('type))))
+(let world (Write! world res_sink (Key) (Contains jt (String 'dkeyx)) '('('type))))
+(let world (Write! world res_sink (Key) (Contains n (String 'dkey1)) '('('type))))
+(let world (Write! world res_sink (Key) (Contains n (String 'dkeyx)) '('('type))))
+
+(let world (Write! world res_sink (Key) (Lookup jt (String 'dkey1)) '('('type))))
+(let world (Write! world res_sink (Key) (Lookup jt (String 'dkeyx)) '('('type))))
+(let world (Write! world res_sink (Key) (Lookup n (String 'dkey1)) '('('type))))
+(let world (Write! world res_sink (Key) (Lookup n (String 'dkeyx)) '('('type))))
+
+(let world (Write! world res_sink (Key) (DictItems jt) '('('type))))
+(let world (Write! world res_sink (Key) (DictItems n) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/AggrMinMaxTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/AggrMinMaxTuple.yql
new file mode 100644
index 0000000000..c84047a295
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/AggrMinMaxTuple.yql
@@ -0,0 +1,35 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let write (lambda '(world x y) (block '(
+ (let world (Write! world res_sink (Key) (String '==============) '()))
+ (let world (Write! world res_sink (Key) (AggrMin x y) '('('type))))
+ (let world (Write! world res_sink (Key) (AggrMax x y) '('('type))))
+ (return world)
+))))
+
+(let world (Apply write world '() '()))
+(let world (Apply write world (Just '()) (Just '())))
+
+(let world (Apply write world '((Int64 '1)) '((Int64 '1))))
+(let world (Apply write world '((Int64 '1)) '((Int64 '2))))
+(let world (Apply write world '((Uint64 '3)) '((Uint64 '2))))
+
+(let world (Apply write world '((Just (Int32 '1))) '((Just (Int32 '2)))))
+(let world (Apply write world (Just '((Just (Int32 '1)))) (Just '((Just (Int32 '3))))))
+
+(let world (Apply write world '((Int8 '1) (String 'a)) '((Int8 '1) (String 'a))))
+(let world (Apply write world '((Int8 '1) (String 'a)) '((Int8 '1) (String 'b))))
+(let world (Apply write world '((Int8 '1) (String 'b)) '((Int8 '1) (String 'a))))
+(let world (Apply write world '((Int8 '1) (String 'a)) '((Int8 '2) (String 'a))))
+(let world (Apply write world '((Int8 '2) (String 'a)) '((Int8 '1) (String 'b))))
+(let world (Apply write world '((Int8 '2) (String 'b)) '((Int8 '1) (String 'a))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
+
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/BitCore.yql b/yql/essentials/tests/s-expressions/suites/InMem/BitCore.yql
new file mode 100644
index 0000000000..9cf4e53963
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/BitCore.yql
@@ -0,0 +1,30 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import core_module '"/lib/yql/core.yql")
+(let res_sink (DataSink 'result))
+(let test (lambda '(world data) (block '(
+ (let world (Write! world res_sink (Key) data '('('type))))
+ (return world)
+))))
+
+(let world (Apply test world (Apply (bind core_module 'TestBit) (String '"\x05\x04") (Uint64 '0))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (String '"\x05\x04") (Uint64 '10))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (String '"\x05\x04") (Uint64 '11))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (String '"\x05\x04") (Uint64 '23))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Just (String '"\x05\x04")) (Uint64 '0))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Just (Utf8 '"\x05\x04")) (Uint64 '0))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Uint8 '5) (Uint8 '0))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Uint32 '5) (Uint8 '2))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Uint64 '5) (Uint8 '1))))
+(let world (Apply test world (Apply (bind core_module 'TestBit) (Just (Uint8 '5)) (Uint8 '0))))
+(let world (Apply test world (Apply (bind core_module 'SetBit) (Uint32 '5) (Uint8 '1))))
+(let world (Apply test world (Apply (bind core_module 'SetBit) (Just (Uint32 '5)) (Uint8 '1))))
+(let world (Apply test world (Apply (bind core_module 'ClearBit) (Uint32 '5) (Uint8 '0))))
+(let world (Apply test world (Apply (bind core_module 'ClearBit) (Just (Uint32 '5)) (Uint8 '0))))
+(let world (Apply test world (Apply (bind core_module 'FlipBit) (Uint32 '5) (Uint8 '0))))
+(let world (Apply test world (Apply (bind core_module 'FlipBit) (Just (Uint32 '5)) (Uint8 '0))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ByteAt.yql b/yql/essentials/tests/s-expressions/suites/InMem/ByteAt.yql
new file mode 100644
index 0000000000..6be3f9bffc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ByteAt.yql
@@ -0,0 +1,15 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (ByteAt (String 'ab) (Uint32 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (ByteAt (String 'ab) (Uint32 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (ByteAt (Just (String 'ab)) (Uint32 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (ByteAt (Just (String 'ab)) (Uint32 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (ByteAt (Nothing (OptionalType (DataType 'String))) (Uint32 '1)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Collect.yql b/yql/essentials/tests/s-expressions/suites/InMem/Collect.yql
new file mode 100644
index 0000000000..e62000f1ee
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Collect.yql
@@ -0,0 +1,12 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (String 'aaa) (String 'bbb) (String 'ccc)))
+(let world (Write! world res_sink (Key) (Collect (Iterator list)) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (Collect (LazyList (LazyList (Collect list))))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/CompareNulls.yql b/yql/essentials/tests/s-expressions/suites/InMem/CompareNulls.yql
new file mode 100644
index 0000000000..1e399b48cc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/CompareNulls.yql
@@ -0,0 +1,24 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let write (lambda '(world x y) (block '(
+ (let world (Write! world res_sink (Key) (String '==============) '()))
+ (let world (Write! world res_sink (Key) (== x y) '('('type))))
+ (return world)
+))))
+
+(let world (Apply write world (Null) (Null)))
+(let world (Apply write world (Null) (Nothing (OptionalType (DataType 'String)))))
+(let world (Apply write world (Int32 '0) (Null)))
+(let world (Apply write world '((Null)) '((Null))))
+(let world (Apply write world '((Int32 '1) (Null)) '((Int32 '1) (Null))))
+(let world (Apply write world '((Int32 '1) (Nothing (OptionalType (DataType 'String)))) '((Int32 '1) (Nothing (OptionalType (DataType 'String))))))
+
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct.yql b/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct.yql
new file mode 100644
index 0000000000..112fc7f534
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct.yql
@@ -0,0 +1,39 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let write (lambda '(world x y) (block '(
+ (let world (Write! world res_sink (Key) (String '==============) '()))
+ (let world (Write! world res_sink (Key) (== x y) '('('type))))
+ (let world (Write! world res_sink (Key) (!= x y) '('('type))))
+ (return world)
+))))
+
+(let world (Apply write world (AsStruct) (AsStruct)))
+(let world (Apply write world (Just (AsStruct)) (AsStruct)))
+(let world (Apply write world (AsStruct) (Just (AsStruct))))
+(let world (Apply write world (Just (AsStruct)) (Just (AsStruct))))
+
+(let world (Apply write world (AsStruct '('x (Int32 '1))) (AsStruct '('x (Uint64 '1)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1))) (AsStruct '('x (Uint64 '2)))))
+(let world (Apply write world (AsStruct '('x (Int32 '3))) (AsStruct '('x (Uint64 '2)))))
+
+(let world (Apply write world (Just (AsStruct '('x (Int32 '1)))) (AsStruct '('x (Uint64 '1)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1))) (Just (AsStruct '('x (Uint64 '1))))))
+(let world (Apply write world (AsStruct '('x (Just (Int32 '1)))) (AsStruct '('x (Uint64 '1)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1))) (AsStruct '('x (Just (Uint64 '1))))))
+(let world (Apply write world (Just (AsStruct '('x (Just (Int32 '1))))) (AsStruct '('x (Uint64 '1)))))
+(let world (Apply write world (Just (AsStruct '('x (Just (Int32 '1))))) (AsStruct '('x (Just (Uint64 '1))))))
+(let world (Apply write world (Just (AsStruct '('x (Just (Int32 '1))))) (Just (AsStruct '('x (Just (Uint64 '1)))))))
+
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (String 'a))) (AsStruct '('x (Uint64 '1)) '('y (String 'a)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (String 'a))) (AsStruct '('x (Uint64 '1)) '('y (String 'b)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (String 'b))) (AsStruct '('x (Uint64 '1)) '('y (String 'a)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (String 'a))) (AsStruct '('x (Uint64 '2)) '('y (String 'a)))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct2.yql b/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct2.yql
new file mode 100644
index 0000000000..5d9ca77381
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/CompareStruct2.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let write (lambda '(world x y) (block '(
+ (let world (Write! world res_sink (Key) (String '==============) '()))
+ (let world (Write! world res_sink (Key) (== x y) '('('type))))
+ (let world (Write! world res_sink (Key) (!= x y) '('('type))))
+ (return world)
+))))
+
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (String 'a))) (AsStruct '('y (String 'a)) '('z (Int64 '1)))))
+(let world (Apply write world (AsStruct '('x (Int32 '1)) '('y (Just (String 'a)))) (AsStruct '('y (String 'a)) '('z (Int64 '1)))))
+(let world (Apply write world (AsStruct) (AsStruct '('y (String 'a)) '('z (Int64 '1)))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/CompareTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/CompareTuple.yql
new file mode 100644
index 0000000000..b51f864573
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/CompareTuple.yql
@@ -0,0 +1,45 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let write (lambda '(world x y) (block '(
+ (let world (Write! world res_sink (Key) (String '==============) '()))
+ (let world (Write! world res_sink (Key) (== x y) '('('type))))
+ (let world (Write! world res_sink (Key) (!= x y) '('('type))))
+ (let world (Write! world res_sink (Key) (< x y) '('('type))))
+ (let world (Write! world res_sink (Key) (<= x y) '('('type))))
+ (let world (Write! world res_sink (Key) (> x y) '('('type))))
+ (let world (Write! world res_sink (Key) (>= x y) '('('type))))
+ (return world)
+))))
+
+(let world (Apply write world '() '()))
+(let world (Apply write world (Just '()) '()))
+(let world (Apply write world '() (Just '())))
+(let world (Apply write world (Just '()) (Just '())))
+
+(let world (Apply write world '((Int32 '1)) '((Uint64 '1))))
+(let world (Apply write world '((Int32 '1)) '((Uint64 '2))))
+(let world (Apply write world '((Int32 '3)) '((Uint64 '2))))
+
+(let world (Apply write world (Just '((Int32 '1))) '((Uint64 '1))))
+(let world (Apply write world '((Int32 '1)) (Just '((Uint64 '1)))))
+(let world (Apply write world '((Just (Int32 '1))) '((Uint64 '1))))
+(let world (Apply write world '((Int32 '1)) '((Just (Uint64 '1)))))
+(let world (Apply write world (Just '((Just (Int32 '1)))) '((Uint64 '1))))
+(let world (Apply write world (Just '((Just (Int32 '1)))) '((Just (Uint64 '1)))))
+(let world (Apply write world (Just '((Just (Int32 '1)))) (Just '((Just (Uint64 '1))))))
+
+(let world (Apply write world '((Int32 '1) (String 'a)) '((Uint64 '1) (String 'a))))
+(let world (Apply write world '((Int32 '1) (String 'a)) '((Uint64 '1) (String 'b))))
+(let world (Apply write world '((Int32 '1) (String 'b)) '((Uint64 '1) (String 'a))))
+(let world (Apply write world '((Int32 '1) (String 'a)) '((Uint64 '2) (String 'a))))
+(let world (Apply write world '((Int32 '2) (String 'a)) '((Uint64 '1) (String 'b))))
+(let world (Apply write world '((Int32 '2) (String 'b)) '((Uint64 '1) (String 'a))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.sql b/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.sql
new file mode 100644
index 0000000000..d916034abc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.sql
@@ -0,0 +1,36 @@
+$es = YQL::Nothing(YQL::OptionalType(YQL::DataType(AsAtom("String"))));
+$eu = YQL::Nothing(YQL::OptionalType(YQL::DataType(AsAtom("Utf8"))));
+$u1 = YQL::Unwrap(cast("a" as utf8));
+$u2 = YQL::Unwrap(cast("b" as utf8));
+----------
+select YQL::Concat("a", "b");
+select YQL::Concat(YQL::Just("a"), "b");
+select YQL::Concat("a", YQL::Just("b"));
+select YQL::Concat(YQL::Just("a"), "b");
+select YQL::Concat($es, "b");
+select YQL::Concat("a", $es);
+select YQL::Concat($es, $es);
+----------
+select YQL::Concat("a", $u2);
+select YQL::Concat(YQL::Just("a"), $u2);
+select YQL::Concat("a", YQL::Just($u2));
+select YQL::Concat(YQL::Just("a"), $u2);
+select YQL::Concat($es, $u2);
+select YQL::Concat("a", $eu);
+select YQL::Concat($es, $eu);
+----------
+select YQL::Concat($u1, "b");
+select YQL::Concat(YQL::Just($u1), "b");
+select YQL::Concat($u1, YQL::Just("b"));
+select YQL::Concat(YQL::Just($u1), "b");
+select YQL::Concat($eu, "b");
+select YQL::Concat($u1, $es);
+select YQL::Concat($eu, $es);
+----------
+select YQL::Concat($u1, $u2);
+select YQL::Concat(YQL::Just($u1), $u2);
+select YQL::Concat($u1, YQL::Just($u2));
+select YQL::Concat(YQL::Just($u1), $u2);
+select YQL::Concat($eu, $u2);
+select YQL::Concat($u1, $eu);
+select YQL::Concat($eu, $eu);
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.yql
new file mode 100644
index 0000000000..a20d1188dc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ConcatOpt.yql
@@ -0,0 +1,572 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import aggregate_module '"/lib/yql/aggregate.yql")
+(import window_module '"/lib/yql/window.yql")
+(import core_module '"/lib/yql/core.yql")
+(let world (block '(
+ (let output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" (String '"a")) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") ("Just" (String '"b"))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" (String '"a")) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"String"))) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") ("Nothing" ("OptionalType" ("DataType" '"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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"String"))) ("Nothing" ("OptionalType" ("DataType" '"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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" (String '"a")) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") ("Just" ("Unwrap" (Cast (String '"b") 'Utf8)))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" (String '"a")) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"String"))) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" (String '"a") ("Nothing" ("OptionalType" ("DataType" '"Utf8")))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"String"))) ("Nothing" ("OptionalType" ("DataType" '"Utf8")))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" ("Unwrap" (Cast (String '"a") 'Utf8))) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) ("Just" (String '"b"))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" ("Unwrap" (Cast (String '"a") 'Utf8))) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"Utf8"))) (String '"b")))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) ("Nothing" ("OptionalType" ("DataType" '"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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"Utf8"))) ("Nothing" ("OptionalType" ("DataType" '"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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" ("Unwrap" (Cast (String '"a") 'Utf8))) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) ("Just" ("Unwrap" (Cast (String '"b") 'Utf8)))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Just" ("Unwrap" (Cast (String '"a") 'Utf8))) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"Utf8"))) ("Unwrap" (Cast (String '"b") 'Utf8))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Unwrap" (Cast (String '"a") 'Utf8)) ("Nothing" ("OptionalType" ("DataType" '"Utf8")))))))
+ (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 output (block '(
+ (let select (block '(
+ (let core (AsList (Uint32 '0)))
+ (let core (FlatMap core (lambda '(row) (block '(
+ (let res (AsStruct '('"column0" ("Concat" ("Nothing" ("OptionalType" ("DataType" '"Utf8"))) ("Nothing" ("OptionalType" ("DataType" '"Utf8")))))))
+ (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 '(
+ (return world)
+)))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/CountBits.yql b/yql/essentials/tests/s-expressions/suites/InMem/CountBits.yql
new file mode 100644
index 0000000000..5f688a5075
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/CountBits.yql
@@ -0,0 +1,18 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (CountBits (Int8 '-1)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Uint8 '7)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Int16 '-1)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Uint16 '16)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Int32 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Uint32 '0)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Int64 '-7)) '('('type))))
+(let world (Write! world res_sink (Key) (CountBits (Uint64 '7)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+) \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Default.yql b/yql/essentials/tests/s-expressions/suites/InMem/Default.yql
new file mode 100644
index 0000000000..a7f8667067
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Default.yql
@@ -0,0 +1,38 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let test (lambda '(world type) (block '(
+ (let world (Write! world res_sink (Key) (Default (DataType type)) '('('type))))
+ (let world (Write! world res_sink (Key) (Default (OptionalType (DataType type))) '('('type))))
+ (return world)
+))))
+
+(let world (Apply test world 'Bool))
+(let world (Apply test world 'Int8))
+(let world (Apply test world 'Uint8))
+(let world (Apply test world 'Int16))
+(let world (Apply test world 'Uint16))
+(let world (Apply test world 'Int32))
+(let world (Apply test world 'Uint32))
+(let world (Apply test world 'Int64))
+(let world (Apply test world 'Uint64))
+(let world (Apply test world 'Float))
+(let world (Apply test world 'Double))
+(let world (Apply test world 'String))
+(let world (Apply test world 'Utf8))
+# yson & json don't have a default value
+(let world (Apply test world 'Date))
+(let world (Apply test world 'Datetime))
+(let world (Apply test world 'Timestamp))
+(let world (Apply test world 'Interval))
+(let world (Apply test world 'TzDate))
+(let world (Apply test world 'TzDatetime))
+(let world (Apply test world 'TzTimestamp))
+(let world (Apply test world 'Uuid))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Demux.yql b/yql/essentials/tests/s-expressions/suites/InMem/Demux.yql
new file mode 100644
index 0000000000..6fd4b3f3cd
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Demux.yql
@@ -0,0 +1,44 @@
+(
+#comment
+(let res_sink (DataSink 'result))
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let varTuple (VariantType (TupleType (DataType 'String) (DataType 'Bool) (DataType 'Uint32))))
+
+(let varList (AsList
+ (Variant (String 'a1) '0 varTuple)
+ (Variant (Uint32 '3) '2 varTuple)
+ (Variant (String 'a2) '0 varTuple)
+ (Variant (Bool 'false) '1 varTuple)
+ (Variant (Uint32 '1) '2 varTuple)
+ (Variant (String 'a3) '0 varTuple)
+ (Variant (Uint32 '2) '2 varTuple)
+ (Variant (Bool 'true) '1 varTuple)
+ (Variant (Uint32 '4) '2 varTuple)
+))
+
+(let data (Demux varList))
+(let world (Write! world res_sink (Key) data '('('type))))
+
+(let varStruct (VariantType (StructType '('s (DataType 'String)) '('b (DataType 'Bool)) '('u (DataType 'Uint32)))))
+
+(let varList (AsList
+ (Variant (String 'a1) 's varStruct)
+ (Variant (Uint32 '3) 'u varStruct)
+ (Variant (String 'a2) 's varStruct)
+ (Variant (Bool 'false) 'b varStruct)
+ (Variant (Uint32 '1) 'u varStruct)
+ (Variant (String 'a3) 's varStruct)
+ (Variant (Uint32 '2) 'u varStruct)
+ (Variant (Bool 'true) 'b varStruct)
+ (Variant (Uint32 '4) 'u varStruct)
+))
+
+(let data (Demux varList))
+(let world (Write! world res_sink (Key) data '('('type))))
+
+(let world (Commit! world res_sink))
+
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/DictOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/DictOpt.yql
new file mode 100644
index 0000000000..b12be636c8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/DictOpt.yql
@@ -0,0 +1,33 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t1 (OptionalType (DataType 'Uint32)))
+(let t2 (DataType 'String))
+(let d1 (DictType t1 t2))
+(let d2 (Dict d1
+ '((Just (Uint32 '4)) (String 'aaa))
+ '((Just (Uint32 '4)) (String 'zzz))
+ '((Nothing (OptionalType (DataType 'Uint32))) (String 'bbb)))
+)
+
+(let world (Write! world res_sink (Key) d2 '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Uint32)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Uint32 '5))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Uint32 '5)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Uint32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Nothing (OptionalType (DataType 'Uint32))))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (OptionalType (DataType 'Uint32))))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Uint32)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Uint32 '5))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Uint32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Uint32 '5)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Nothing (OptionalType (DataType 'Uint32))))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (OptionalType (DataType 'Uint32))))) '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/DictOptTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/DictOptTuple.yql
new file mode 100644
index 0000000000..4c9e5b46d5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/DictOptTuple.yql
@@ -0,0 +1,30 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t1 (TupleType (OptionalType (DataType 'Uint32)) (DataType 'String)))
+(let t2 (DataType 'String))
+(let d1 (DictType t1 t2))
+(let d2 (Dict d1
+ '('((Just (Uint32 '4)) (String 'ggg)) (String 'aaa))
+ '('((Just (Uint32 '4)) (String 'hhh)) (String 'bbb))
+ '('((Just (Uint32 '4)) (String 'ggg)) (String 'ccc))
+ '('((Nothing (OptionalType (DataType 'Uint32))) (String 'rrr)) (String 'ddd))
+))
+
+(let world (Write! world res_sink (Key) (Contains d2 '((Just (Uint32 '4)) (String 'ggg))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 '((Just (Uint32 '5)) (String 'ggg))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 '((Just (Uint32 '4)) (String 'sss))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 '((Nothing (OptionalType (DataType 'Uint32))) (String 'rrr))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 '((Nothing (OptionalType (DataType 'Uint32))) (String 'qqq))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 '((Just (Uint32 '4)) (String 'ggg))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 '((Just (Uint32 '5)) (String 'ggg))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 '((Just (Uint32 '4)) (String 'sss))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 '((Nothing (OptionalType (DataType 'Uint32))) (String 'rrr))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 '((Nothing (OptionalType (DataType 'Uint32))) (String 'qqq))) '()))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeContains.yql b/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeContains.yql
new file mode 100644
index 0000000000..25e92e7eff
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeContains.yql
@@ -0,0 +1,81 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t1 (DataType 'Uint32))
+(let t2 (DataType 'String))
+(let dt (DictType t1 t2))
+(let d (Dict dt '((Uint32 '4) (String 'aaa)) '((Uint32 '5) (String 'bbb))) )
+(let jd (Just d))
+(let n (Nothing (TypeOf jd)))
+
+(let nu (Nothing (OptionalType (DataType 'Uint32))))
+(let t3 (OptionalType (DataType 'Uint32)))
+(let t4 (OptionalType (DataType 'String)))
+(let dt2 (DictType t3 t4))
+(let d2 (Dict dt2
+'((Just (Uint32 '4)) (Just (String 'aaa)))
+'((Just (Uint32 '5)) (Just (String 'bbb)))
+'(nu (Just (String 'ccc)))
+))
+(let jd2 (Just d2))
+(let n2 (Nothing (TypeOf jd2)))
+
+(let world (Write! world res_sink (Key) (Contains d (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Contains d (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Contains jd (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains jd (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains jd (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains jd (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Contains jd (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Contains n (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains n (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains n (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains n (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Contains n (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Contains d nu) '()))
+(let world (Write! world res_sink (Key) (Contains d (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d (Just (Uint8 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d (Just (Int64 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d (Just (Int64 '-4))) '()))
+(let world (Write! world res_sink (Key) (Contains d (Just (Uint64 '4))) '()))
+
+(let world (Write! world res_sink (Key) (Contains d2 (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Int32 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Uint8 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Int32 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Int64 '4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Int64 '-4))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Uint64 '4))) '()))
+
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Uint8)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Int32)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Uint32)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Int64)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Nothing (OptionalType (DataType 'Uint64)))) '()))
+
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Uint8 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Int32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Uint32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Int64 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Int64 '-4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Just (Uint64 '4)))) '()))
+(let world (Write! world res_sink (Key) (Contains d2 (Just (Nothing (OptionalType (DataType 'Int64))))) '()))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeLookup.yql b/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeLookup.yql
new file mode 100644
index 0000000000..d7c81831cb
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/DiffKeyTypeLookup.yql
@@ -0,0 +1,81 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t1 (DataType 'Uint32))
+(let t2 (DataType 'String))
+(let dt (DictType t1 t2))
+(let d (Dict dt '((Uint32 '4) (String 'aaa)) '((Uint32 '5) (String 'bbb))) )
+(let jd (Just d))
+(let n (Nothing (TypeOf jd)))
+
+(let nu (Nothing (OptionalType (DataType 'Uint32))))
+(let t3 (OptionalType (DataType 'Uint32)))
+(let t4 (OptionalType (DataType 'String)))
+(let dt2 (DictType t3 t4))
+(let d2 (Dict dt2
+'((Just (Uint32 '4)) (Just (String 'aaa)))
+'((Just (Uint32 '5)) (Just (String 'bbb)))
+'(nu (Just (String 'ccc)))
+))
+(let jd2 (Just d2))
+(let n2 (Nothing (TypeOf jd2)))
+
+(let world (Write! world res_sink (Key) (Lookup d (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Lookup jd (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup jd (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup jd (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup jd (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Lookup jd (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Lookup n (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup n (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup n (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup n (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Lookup n (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Lookup d nu) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Just (Uint8 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Just (Int64 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Just (Int64 '-4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d (Just (Uint64 '4))) '()))
+
+(let world (Write! world res_sink (Key) (Lookup d2 (Uint8 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Int32 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Uint32 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Int64 '4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Int64 '-4)) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Uint64 '4)) '()))
+
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Uint8 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Int32 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Uint32 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Int64 '4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Int64 '-4))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Uint64 '4))) '()))
+
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Uint8)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Int32)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Uint32)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Int64)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Nothing (OptionalType (DataType 'Uint64)))) '()))
+
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Uint8 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Int32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Uint32 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Int64 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Int64 '-4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Just (Uint64 '4)))) '()))
+(let world (Write! world res_sink (Key) (Lookup d2 (Just (Nothing (OptionalType (DataType 'Int64))))) '()))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ExtractMembers.yql b/yql/essentials/tests/s-expressions/suites/InMem/ExtractMembers.yql
new file mode 100644
index 0000000000..ed1ea53868
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ExtractMembers.yql
@@ -0,0 +1,15 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let str1 (AsStruct '('a (Uint32 '1)) '('b (String 'a)) '('c (Bool 'true))))
+(let str2 (AsStruct '('a (Uint32 '2)) '('b (String 'b)) '('c (Bool 'false))))
+(let list1 (AsList str1 str2))
+(let world (Write! world res_sink (Key) (ExtractMembers list1 '('a)) '('('type))))
+(let world (Write! world res_sink (Key) (ExtractMembers (Collect (Iterator list1)) '()) '('('type))))
+(let world (Write! world res_sink (Key) (ExtractMembers (Just str1) '('a 'c)) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FilterNullMembers.yql b/yql/essentials/tests/s-expressions/suites/InMem/FilterNullMembers.yql
new file mode 100644
index 0000000000..6d14f0d268
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FilterNullMembers.yql
@@ -0,0 +1,15 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+ (AsStruct '('key (Just (Uint32 '1))) '('value (String 'a)))
+ (AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (String 'a)))
+))
+
+(let world (Write! world res_sink (Key) (FilterNullMembers list '('key)) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FilterWithLimit.yql b/yql/essentials/tests/s-expressions/suites/InMem/FilterWithLimit.yql
new file mode 100644
index 0000000000..ee25f707f1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FilterWithLimit.yql
@@ -0,0 +1,16 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (Int32 '1) (Int32 '2) (Int32 '3) (Int32 '4) (Int32 '5) (Int32 '6) (Int32 '7) (Int32 '8) (Int32 '9)))
+(let world (Write! world res_sink (Key) (OrderedFilter list
+ (lambda '(x) (AggrLess x (Int32 '6))) (Int32 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (Filter (LazyList list)
+ (lambda '(x) (AggrGreater x (Int32 '4))) (Uint64 '3)) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (Filter (ToFlow list)
+ (lambda '(x) (AggrGreaterOrEqual x (Int32 '3))) (Int16 '4))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FlatMapFiltersSortedList.yql b/yql/essentials/tests/s-expressions/suites/InMem/FlatMapFiltersSortedList.yql
new file mode 100644
index 0000000000..306f073803
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FlatMapFiltersSortedList.yql
@@ -0,0 +1,22 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+(AsStruct '('a (Int32 '7)) '('b (String 'two)))
+(AsStruct '('a (Int32 '1)) '('b (String 'one)))
+(AsStruct '('a (Int32 '3)) '('b (String 'two)))
+(AsStruct '('a (Int32 '5)) '('b (String 'one)))
+(AsStruct '('a (Int32 '5)) '('b (String 'two)))
+))
+
+(let keyExtractor (lambda '(x) '((Member x 'a)(Member x 'b))))
+(let data (ListSort list '((Bool 'true) (Bool 'false)) keyExtractor))
+(let mapped (ListFlatMap data (lambda '(x) (ListIf (Greater (Member x 'a) (Uint64 '2)) x) )))
+
+(let world (Write! world res_sink (Key) mapped '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FloatsIncDec.yql b/yql/essentials/tests/s-expressions/suites/InMem/FloatsIncDec.yql
new file mode 100644
index 0000000000..02b70ad22b
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FloatsIncDec.yql
@@ -0,0 +1,14 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (Inc (Double '3.3)) '('('type))))
+(let world (Write! world res_sink (Key) (Inc (Float '-7.5)) '('('type))))
+(let world (Write! world res_sink (Key) (Dec (Double '-0.3)) '('('type))))
+(let world (Write! world res_sink (Key) (Dec (Float '4.75)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+) \ No newline at end of file
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FloatsMod.yql b/yql/essentials/tests/s-expressions/suites/InMem/FloatsMod.yql
new file mode 100644
index 0000000000..efa89ba44c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FloatsMod.yql
@@ -0,0 +1,14 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (Mod (Double '3.3) (Double '1.7)) '('('type))))
+(let world (Write! world res_sink (Key) (Mod (Float '-7.5) (Double '0.7)) '('('type))))
+(let world (Write! world res_sink (Key) (Mod (Double '-0.3) (Float '-3.8)) '('('type))))
+(let world (Write! world res_sink (Key) (Mod (Float '4.75) (Float '-2.5)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Fold.yql b/yql/essentials/tests/s-expressions/suites/InMem/Fold.yql
new file mode 100644
index 0000000000..9f4ce156f3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Fold.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let doFold (lambda '(list) (Fold list (List (TypeOf list)) (lambda '(item state) (Append state item)))))
+(let world (Write! world res_sink (Key) (Apply doFold (AsList (String '"1") (String '"2") (String '"3") (String '"4"))) '('('type))))
+(let world (Write! world res_sink (Key) (Apply doFold (AsList '((String '"1") (String '"a")) '((String '"2") (String '"b")))) '('('type))))
+(let world (Write! world res_sink (Key) (Apply doFold (AsList (AsStruct '('"x" (String '"1"))) (AsStruct '('"x" (String '"2"))))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Fold1Map.yql b/yql/essentials/tests/s-expressions/suites/InMem/Fold1Map.yql
new file mode 100644
index 0000000000..751de45375
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Fold1Map.yql
@@ -0,0 +1,42 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'r))
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '3) (String 'b))
+'((Uint32 '5) (String 'i))
+'((Uint32 '8) (String 't))))
+
+(let init (lambda '(item) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey key)
+ (let sval val)
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (Fold1Map list init update))
+
+(let world (Write! world res_sink (Key) result '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverPreservedStream.yql b/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverPreservedStream.yql
new file mode 100644
index 0000000000..1a3aad97c9
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverPreservedStream.yql
@@ -0,0 +1,63 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+ '((Uint32 '1) (String 'r))
+ '((Uint32 '1) (String 'a))
+ '((Uint32 '2) (String 'b))
+ '((Uint32 '3) (String 'b))
+ '((Uint32 '5) (String 'i))
+ '((Uint32 '8) (String 't))
+))
+(let base_stream (Iterator list))
+
+(let queue (QueueCreate (ListItemType (TypeOf list)) (Uint64 '5) (Uint64 '0)))
+#(let queue (QueueCreate (TupleType (DataType 'Uint32) (DataType 'String)) (Uint64 '5) (Uint64 '0)))
+(let stream (PreserveStream base_stream queue (Uint64 '2)))
+
+(let init (lambda '(item) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let next (QueuePeek queue (Uint64 '1) (DependsOn item)))
+ (let over (QueuePeek queue (Uint64 '2) (DependsOn item)))
+ (let nkey (Nth next '0))
+ (let nval (Nth next '1))
+ (let okey (Nth over '0))
+ (let oval (Nth over '1))
+ (let skey key)
+ (let sval val)
+ (let validate (== (+ key (Coalesce nkey (Uint32 '0))) (Coalesce okey (Uint32 '0))))
+ (let words (Concat (Concat val (Coalesce nval (String '""))) (Coalesce oval (String '""))))
+ (let new_item '(key val skey sval validate words))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let next (QueuePeek queue (Uint64 '1) (DependsOn item)))
+ (let over (QueuePeek queue (Uint64 '2) (DependsOn item)))
+ (let nkey (Nth next '0))
+ (let nval (Nth next '1))
+ (let okey (Nth over '0))
+ (let oval (Nth over '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let validate (== (+ key (Coalesce nkey (Uint32 '0))) (Coalesce okey (Uint32 '0))))
+ (let words (Concat (Concat val (Coalesce nval (String '""))) (Coalesce oval (String '""))))
+ (let new_item '(key val skey sval validate words))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (Fold1Map stream init update))
+
+(let world (Write! world res_sink (Key) (Collect result) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverUnboundedPreservedStream.yql b/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverUnboundedPreservedStream.yql
new file mode 100644
index 0000000000..c555c6df02
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Fold1MapOverUnboundedPreservedStream.yql
@@ -0,0 +1,63 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+ '((Uint32 '1) (String 'r))
+ '((Uint32 '1) (String 'a))
+ '((Uint32 '2) (String 'b))
+ '((Uint32 '3) (String 'b))
+ '((Uint32 '5) (String 'i))
+ '((Uint32 '8) (String 't))
+))
+(let base_stream (Iterator list))
+
+(let queue (QueueCreate (ListItemType (TypeOf list)) (Void) (Uint64 '0)))
+#(let queue (QueueCreate (TupleType (DataType 'Uint32) (DataType 'String)) (Uint64 '5) (Uint64 '0)))
+(let stream (PreserveStream base_stream queue (Uint64 '1000000)))
+
+(let init (lambda '(item) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let next (QueuePeek queue (Uint64 '1) (DependsOn item)))
+ (let over (QueuePeek queue (Uint64 '2) (DependsOn item)))
+ (let nkey (Nth next '0))
+ (let nval (Nth next '1))
+ (let okey (Nth over '0))
+ (let oval (Nth over '1))
+ (let skey key)
+ (let sval val)
+ (let validate (== (+ key (Coalesce nkey (Uint32 '0))) (Coalesce okey (Uint32 '0))))
+ (let words (Concat (Concat val (Coalesce nval (String '""))) (Coalesce oval (String '""))))
+ (let new_item '(key val skey sval validate words))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let next (QueuePeek queue (Uint64 '1) (DependsOn item)))
+ (let over (QueuePeek queue (Uint64 '2) (DependsOn item)))
+ (let nkey (Nth next '0))
+ (let nval (Nth next '1))
+ (let okey (Nth over '0))
+ (let oval (Nth over '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let validate (== (+ key (Coalesce nkey (Uint32 '0))) (Coalesce okey (Uint32 '0))))
+ (let words (Concat (Concat val (Coalesce nval (String '""))) (Coalesce oval (String '""))))
+ (let new_item '(key val skey sval validate words))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (Fold1Map stream init update))
+
+(let world (Write! world res_sink (Key) (Collect result) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/FoldMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/FoldMap.yql
new file mode 100644
index 0000000000..fde736a37c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/FoldMap.yql
@@ -0,0 +1,32 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'b))
+'((Uint32 '2) (String 'o))
+'((Uint32 '1) (String 'm))
+'((Uint32 '3) (String 'b))))
+
+(let init_state '((Uint32 '0) (String '"")))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (FoldMap list init_state update))
+
+(let world (Write! world res_sink (Key) result '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ForwardList.yql b/yql/essentials/tests/s-expressions/suites/InMem/ForwardList.yql
new file mode 100644
index 0000000000..dfec8da682
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ForwardList.yql
@@ -0,0 +1,14 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (String 'aaa) (String 'bbb) (String 'ccc)))
+(let world (Write! world res_sink (Key) (ForwardList (Iterator list (DependsOn (Uint32 '0)))) '()))
+(let world (Write! world res_sink (Key) (Length (ForwardList (Iterator list (DependsOn (Uint32 '1))))) '()))
+(let world (Write! world res_sink (Key) (Skip (ForwardList (Iterator list (DependsOn (Uint32 '2)))) (Uint64 '2)) '()))
+(let world (Write! world res_sink (Key) (Take (ForwardList (Iterator list (DependsOn (Uint32 '3)))) (Uint64 '2)) '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/GroupOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/GroupOpt.yql
new file mode 100644
index 0000000000..30fcbac0b5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/GroupOpt.yql
@@ -0,0 +1,23 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Just (Uint32 '2)) (Just (String 'D)))
+'((Nothing (OptionalType (DataType 'Uint32))) (Just (String 'E)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+'((Just (Uint32 '3)) (Nothing (OptionalType (DataType 'String))))
+'((Just (Uint32 '2)) (Just (String 'B)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let handler (lambda '(key list) (Just '(key list))))
+(let data (GroupByKey list keyExtractor handler))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/GroupOptTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/GroupOptTuple.yql
new file mode 100644
index 0000000000..c21c6b07d3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/GroupOptTuple.yql
@@ -0,0 +1,23 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Just (Uint32 '2)) (Just (String 'D)))
+'((Nothing (OptionalType (DataType 'Uint32))) (Just (String 'E)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+'((Just (Uint32 '3)) (Nothing (OptionalType (DataType 'String))))
+'((Just (Uint32 '2)) (Just (String 'B)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+))
+
+(let keyExtractor (lambda '(x) x))
+(let handler (lambda '(key list) (Just '(key list))))
+(let data (GroupByKey list keyExtractor handler))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Guess.cfg b/yql/essentials/tests/s-expressions/suites/InMem/Guess.cfg
new file mode 100644
index 0000000000..e41deb15c5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Guess.cfg
@@ -0,0 +1,2 @@
+res result.txt
+mount ..\mounts.txt
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Guess.yql b/yql/essentials/tests/s-expressions/suites/InMem/Guess.yql
new file mode 100644
index 0000000000..256b5de592
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Guess.yql
@@ -0,0 +1,54 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import id_module '"/lib/yql/id.yql")
+(let id (bind id_module 'id))
+
+(let res_sink (DataSink 'result))
+(let vt (VariantType (TupleType (DataType 'Int32) (DataType 'String))))
+(let v1 (Variant (Int32 '34) '0 vt))
+(let v2 (Variant (String 'qwe) '1 vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (Guess v1 '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess v2 '1) '('('type))))
+(let world (Write! world res_sink (Key) (Guess jv1 '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess jv2 '1) '('('type))))
+(let world (Write! world res_sink (Key) (Guess n '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess n '1) '('('type))))
+
+(let world (Write! world res_sink (Key) (Guess (Apply id v1) '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id v2) '1) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id jv1) '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id jv2) '1) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id n) '0) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id n) '1) '('('type))))
+
+(let vt (VariantType (StructType '('a (DataType 'Int32)) '('b (DataType 'String)))))
+(let v1 (Variant (Int32 '34) 'a vt))
+(let v2 (Variant (String 'qwe) 'b vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (Guess v1 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess v2 'b) '('('type))))
+(let world (Write! world res_sink (Key) (Guess jv1 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess jv2 'b) '('('type))))
+(let world (Write! world res_sink (Key) (Guess n 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess n 'b) '('('type))))
+
+(let world (Write! world res_sink (Key) (Guess (Apply id v1) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id v2) 'b) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id jv1) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id jv2) 'b) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id n) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (Guess (Apply id n) 'b) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Hopping.yql b/yql/essentials/tests/s-expressions/suites/InMem/Hopping.yql
new file mode 100644
index 0000000000..0ae29c3594
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Hopping.yql
@@ -0,0 +1,51 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let timeExtractor (lambda '(item) (Just (Member item 'time))))
+
+(let init (lambda '(item)
+ (AsStruct
+ '('sum (Member item 'sum))
+ '('max (Member item 'max))
+)))
+(let update (lambda '(item state)
+ (AsStruct
+ '('sum (AggrAdd (Member item 'sum) (Member state 'sum)))
+ '('max (AggrMax (Member item 'max) (Member state 'max)))
+)))
+(let merge (lambda '(state1 state2)
+ (AsStruct
+ '('sum (AggrAdd (Member state1 'sum) (Member state2 'sum)))
+ '('max (AggrMax (Member state1 'max) (Member state2 'max)))
+)))
+(let save (lambda '(state) state))
+(let load (lambda '(state) state))
+(let finish (lambda '(state time) (AddMember state '_yql_time time)))
+
+(let stream (Iterator (AsList
+(AsStruct '('time (Timestamp '1)) '('sum (Uint32 '2)) '('max (String 'f)))
+(AsStruct '('time (Timestamp '2)) '('sum (Uint32 '3)) '('max (String 'a)))
+(AsStruct '('time (Timestamp '15)) '('sum (Uint32 '4)) '('max (String 'e)))
+(AsStruct '('time (Timestamp '23)) '('sum (Uint32 '6)) '('max (String 'h)))
+(AsStruct '('time (Timestamp '24)) '('sum (Uint32 '5)) '('max (String 'd)))
+(AsStruct '('time (Timestamp '25)) '('sum (Uint32 '7)) '('max (String 's)))
+(AsStruct '('time (Timestamp '40)) '('sum (Uint32 '2)) '('max (String 'j)))
+(AsStruct '('time (Timestamp '47)) '('sum (Uint32 '1)) '('max (String 't)))
+(AsStruct '('time (Timestamp '51)) '('sum (Uint32 '6)) '('max (String 'b)))
+(AsStruct '('time (Timestamp '59)) '('sum (Uint32 '2)) '('max (String 'c)))
+(AsStruct '('time (Timestamp '85)) '('sum (Uint32 '8)) '('max (String 'g)))
+(AsStruct '('time (Timestamp '55)) '('sum (Uint32 '1000)) '('max (String 'z)))
+(AsStruct '('time (Timestamp '200)) '('sum (Uint32 '0)) '('max (String 'a)))
+)))
+
+# row with time 55 should be excluded from aggregation due to delay
+
+(let itemType (StructType '('time (DataType 'Timestamp)) '('sum (DataType 'Uint32)) '('max (DataType 'String))))
+(let res (HoppingCore stream timeExtractor (Interval '10) (Interval '30) (Interval '20) init update save load merge finish))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (Collect res) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/IndexDictOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/IndexDictOpt.yql
new file mode 100644
index 0000000000..b551ccbad0
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/IndexDictOpt.yql
@@ -0,0 +1,20 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t (AsList
+ (String 'a)
+ (String 'b)
+))
+
+(let jt (Just t))
+(let n (Nothing (TypeOf jt)))
+
+(let world (Write! world res_sink (Key) (ToIndexDict jt) '('('type))))
+(let world (Write! world res_sink (Key) (ToIndexDict n) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Iterator.yql b/yql/essentials/tests/s-expressions/suites/InMem/Iterator.yql
new file mode 100644
index 0000000000..0cba17d6ea
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Iterator.yql
@@ -0,0 +1,18 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (String 'aaa) (String 'bbb) (String 'ccc)))
+(let world (Write! world res_sink (Key) (Collect (Iterator list (DependsOn (Uint32 '0)))) '()))
+(let world (Write! world res_sink (Key) (Collect (Iterator (Just list))) '()))
+(let world (Write! world res_sink (Key) (Collect (Iterator (Nothing (OptionalType (TypeOf list))))) '()))
+(let world (Write! world res_sink (Key) (Collect (EmptyIterator (StreamType (DataType 'Double)))) '()))
+(let world (Write! world res_sink (Key) (Collect (ToStream (Just (Uint32 '123)) (DependsOn (Uint32 '1)))) '()))
+(let world (Write! world res_sink (Key) (Collect (ToStream (Nothing (OptionalType (DataType 'Double))))) '()))
+(let world (Write! world res_sink (Key) (Collect (ToStream (EmptyIterator (StreamType (DataType 'String))))) '()))
+(let world (Write! world res_sink (Key) (Collect (ToStream list (DependsOn (Uint32 '2)))) '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/LMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/LMap.yql
new file mode 100644
index 0000000000..12ad41b0a7
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/LMap.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let handler (lambda '(stream) (block '(
+ (return (Map stream (lambda '(x) (Nth x '1))))
+))))
+
+(let data (LMap list handler))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ListExtendMany.yql b/yql/essentials/tests/s-expressions/suites/InMem/ListExtendMany.yql
new file mode 100644
index 0000000000..6c3403e7d4
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ListExtendMany.yql
@@ -0,0 +1,22 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let test (lambda '(world data) (block '(
+ (let world (Write! world res_sink (Key) data '('('type))))
+ (return world)
+))))
+
+(let world (Apply test world (Extend (AsList (String 'a)))))
+(let world (Apply test world (Extend (AsList (String 'a)) (AsList (String 'b)))))
+(let world (Apply test world (Extend (AsList (String 'a)) (AsList (String 'b)) (AsList (String 'c)))))
+(let world (Apply test world (Extend
+ (Extend (Take (AsList (String 'a)) (Uint64 '1)) (AsList (String 'b)))
+ (Extend (Take (AsList (String 'c)) (Uint64 '1)) (AsList (String 'd)))
+ )))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ListFromRangeForDates.yql b/yql/essentials/tests/s-expressions/suites/InMem/ListFromRangeForDates.yql
new file mode 100644
index 0000000000..7bf690187b
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ListFromRangeForDates.yql
@@ -0,0 +1,16 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let intervalOneSec (Interval '"1000000"))
+
+(let FirstList (ListFromRange (SafeCast (CurrentUtcDate) (DataType 'Datetime)) (Unwrap (- (CurrentUtcDatetime) (Interval '"63995000000"))) intervalOneSec))
+(let SecondList (ListFromRange (CurrentUtcDate) (Unwrap (+ (CurrentUtcDate) (Interval '"432000000000"))) (Interval '"86400000000")))
+(let ThirdList (ListFromRange (CurrentUtcDatetime) (Unwrap (+ (CurrentUtcDatetime) (Interval '"5000000"))) intervalOneSec))
+(let FourthList (ListFromRange (CurrentUtcTimestamp) (Unwrap (+ (CurrentUtcTimestamp) (Interval '"5"))) (Interval '"1")))
+(let Columns '('"column0" '"column1" '"column2" '"column3"))
+(let Col '('('type) '('autoref) '('columns Columns)))
+(let world (Write! world res_sink (Key) (AsList (AsStruct '('"column0" FirstList) '('"column1" SecondList) '('"column2" ThirdList) '('"column3" FourthList))) Col))
+(return (Commit! world res_sink))
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/MemberOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/MemberOpt.yql
new file mode 100644
index 0000000000..fafe8bee40
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/MemberOpt.yql
@@ -0,0 +1,25 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let s (AsStruct
+ '('a (String 'aaa))
+ '('b (Just (Uint32 '4)))
+ '('c (Nothing (OptionalType (DataType 'Uint32)))))
+)
+
+(let js (Just s))
+(let n (Nothing (TypeOf js)))
+
+(let world (Write! world res_sink (Key) (Member s 'a) '()))
+(let world (Write! world res_sink (Key) (Member js 'a) '()))
+(let world (Write! world res_sink (Key) (Member js 'b) '()))
+(let world (Write! world res_sink (Key) (Member js 'c) '()))
+(let world (Write! world res_sink (Key) (Member n 'a) '()))
+(let world (Write! world res_sink (Key) (Member n 'c) '()))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Merge.yql b/yql/essentials/tests/s-expressions/suites/InMem/Merge.yql
new file mode 100644
index 0000000000..3e91e821c6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Merge.yql
@@ -0,0 +1,47 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list1 (AsList
+ (AsStruct '('a (Uint32 '4)) '('b (String 'c)))
+ (AsStruct '('a (Uint32 '1)) '('b (String 'd)))
+ (AsStruct '('a (Uint32 '3)) '('b (String 'b)))
+))
+(let list2 (AsList
+ (AsStruct '('a (Uint32 '2)) '('b (String 'a)))
+ (AsStruct '('a (Uint32 '5)) '('b (String 'y)))
+ (AsStruct '('a (Uint32 '1)) '('b (String 'z)))
+))
+(let world (Write! world res_sink (Key)
+ (Merge
+ list1
+ list2
+ )
+'('('type))))
+
+(let world (Write! world res_sink (Key)
+ (Merge
+ (Sort list1 (Bool 'True) (lambda '(item) (Member item 'a)))
+ (Sort list2 (Bool 'True) (lambda '(item) (Member item 'a)))
+ )
+'('('type))))
+
+(let world (Write! world res_sink (Key)
+ (Merge
+ (Sort list1 (Bool 'False) (lambda '(item) (Member item 'a)))
+ (Sort list2 (Bool 'False) (lambda '(item) (Member item 'a)))
+ )
+'('('type))))
+
+(let world (Write! world res_sink (Key)
+ (Merge
+ (Sort list1 '((Bool 'True) (Bool 'True)) (lambda '(item) '((Member item 'a) (Member item 'b))))
+ (Sort list2 '((Bool 'True) (Bool 'True)) (lambda '(item) '((Member item 'a) (Member item 'b))))
+ )
+'('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/MultiMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/MultiMap.yql
new file mode 100644
index 0000000000..7a39c20b0a
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/MultiMap.yql
@@ -0,0 +1,16 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (Int32 '1) (Int32 '2) (Int32 '3)))
+(let world (Write! world res_sink (Key) (OrderedMultiMap list
+ (lambda '(x) x (+ x (Int32 '10)) x)) '('('type))))
+(let world (Write! world res_sink (Key) (MultiMap (LazyList list)
+ (lambda '(x) x (- (Int32 '7) x) (* x x))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (MultiMap (ToFlow list)
+ (lambda '(x) x (+ x (Int32 '-3)) (Int32 '0)))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Mux.yql b/yql/essentials/tests/s-expressions/suites/InMem/Mux.yql
new file mode 100644
index 0000000000..2a226541f3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Mux.yql
@@ -0,0 +1,20 @@
+(
+#comment
+(let res_sink (DataSink 'result))
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let list1 (AsList (String 'a1) (String 'a2) (String 'a3)))
+(let list2 (AsList (Bool 'true) (Bool 'false)))
+(let list3 (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3) (Uint32 '4)))
+
+(let data (Mux '(list1 list2 list3)))
+(let world (Write! world res_sink (Key) data '('('type))))
+
+(let data (Mux (AsStruct '('a list1) '('b list2) '('c list3))))
+(let world (Write! world res_sink (Key) data '('('type))))
+
+(let world (Commit! world res_sink))
+
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/NthOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/NthOpt.yql
new file mode 100644
index 0000000000..428da2f45f
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/NthOpt.yql
@@ -0,0 +1,25 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t '(
+ (String 'aaa)
+ (Just (Uint32 '4))
+ (Nothing (OptionalType (DataType 'Uint32)))
+))
+
+(let jt (Just t))
+(let n (Nothing (TypeOf jt)))
+
+(let world (Write! world res_sink (Key) (Nth t '0) '()))
+(let world (Write! world res_sink (Key) (Nth jt '0) '()))
+(let world (Write! world res_sink (Key) (Nth jt '1) '()))
+(let world (Write! world res_sink (Key) (Nth jt '2) '()))
+(let world (Write! world res_sink (Key) (Nth n '0) '()))
+(let world (Write! world res_sink (Key) (Nth n '2) '()))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKey.yql b/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKey.yql
new file mode 100644
index 0000000000..af112ea360
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKey.yql
@@ -0,0 +1,27 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let handler (lambda '(groups) (block '(
+ (return (Map groups (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let stream (Nth pair '1))
+ (let state (Concat (String '"key:") (ToString key)))
+ (let state (Condense stream state (lambda '(row state) (Bool 'False)) (lambda '(row state) (Concat (Concat state (String '" ")) (Nth row '1)))))
+ (return (Collect state))
+ )))))
+))))
+(let data (PartitionByKey list keyExtractor (Void) (Void) handler))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKeySorted.yql b/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKeySorted.yql
new file mode 100644
index 0000000000..a5c99fd3ee
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/PartitionByKeySorted.yql
@@ -0,0 +1,28 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let subkeyExtractor (lambda '(x) (Nth x '1)))
+(let handler (lambda '(groups) (block '(
+ (return (Map groups (lambda '(pair) (block '(
+ (let key (Nth pair '0))
+ (let stream (Nth pair '1))
+ (let state (Concat (String '"key:") (ToString key)))
+ (let state (Condense stream state (lambda '(row state) (Bool 'False)) (lambda '(row state) (Concat (Concat state (String '" ")) (Nth row '1)))))
+ (return (Collect state))
+ )))))
+))))
+(let data (PartitionByKey list keyExtractor (Bool 'false) subkeyExtractor handler))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeys.yql b/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeys.yql
new file mode 100644
index 0000000000..81326641f1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeys.yql
@@ -0,0 +1,24 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let handler (lambda '(x) (Condense1 x
+ (lambda '(row) '((Nth row '0) (Concat (String '"values:") (ToString (Nth row '1)))))
+ (lambda '(row state) (AggrNotEquals (Nth row '0) (Nth state '0)))
+ (lambda '(row state) '((Nth state '0) (Concat (Concat (Nth state '1) (String '" ")) (Nth row '1))))
+)))
+(let data (PartitionsByKeys (Iterator list) keyExtractor (Void) (Void) handler))
+(let data (Collect data))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeysSorted.yql b/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeysSorted.yql
new file mode 100644
index 0000000000..73f3a3f970
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/PartitionsByKeysSorted.yql
@@ -0,0 +1,25 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let subkeyExtractor (lambda '(x) (Nth x '1)))
+(let handler (lambda '(x) (Condense1 x
+ (lambda '(row) '((Nth row '0) (Concat (String '"values:") (ToString (Nth row '1)))))
+ (lambda '(row state) (AggrNotEquals (Nth row '0) (Nth state '0)))
+ (lambda '(row state) '((Nth state '0) (Concat (Concat (Nth state '1) (String '" ")) (Nth row '1))))
+)))
+(let data (PartitionsByKeys (Iterator list) keyExtractor (Bool 'false) subkeyExtractor handler))
+(let data (Collect data))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Queue.yql b/yql/essentials/tests/s-expressions/suites/InMem/Queue.yql
new file mode 100644
index 0000000000..2589942a60
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Queue.yql
@@ -0,0 +1,25 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let queue (QueueCreate (DataType 'Uint32) (Uint64 '4) (Uint64 '2)))
+
+(let queue (QueuePush queue (Int32 '1)))
+(let queue (QueuePush queue (Int32 '2)))
+
+(let result '((QueuePeek queue (Uint64 '0)) (QueuePeek queue (Uint64 '1)) (QueuePeek queue (Uint64 '2)) (QueuePeek queue (Uint64 '3))))
+(let world (Write! world res_sink (Key) result '('('type))))
+
+(let queue (QueuePop queue))
+(let queue (QueuePop queue))
+(let queue (QueuePush queue (Int32 '3)))
+
+(let result '((QueuePeek queue (Uint64 '0)) (QueuePeek queue (Uint64 '1)) (QueuePeek queue (Uint64 '2)) (QueuePeek queue (Uint64 '3))))
+(let world (Write! world res_sink (Key) result '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/QueueCheckDependent.yql b/yql/essentials/tests/s-expressions/suites/InMem/QueueCheckDependent.yql
new file mode 100644
index 0000000000..5bf3868fcc
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/QueueCheckDependent.yql
@@ -0,0 +1,33 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let qrs1 (QueueCreate (DataType 'String) (Uint64 '6) (Uint64 '0) (DependsOn (Uint64 '0))))
+(let qrs2 (QueueCreate (DataType 'String) (Uint64 '6) (Uint64 '0) (DependsOn (Uint64 '1))))
+(let qrs2 (QueuePush qrs2 (String '"It")))
+(let qrs1 (QueuePush qrs1 (String '"Look!")))
+(let qrs2 (QueuePush qrs2 (String '"is")))
+(let qrs1 (QueuePush qrs1 (String '"It")))
+(let qrs2 (QueuePush qrs2 (String '"a")))
+(let qrs1 (QueuePush qrs1 (String '"funny")))
+(let qrs2 (QueuePop qrs2))
+(let qrs2 (QueuePush qrs2 (String '"good")))
+(let qrs1 (QueuePop qrs1))
+(let qrs2 (QueuePush qrs2 (String '"day")))
+(let qrs2 (QueuePop qrs2))
+(let qrs2 (QueuePush qrs2 (String '"to")))
+(let qrs1 (QueuePush qrs1 (String '"bunny")))
+(let qrs2 (QueuePush qrs2 (String '"die")))
+(let qrs1 (QueuePop qrs1))
+
+(let resultString1 '((QueuePeek qrs1 (Minus (Uint64 '1))) (QueuePeek qrs1 (Uint64 '0)) (QueuePeek qrs1 (Uint64 '1)) (QueuePeek qrs1 (Uint64 '2))))
+(let resultString2 '((QueuePeek qrs2 (Minus (Uint64 '1))) (QueuePeek qrs2 (Uint64 '0)) (QueuePeek qrs2 (Uint64 '1)) (QueuePeek qrs2 (Uint64 '2))))
+
+(let result '(resultString1 resultString2))
+
+(let world (Write! world res_sink (Key) result '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/QueueMixedTypes.yql b/yql/essentials/tests/s-expressions/suites/InMem/QueueMixedTypes.yql
new file mode 100644
index 0000000000..55e36075f5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/QueueMixedTypes.yql
@@ -0,0 +1,30 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let qrs (QueueCreate (DataType 'String) (Uint64 '5) (Uint64 '0)))
+(let qri (QueueCreate (DataType 'Int32) (Uint64 '5) (Uint64 '0)))
+(let qri (QueuePush qri (Int32 '-5)))
+(let qrs (QueuePush qrs (String '"It")))
+(let qri (QueuePush qri (Int32 '5)))
+(let qrs (QueuePush qrs (String '"is")))
+(let qri (QueuePush qri (Int64 '-33)))
+(let qrs (QueuePush qrs (String '"funny")))
+(let qri (QueuePop qri))
+(let qrs (QueuePop qrs))
+(let qri (QueuePush qri (Int32 '42)))
+(let qri (QueuePop qri))
+(let qrs (QueuePush qrs (String '"bunny")))
+(let qrs (QueuePop qrs))
+
+(let resultInt '((QueuePeek qri (Minus (Uint64 '1))) (QueuePeek qri (Uint64 '0)) (QueuePeek qri (Uint64 '1)) (QueuePeek qri (Uint64 '2))))
+(let resultString '((QueuePeek qrs (Minus (Uint64 '1))) (QueuePeek qrs (Uint64 '0)) (QueuePeek qrs (Uint64 '1)) (QueuePeek qrs (Uint64 '2))))
+
+(let result '(resultInt resultString))
+
+(let world (Write! world res_sink (Key) result '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/QueueRangeWithPreservedStream.yql b/yql/essentials/tests/s-expressions/suites/InMem/QueueRangeWithPreservedStream.yql
new file mode 100644
index 0000000000..3a0c673d27
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/QueueRangeWithPreservedStream.yql
@@ -0,0 +1,32 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+(let res_sink (DataSink 'result))
+
+(let list (AsList
+ (Uint32 '1)
+ (Uint32 '1)
+ (Uint32 '2)
+ (Uint32 '3)
+ (Uint32 '5)
+ (Uint32 '8)
+))
+
+(let base_stream (Iterator list))
+
+(let queue (QueueCreate (ListItemType (TypeOf list)) (Void) (Uint64 '0)))
+
+(let stream (PreserveStream base_stream queue (Uint64 '100500)))
+
+(let update (lambda '(item state) (block '(
+ (let cumulative_sum (+ item state))
+ (let queue_content (Collect (QueueRange queue (Uint64 '0) (Uint64 '100500) (DependsOn item))))
+ (return '('(item cumulative_sum queue_content) cumulative_sum))
+))))
+
+(let result (FoldMap stream (Uint32 '0) update))
+
+(let world (Write! world res_sink (Key) (Collect result) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/QueueSimpleStrings.yql b/yql/essentials/tests/s-expressions/suites/InMem/QueueSimpleStrings.yql
new file mode 100644
index 0000000000..e7c8c1d029
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/QueueSimpleStrings.yql
@@ -0,0 +1,19 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let qr (QueueCreate (OptionalType (DataType 'String)) (Uint64 '5) (Uint64 '0)))
+(let qr (QueuePush qr (String '"It")))
+(let qr (QueuePush qr (Just (String '"is"))))
+(let qr (QueuePush qr (String '"funny")))
+(let qr (QueuePop qr))
+(let qr (QueuePush qr (Just (String '"bunny"))))
+(let qr (QueuePop qr))
+(let result '((QueuePeek qr (Minus (Uint64 '1))) (QueuePeek qr (Uint64 '0)) (QueuePeek qr (Uint64 '1)) (QueuePeek qr (Uint64 '2))))
+
+(let world (Write! world res_sink (Key) result '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ReplaceMember.yql b/yql/essentials/tests/s-expressions/suites/InMem/ReplaceMember.yql
new file mode 100644
index 0000000000..bb7203c502
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ReplaceMember.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let s (AsStruct '('a (String 'ccc)) '('b (Double '3.5))))
+(let world (Write! world res_sink (Key) (ReplaceMember s 'a (Int32 '7)) '('('type))))
+(let world (Write! world res_sink (Key) (ReplaceMember s 'b (String 'aaa)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Seq.yql b/yql/essentials/tests/s-expressions/suites/InMem/Seq.yql
new file mode 100644
index 0000000000..ea9eec4131
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Seq.yql
@@ -0,0 +1,31 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let v1 (String 'test1))
+(let q1 (QueueCreate (TypeOf v1) (Uint64 '1) (Uint64 '1) (DependsOn v1)))
+(let new_q1 (QueuePush (QueuePop q1) v1))
+(let q1_item (QueuePeek q1 (Uint64 '0) (DependsOn v1)))
+(let new_q1_item (QueuePeek new_q1 (Uint64 '0) (DependsOn v1)))
+
+# will be (test1, test1)
+(let result '(new_q1_item q1_item))
+(let world (Write! world res_sink (Key) result '('('type))))
+
+
+(let v2 (String 'test2))
+(let q2 (QueueCreate (TypeOf v2) (Uint64 '1) (Uint64 '1) (DependsOn v2)))
+(let new_q2 (QueuePush (QueuePop q2) v2))
+(let q2_item (QueuePeek q2 (Uint64 '0) (DependsOn v2)))
+(let new_q2_item (QueuePeek new_q2 (Uint64 '0) (DependsOn v2)))
+
+# enforce q2_item to be calculated first
+(let result '((Seq q2_item new_q2_item) q2_item))
+(let world (Write! world res_sink (Key) result '('('type))))
+
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/SkipNullMembers.yql b/yql/essentials/tests/s-expressions/suites/InMem/SkipNullMembers.yql
new file mode 100644
index 0000000000..8da7e768fd
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/SkipNullMembers.yql
@@ -0,0 +1,15 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+ (AsStruct '('key (Just (Uint32 '1))) '('value (String 'a)))
+ (AsStruct '('key (Nothing (OptionalType (DataType 'Uint32)))) '('value (String 'a)))
+))
+
+(let world (Write! world res_sink (Key) (SkipNullMembers list '('key)) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/SortOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/SortOpt.yql
new file mode 100644
index 0000000000..3ef2f4081b
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/SortOpt.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Just (Uint32 '2)) (Just (String 'D)))
+'((Nothing (OptionalType (DataType 'Uint32))) (Just (String 'E)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+'((Just (Uint32 '3)) (Nothing (OptionalType (DataType 'String))))
+'((Just (Uint32 '2)) (Just (String 'B)))
+))
+
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let data (Sort list (Bool 'true) keyExtractor))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/SortOptTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/SortOptTuple.yql
new file mode 100644
index 0000000000..ddfb0a7e16
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/SortOptTuple.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Just (Uint32 '2)) (Just (String 'D)))
+'((Nothing (OptionalType (DataType 'Uint32))) (Just (String 'E)))
+'((Just (Uint32 '3)) (Just (String 'A)))
+'((Just (Uint32 '3)) (Nothing (OptionalType (DataType 'String))))
+'((Just (Uint32 '2)) (Just (String 'B)))
+))
+
+(let keyExtractor (lambda '(x) x))
+(let data (Sort list '((Bool 'false) (Bool 'false)) keyExtractor))
+
+(let world (Write! world res_sink (Key) data '()))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/SqlAccess.yql b/yql/essentials/tests/s-expressions/suites/InMem/SqlAccess.yql
new file mode 100644
index 0000000000..9ad041b115
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/SqlAccess.yql
@@ -0,0 +1,74 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let t '((Int32 '34) (String 'qwe)))
+(let l (AsList (Int32 '34) (Int32 '56)))
+(let s (AsStruct '('a (String 'ccc)) '('b (Double '3.5))))
+(let d (AsDict
+ '((Just (Uint32 '4)) (String 'aaa))
+ '((Nothing (OptionalType (DataType 'Uint32))) (String 'bbb)))
+)
+
+(let vt1 (VariantType (TupleType (DataType 'Int32) (DataType 'String))))
+(let v1 (Variant (Int32 '34) '0 vt1))
+
+(let vt2 (VariantType (StructType '('a (DataType 'Int32)) '('b (DataType 'String)))))
+(let v2 (Variant (Int32 '34) 'a vt2))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple t '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple t '1) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple v1 '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple v1 '1) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Just t) '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Just t) '1) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Just v1) '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Just v1) '1) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Nothing (OptionalType (TypeOf t))) '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Nothing (OptionalType (TypeOf t))) '1) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Nothing (OptionalType (TypeOf v1))) '0) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'tuple (Nothing (OptionalType (TypeOf v1))) '1) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'struct s 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct s 'b) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct v2 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct v2 'b) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Just s) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Just s) 'b) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Just v2) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Just v2) 'b) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Nothing (OptionalType (TypeOf s))) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Nothing (OptionalType (TypeOf s))) 'b) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Nothing (OptionalType (TypeOf v2))) 'a) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'struct (Nothing (OptionalType (TypeOf v2))) 'b) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'dict l (Uint64 '0)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict l (Uint64 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict l (Uint64 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict d (Uint32 '4)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict d (Uint32 '5)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict d (Nothing (OptionalType (DataType 'Uint32)))) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just l) (Uint64 '0)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just l) (Uint64 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just l) (Uint64 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just d) (Uint32 '4)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just d) (Uint32 '5)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Just d) (Nothing (OptionalType (DataType 'Uint32)))) '('('type))))
+
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf l))) (Uint64 '0)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf l))) (Uint64 '1)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf l))) (Uint64 '2)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf d))) (Uint32 '4)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf d))) (Uint32 '5)) '('('type))))
+(let world (Write! world res_sink (Key) (SqlAccess 'dict (Nothing (OptionalType (TypeOf d))) (Nothing (OptionalType (DataType 'Uint32)))) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StaticMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/StaticMap.yql
new file mode 100644
index 0000000000..c4c247d675
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StaticMap.yql
@@ -0,0 +1,18 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let default (lambda '(x) (block '(
+ (return (Coalesce x (Default (OptionalItemType (TypeOf x)))))
+))))
+
+(let tuple '((Just (Uint32 '1)) (Just (String 'X))))
+(let struct (AsStruct '('a (Nothing (OptionalType (DataType 'Uint32)))) '('b (Just (String 'Y)))))
+
+(let world (Write! world res_sink (Key) (StaticMap tuple default) '('('type))))
+(let world (Write! world res_sink (Key) (StaticMap struct default) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamDiscard.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamDiscard.yql
new file mode 100644
index 0000000000..adf904774d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamDiscard.yql
@@ -0,0 +1,11 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list1 (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let world (Write! world res_sink (Key) (Collect (Discard (Iterator list1))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamExtend.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamExtend.yql
new file mode 100644
index 0000000000..0e04475199
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamExtend.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list1 (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let list2 (AsList (Uint32 '4) (Uint32 '5) (Uint32 '6)))
+(let list3 (AsList (Uint32 '7) (Uint32 '8) (Uint32 '9)))
+(let world (Write! world res_sink (Key) (Collect (Extend (Iterator list1) (Iterator list2) (Iterator list3))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamFilter.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamFilter.yql
new file mode 100644
index 0000000000..ce40b9f8a9
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamFilter.yql
@@ -0,0 +1,12 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let world (Write! world res_sink (Key) (Collect (Filter (Iterator list)
+ (lambda '(x) (!= (Uint32 '0) (BitAnd x (Uint32 '1)))))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamFlatMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamFlatMap.yql
new file mode 100644
index 0000000000..9a23a4d591
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamFlatMap.yql
@@ -0,0 +1,21 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (Int32 '1) (Int32 '2) (Int32 '3)))
+(let world (Write! world res_sink (Key) (Collect (FlatMap (Iterator list (DependsOn (String 'A)))
+ (lambda '(x) (AsList x x)))) '('('type))))
+(let add (lambda '(y) (+ y (Int32 '10))))
+(let world (Write! world res_sink (Key) (Collect (FlatMap (Iterator list (DependsOn (String 'B)))
+ (lambda '(x) (Map (/ (Int32 '5) (- (Int32 '2) x)) add)))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (FlatMap (Iterator list (DependsOn (String 'C)))
+ (lambda '(x) (Iterator (AsList x x))))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (FlatMap list
+ (lambda '(x) (Iterator (AsList x x))))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (FlatMap (/ (Int32 '3) (Int32 '1))
+ (lambda '(x) (Iterator (AsList x x))))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamFold1Map.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamFold1Map.yql
new file mode 100644
index 0000000000..5acfe5d46d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamFold1Map.yql
@@ -0,0 +1,42 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'r))
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '3) (String 'b))
+'((Uint32 '5) (String 'i))
+'((Uint32 '8) (String 't))))
+
+(let init (lambda '(item) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey key)
+ (let sval val)
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (Fold1Map (Iterator list) init update))
+
+(let world (Write! world res_sink (Key) (Collect result) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamFoldMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamFoldMap.yql
new file mode 100644
index 0000000000..78557d82b8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamFoldMap.yql
@@ -0,0 +1,32 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'b))
+'((Uint32 '2) (String 'o))
+'((Uint32 '1) (String 'm))
+'((Uint32 '3) (String 'b))))
+
+(let init_state '((Uint32 '0) (String '"")))
+
+(let update (lambda '(item state) (block '(
+ (let key (Nth item '0))
+ (let val (Nth item '1))
+ (let skey (Nth state '0))
+ (let sval (Nth state '1))
+ (let skey (+ skey key))
+ (let sval (Concat sval val))
+ (let new_item '(key val skey sval))
+ (let new_state '(skey sval))
+ (return '(new_item new_state)
+)))))
+
+(let result (FoldMap (Iterator list) init_state update))
+
+(let world (Write! world res_sink (Key) (Collect result) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamInCombineByKey.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamInCombineByKey.yql
new file mode 100644
index 0000000000..e58ebc251e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamInCombineByKey.yql
@@ -0,0 +1,16 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList '((Uint32 '1) (String 'a)) '((Uint32 '1) (String 'b)) '((Uint32 '2) (String 'c))))
+(let premap (lambda '(x) (Iterator (AsList x))))
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let handlerInit (lambda '(key item) (Nth item '1)))
+(let handlerUpdate (lambda '(key item state) (Concat (Nth item '1) state)))
+(let handlerFinish (lambda '(key state) (Iterator (AsList '(key state)))))
+(let world (Write! world res_sink (Key) (CombineByKey list premap keyExtractor handlerInit handlerUpdate handlerFinish) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamInGroupByKey.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamInGroupByKey.yql
new file mode 100644
index 0000000000..5eae4467ff
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamInGroupByKey.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList '((Uint32 '1) (String 'a)) '((Uint32 '1) (String 'b)) '((Uint32 '2) (String 'c))))
+(let keyExtractor (lambda '(x) (Nth x '0)))
+(let handler (lambda '(key list) (Iterator (AsList key key))))
+(let world (Write! world res_sink (Key) (GroupByKey list keyExtractor handler) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamMap.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamMap.yql
new file mode 100644
index 0000000000..cb48729c8f
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamMap.yql
@@ -0,0 +1,12 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let world (Write! world res_sink (Key) (Collect (Map (Iterator list)
+ (lambda '(x) (+ (Uint32 '10) x)))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamSkip.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamSkip.yql
new file mode 100644
index 0000000000..3d553a2b36
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamSkip.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list1 (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let list2 (AsList (Uint32 '4) (Uint32 '5) (Uint32 '6)))
+(let world (Write! world res_sink (Key) (Collect (Skip (Iterator list1) (Uint64 '2))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (Skip (Iterator list2) (Uint64 '0))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StreamTake.yql b/yql/essentials/tests/s-expressions/suites/InMem/StreamTake.yql
new file mode 100644
index 0000000000..0870b1aac3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StreamTake.yql
@@ -0,0 +1,13 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list1 (AsList (Uint32 '1) (Uint32 '2) (Uint32 '3)))
+(let list2 (AsList (Uint32 '4) (Uint32 '5) (Uint32 '6)))
+(let world (Write! world res_sink (Key) (Collect (Take (Iterator list1) (Uint64 '2))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (Take (Iterator list2) (Uint64 '0))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StringContains.yql b/yql/essentials/tests/s-expressions/suites/InMem/StringContains.yql
new file mode 100644
index 0000000000..9d5e42e3cf
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StringContains.yql
@@ -0,0 +1,19 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let world (Write! world res_sink (Key) (StringContains (Utf8 '12345) (String '"")) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Just (String '12345)) (String '346)) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (String '12345) (Just (String '012345))) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Just (String '567)) (Just (Utf8 '67))) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Utf8 'abcad) (String 'bc)) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Utf8 'xyz) (Utf8 'xyz)) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Utf8 'one) (Null)) '('('type))))
+(let world (Write! world res_sink (Key) (StringContains (Null) (Utf8 'two)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/StringWith.yql b/yql/essentials/tests/s-expressions/suites/InMem/StringWith.yql
new file mode 100644
index 0000000000..c6b3b3de2d
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/StringWith.yql
@@ -0,0 +1,28 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let world (Write! world res_sink (Key) (StartsWith (Utf8 '12345) (String '"")) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Just (String '12345)) (String '124)) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (String '12345) (Just (String '123456))) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Just (String '567)) (Just (Utf8 '56))) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Utf8 'abcad) (String 'ab)) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Utf8 'xyz) (Utf8 'xyz)) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Utf8 'one) (Null)) '('('type))))
+(let world (Write! world res_sink (Key) (StartsWith (Null) (Utf8 'two)) '('('type))))
+
+(let world (Write! world res_sink (Key) (EndsWith (Utf8 '12345) (String '"")) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Just (String '12345)) (String '346)) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (String '12345) (Just (String '012345))) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Just (String '567)) (Just (Utf8 '67))) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Utf8 'abcad) (String 'ad)) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Utf8 'xyz) (Utf8 'xyz)) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Utf8 'one) (Null)) '('('type))))
+(let world (Write! world res_sink (Key) (EndsWith (Null) (Utf8 'two)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Switch.yql b/yql/essentials/tests/s-expressions/suites/InMem/Switch.yql
new file mode 100644
index 0000000000..9c17ddd66e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Switch.yql
@@ -0,0 +1,34 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList (String 'aaa) (String 'bbb) (String 'ccc)))
+(let id (lambda '(x) x))
+# id
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator list (DependsOn (String 'A))) '1 '('0) id)) '('('type))))
+# clone
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator list (DependsOn (String 'B))) '1 '('0) id '('0) id)) '('('type))))
+# separate
+(let tupleType (TupleType (DataType 'String) (DataType 'String)))
+(let vt (VariantType tupleType))
+(let vlist (AsList (Variant (String 'aaa) '0 vt) (Variant (String 'bbb) '1 vt) (Variant (String 'ccc) '0 vt)))
+(let handlerSplit1 (lambda '(x) (Map x (lambda '(s) (Concat (String '"#0: ") s)))))
+(let handlerSplit2 (lambda '(x) (Map x (lambda '(s) (Concat (String '"#1: ") s)))))
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator vlist (DependsOn (String 'D))) '1 '('1) handlerSplit2 '('0) handlerSplit1)) '('('type))))
+# reunion
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator vlist (DependsOn (String 'E))) '1 '('0 '1) id)) '('('type))))
+# reunion and parts
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator vlist (DependsOn (String 'F))) '1 '('0 '1) id '('1) handlerSplit2 '('0) handlerSplit1)) '('('type))))
+# multiple outputs
+(let twice (lambda '(x) (FlatMap x (lambda '(s) (AsList
+ (Variant (Concat (String '"#0: ") s) '0 vt)
+ (Variant (Concat (String '"#1: ") s) '1 vt)
+ )))))
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator list (DependsOn (String 'G))) '1 '('0) twice)) '('('type))))
+# split and multiple outputs
+(let world (Write! world res_sink (Key) (Collect (Switch (Iterator list (DependsOn (String 'H))) '1 '('0) twice '('0) twice)) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/TimezoneIdName.yql b/yql/essentials/tests/s-expressions/suites/InMem/TimezoneIdName.yql
new file mode 100644
index 0000000000..4ad7ec02d1
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/TimezoneIdName.yql
@@ -0,0 +1,10 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let world (Write! world res_sink (Key) (TimezoneName (TimezoneId (String '"Europe/Moscow"))) '('('type))))
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql
new file mode 100644
index 0000000000..aa9ed74d8f
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql
@@ -0,0 +1,82 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+
+(let test (lambda '(world data dataType) (block '(
+ (let world (Write! world res_sink (Key) (ToBytes data) '('('type))))
+ (let world (Write! world res_sink (Key) (FromBytes (ToBytes data) dataType) '('('type))))
+ (return world)
+))))
+
+(let testEmpty (lambda '(world dataType) (block '(
+ (let n (ToBytes (Nothing (OptionalType (DataType dataType)))))
+ (let world (Write! world res_sink (Key) n '('('type))))
+ (let world (Write! world res_sink (Key) (FromBytes n dataType) '('('type))))
+ (return world)
+))))
+
+(let testFail (lambda '(world bytes dataType) (block '(
+ (let world (Write! world res_sink (Key) (Exists (FromBytes bytes dataType)) '('('type))))
+ (return world)
+))))
+
+(let world (Apply test world (Uint8 '7) 'Uint8))
+(let world (Apply test world (Bool 'True) 'Bool))
+(let world (Apply test world (Bool 'False) 'Bool))
+(let world (Apply test world (Int32 'x"abcdef12") 'Int32))
+(let world (Apply test world (Int64 'x"71717171abcdef12") 'Int64))
+(let world (Apply test world (Uint32 'x"abcdef12") 'Uint32))
+(let world (Apply test world (Uint64 'x"ddddddddabcdef12") 'Uint64))
+(let world (Apply test world (Float '2) 'Float))
+(let world (Apply test world (Double '2) 'Double))
+(let world (Apply test world (String '"abc") 'String))
+(let world (Apply test world (Utf8 '"яндекс") 'Utf8))
+(let world (Apply test world (Yson '"[1;2]") 'Yson))
+(let world (Apply test world (Json '@@{"id":1}@@) 'Json))
+
+(let world (Apply test world (Just (Uint8 '7)) 'Uint8))
+(let world (Apply test world (Just (Bool 'True)) 'Bool))
+(let world (Apply test world (Just (Bool 'False)) 'Bool))
+(let world (Apply test world (Just (Int32 'x"abcdef12")) 'Int32))
+(let world (Apply test world (Just (Int64 'x"71717171abcdef12")) 'Int64))
+(let world (Apply test world (Just (Uint32 'x"abcdef12")) 'Uint32))
+(let world (Apply test world (Just (Uint64 'x"ddddddddabcdef12")) 'Uint64))
+(let world (Apply test world (Just (Float '2)) 'Float))
+(let world (Apply test world (Just (Double '2)) 'Double))
+(let world (Apply test world (Just (String '"abc")) 'String))
+(let world (Apply test world (Just (Utf8 '"яндекс")) 'Utf8))
+(let world (Apply test world (Just (Yson '"[1;2]")) 'Yson))
+(let world (Apply test world (Just (Json '@@{"id":1}@@)) 'Json))
+
+(let world (Apply testEmpty world 'Uint8))
+(let world (Apply testEmpty world 'Bool))
+(let world (Apply testEmpty world 'Int32))
+(let world (Apply testEmpty world 'Int64))
+(let world (Apply testEmpty world 'Uint32))
+(let world (Apply testEmpty world 'Uint64))
+(let world (Apply testEmpty world 'Float))
+(let world (Apply testEmpty world 'Double))
+(let world (Apply testEmpty world 'String))
+(let world (Apply testEmpty world 'Utf8))
+(let world (Apply testEmpty world 'Yson))
+(let world (Apply testEmpty world 'Json))
+
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Uint8))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Bool))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Int32))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Int64))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Uint32))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Uint64))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Float))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'Double))
+(let world (Apply testFail world (Nothing (OptionalType (DataType 'String))) 'String))
+(let world (Apply testFail world (String 'x"ffff") 'Utf8))
+(let world (Apply testFail world (String '"][") 'Yson))
+(let world (Apply testFail world (String '"}{") 'Json))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToDict.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToDict.yql
new file mode 100644
index 0000000000..c66f952fa6
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToDict.yql
@@ -0,0 +1,35 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let macro (lambda '(world name flags) (block '(
+
+(let dict (ToDict list (lambda '(x) (Nth x '0)) (lambda '(x) (Nth x '1)) flags))
+
+(let world (Write! world res_sink (Key) (String name) '()))
+(let world (Write! world res_sink (Key) dict '('('type))))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '1)) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '2)) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '3)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '1)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '2)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '3)) '()))
+
+(return world)
+))))
+
+(let world (Apply macro world 'Sorted/One '('Sorted 'One)))
+(let world (Apply macro world 'Sorted/Many '('Sorted 'Many)))
+(let world (Apply macro world 'Hashed/One '('Hashed 'One)))
+(let world (Apply macro world 'Hashed/Many '('Hashed 'Many)))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToDictOpt.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOpt.yql
new file mode 100644
index 0000000000..0a2fab711e
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOpt.yql
@@ -0,0 +1,39 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Just (Uint32 '1)) (String 'a))
+'((Just (Uint32 '2)) (String 'b))
+'((Just (Uint32 '1)) (String 'c))
+'((Nothing (OptionalType (DataType 'Uint32))) (String 'd))
+))
+
+(let macro (lambda '(world name flags) (block '(
+
+(let dict (ToDict list (lambda '(x) (Nth x '0)) (lambda '(x) (Nth x '1)) flags))
+
+(let world (Write! world res_sink (Key) (String name) '()))
+(let world (Write! world res_sink (Key) dict '('('type))))
+(let world (Write! world res_sink (Key) (Contains dict (Just (Uint32 '1))) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Just (Uint32 '2))) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Just (Uint32 '3))) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Nothing (OptionalType (DataType 'Uint32)))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Just (Uint32 '1))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Just (Uint32 '2))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Just (Uint32 '3))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Nothing (OptionalType (DataType 'Uint32)))) '()))
+
+(return world)
+))))
+
+(let world (Apply macro world 'Sorted/One '('Sorted 'One)))
+(let world (Apply macro world 'Sorted/Many '('Sorted 'Many)))
+(let world (Apply macro world 'Hashed/One '('Hashed 'One)))
+(let world (Apply macro world 'Hashed/Many '('Hashed 'Many)))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToDictOptTuple.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOptTuple.yql
new file mode 100644
index 0000000000..a76f483330
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOptTuple.yql
@@ -0,0 +1,41 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'('((Just (Uint32 '1)) (String 'a)) (String 'eee))
+'('((Just (Uint32 '2)) (String 'b)) (String 'fff))
+'('((Just (Uint32 '1)) (String 'a)) (String 'ggg))
+'('((Nothing (OptionalType (DataType 'Uint32))) (String 'd)) (String 'hhh))
+))
+
+(let macro (lambda '(world name flags) (block '(
+
+(let dict (ToDict list (lambda '(x) (Nth x '0)) (lambda '(x) (Nth x '1)) flags))
+
+(let world (Write! world res_sink (Key) (String name) '()))
+(let world (Write! world res_sink (Key) dict '('('type))))
+(let world (Write! world res_sink (Key) (Contains dict '((Just (Uint32 '1)) (String 'a))) '()))
+(let world (Write! world res_sink (Key) (Contains dict '((Just (Uint32 '2)) (String 'b))) '()))
+(let world (Write! world res_sink (Key) (Contains dict '((Just (Uint32 '1)) (String 'c))) '()))
+(let world (Write! world res_sink (Key) (Contains dict '((Just (Uint32 '2)) (String 'a))) '()))
+(let world (Write! world res_sink (Key) (Contains dict '((Nothing (OptionalType (DataType 'Uint32))) (String 'd))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict '((Just (Uint32 '1)) (String 'a))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict '((Just (Uint32 '2)) (String 'b))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict '((Just (Uint32 '1)) (String 'c))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict '((Just (Uint32 '2)) (String 'a))) '()))
+(let world (Write! world res_sink (Key) (Lookup dict '((Nothing (OptionalType (DataType 'Uint32))) (String 'd))) '()))
+
+(return world)
+))))
+
+(let world (Apply macro world 'Sorted/One '('Sorted 'One)))
+(let world (Apply macro world 'Sorted/Many '('Sorted 'Many)))
+(let world (Apply macro world 'Hashed/One '('Hashed 'One)))
+(let world (Apply macro world 'Hashed/Many '('Hashed 'Many)))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToDictOverOptList.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOverOptList.yql
new file mode 100644
index 0000000000..bbb90c5408
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToDictOverOptList.yql
@@ -0,0 +1,35 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+'((Uint32 '1) (String 'a))
+'((Uint32 '2) (String 'b))
+'((Uint32 '1) (String 'c))))
+
+(let macro (lambda '(world name flags) (block '(
+
+(let dict (ToDict (Just list) (lambda '(x) (Nth x '0)) (lambda '(x) (Nth x '1)) flags))
+
+(let world (Write! world res_sink (Key) (String name) '()))
+(let world (Write! world res_sink (Key) dict '('('type))))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '1)) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '2)) '()))
+(let world (Write! world res_sink (Key) (Contains dict (Uint32 '3)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '1)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '2)) '()))
+(let world (Write! world res_sink (Key) (Lookup dict (Uint32 '3)) '()))
+
+(return world)
+))))
+
+(let world (Apply macro world 'Sorted/One '('Sorted 'One)))
+(let world (Apply macro world 'Sorted/Many '('Sorted 'Many)))
+(let world (Apply macro world 'Hashed/One '('Hashed 'One)))
+(let world (Apply macro world 'Hashed/Many '('Hashed 'Many)))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/ToOptional.yql b/yql/essentials/tests/s-expressions/suites/InMem/ToOptional.yql
new file mode 100644
index 0000000000..b9e3d077ae
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/ToOptional.yql
@@ -0,0 +1,29 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let test (lambda '(world data) (block '(
+ (let world (Write! world res_sink (Key) (ToOptional data) '('('type))))
+ (return world)
+))))
+
+(let listType (ListType (DataType 'String)))
+(let callableType (CallableType '() '(listType)))
+
+(let callable1 (Callable callableType (lambda '() (List listType))))
+(let callable2 (Callable callableType (lambda '() (List listType (String 'A)))))
+(let callable3 (Callable callableType (lambda '() (List listType (String 'A) (String 'B)))))
+
+(let world (Apply test world (List listType)))
+(let world (Apply test world (List listType (String 'a))))
+(let world (Apply test world (List listType (String 'a) (String 'b))))
+
+(let world (Apply test world (Apply callable1)))
+(let world (Apply test world (Apply callable2)))
+(let world (Apply test world (Apply callable3)))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Top.yql b/yql/essentials/tests/s-expressions/suites/InMem/Top.yql
new file mode 100644
index 0000000000..0e8ab78955
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Top.yql
@@ -0,0 +1,27 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(let res_sink (DataSink 'result))
+(let list (AsList
+ (AsStruct '('a (Uint32 '4)) '('b (String 'c)))
+ (AsStruct '('a (Uint32 '1)) '('b (String 'd)))
+ (AsStruct '('a (Uint32 '3)) '('b (String 'b)))
+ (AsStruct '('a (Uint32 '2)) '('b (String 'a)))
+ (AsStruct '('a (Uint32 '5)) '('b (String 'y)))
+ (AsStruct '('a (Uint32 '1)) '('b (String 'z)))
+))
+(let world (Write! world res_sink (Key) (Top list (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'b))) '('('type))))
+(let world (Write! world res_sink (Key) (Top list (Uint64 '3) (Bool 'False) (lambda '(item) (Member item 'b))) '('('type))))
+(let world (Write! world res_sink (Key) (Top list (Uint64 '3) '((Bool 'True) (Bool 'True)) (lambda '(item) '((Member item 'a) (Member item 'b)))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (Top (Iterator list (DependsOn (String 'a))) (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'b)))) '('('type))))
+
+(let world (Write! world res_sink (Key) (TopSort list (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'b))) '('('type))))
+(let world (Write! world res_sink (Key) (TopSort list (Uint64 '3) (Bool 'False) (lambda '(item) (Member item 'b))) '('('type))))
+(let world (Write! world res_sink (Key) (TopSort list (Uint64 '3) '((Bool 'True) (Bool 'True)) (lambda '(item) '((Member item 'a) (Member item 'b)))) '('('type))))
+(let world (Write! world res_sink (Key) (Collect (TopSort (Iterator list (DependsOn (String 'b))) (Uint64 '3) (Bool 'True) (lambda '(item) (Member item 'b)))) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/VariantItem.yql b/yql/essentials/tests/s-expressions/suites/InMem/VariantItem.yql
new file mode 100644
index 0000000000..5b2d4c3930
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/VariantItem.yql
@@ -0,0 +1,50 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import id_module '"/lib/yql/id.yql")
+(let id (bind id_module 'id))
+
+(let res_sink (DataSink 'result))
+(let vt (VariantType (TupleType (DataType 'Int32) (DataType 'Int32))))
+(let v1 (Variant (Int32 '34) '0 vt))
+(let v2 (Variant (Int32 '42) '1 vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (VariantItem v1) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem v2) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem jv1) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem jv2) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem n) '('('type))))
+
+(let world (Write! world res_sink (Key) (VariantItem (Apply id v1)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id v2)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id jv1)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id jv2)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id n)) '('('type))))
+
+(let vt (VariantType (StructType '('a (DataType 'Int32)) '('b (DataType 'Int32)))))
+(let v1 (Variant (Int32 '34) 'a vt))
+(let v2 (Variant (Int32 '42) 'b vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (VariantItem v1) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem v2) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem jv1) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem jv2) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem n) '('('type))))
+
+(let world (Write! world res_sink (Key) (VariantItem (Apply id v1)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id v2)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id jv1)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id jv2)) '('('type))))
+(let world (Write! world res_sink (Key) (VariantItem (Apply id n)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Visit.cfg b/yql/essentials/tests/s-expressions/suites/InMem/Visit.cfg
new file mode 100644
index 0000000000..e41deb15c5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Visit.cfg
@@ -0,0 +1,2 @@
+res result.txt
+mount ..\mounts.txt
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Visit.yql b/yql/essentials/tests/s-expressions/suites/InMem/Visit.yql
new file mode 100644
index 0000000000..0616a5100c
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Visit.yql
@@ -0,0 +1,59 @@
+(
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import id_module '"/lib/yql/id.yql")
+(let id (bind id_module 'id))
+
+#comment
+(let res_sink (DataSink 'result))
+(let vt (VariantType (TupleType (DataType 'Int32) (DataType 'String))))
+(let v1 (Variant (Int32 '34) '0 vt))
+(let v2 (Variant (String 'qwe) '1 vt))
+
+(let handler1 (lambda '(x) (Concat (String '"handler1:") (ToString (+ (Uint32 '100) x)))))
+(let handler2 (lambda '(x) (Concat (String '"handler2:") x)))
+
+(let world (Write! world res_sink (Key) (Visit v1 '0 handler1 '1 handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 '0 handler1 '1 handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 '0 handler1 (String 'q1)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 '1 handler2 (String 'q2)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 '0 handler1 (String 'q3)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 '1 handler2 (String 'q4)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 (String 'q5)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 (String 'q6)) '('('type))))
+
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) '0 handler1 '1 handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) '1 handler2 '0 handler1) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) '0 handler1 (String 'q1)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) '1 handler2 (String 'q2)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) '0 handler1 (String 'q3)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) '1 handler2 (String 'q4)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) (String 'q5)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) (String 'q6)) '('('type))))
+
+(let vt (VariantType (StructType '('a (DataType 'Int32)) '('b (DataType 'String)))))
+(let v1 (Variant (Int32 '34) 'a vt))
+(let v2 (Variant (String 'qwe) 'b vt))
+
+(let world (Write! world res_sink (Key) (Visit v1 'a handler1 'b handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 'b handler2 'a handler1) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 'a handler1 (String 'r1)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 'b handler2 (String 'r2)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 'a handler1 (String 'r3)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 'b handler2 (String 'r4)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v1 (String 'r5)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit v2 (String 'r6)) '('('type))))
+
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) 'a handler1 'b handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) 'a handler1 'b handler2) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) 'a handler1 (String 'r1)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) 'b handler2 (String 'r2)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) 'a handler1 (String 'r3)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) 'b handler2 (String 'r4)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v1) (String 'r5)) '('('type))))
+(let world (Write! world res_sink (Key) (Visit (Apply id v2) (String 'r6)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Way.cfg b/yql/essentials/tests/s-expressions/suites/InMem/Way.cfg
new file mode 100644
index 0000000000..e41deb15c5
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Way.cfg
@@ -0,0 +1,2 @@
+res result.txt
+mount ..\mounts.txt
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/Way.yql b/yql/essentials/tests/s-expressions/suites/InMem/Way.yql
new file mode 100644
index 0000000000..a1e2043ec3
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/Way.yql
@@ -0,0 +1,50 @@
+(
+#comment
+(let config (DataSource 'config))
+(let world (Configure! world config 'PureDataSource 'yt))
+
+(import id_module '"/lib/yql/id.yql")
+(let id (bind id_module 'id))
+
+(let res_sink (DataSink 'result))
+(let vt (VariantType (TupleType (DataType 'Int32) (DataType 'String))))
+(let v1 (Variant (Int32 '34) '0 vt))
+(let v2 (Variant (String 'qwe) '1 vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (Way v1) '('('type))))
+(let world (Write! world res_sink (Key) (Way v2) '('('type))))
+(let world (Write! world res_sink (Key) (Way jv1) '('('type))))
+(let world (Write! world res_sink (Key) (Way jv2) '('('type))))
+(let world (Write! world res_sink (Key) (Way n) '('('type))))
+
+(let world (Write! world res_sink (Key) (Way (Apply id v1)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id v2)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id jv1)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id jv2)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id n)) '('('type))))
+
+(let vt (VariantType (StructType '('a (DataType 'Int32)) '('b (DataType 'String)))))
+(let v1 (Variant (Int32 '34) 'a vt))
+(let v2 (Variant (String 'qwe) 'b vt))
+(let jv1 (Just v1))
+(let jv2 (Just v2))
+(let n (Nothing (TypeOf jv1)))
+
+(let world (Write! world res_sink (Key) (Way v1) '('('type))))
+(let world (Write! world res_sink (Key) (Way v2) '('('type))))
+(let world (Write! world res_sink (Key) (Way jv1) '('('type))))
+(let world (Write! world res_sink (Key) (Way jv2) '('('type))))
+(let world (Write! world res_sink (Key) (Way n) '('('type))))
+
+(let world (Write! world res_sink (Key) (Way (Apply id v1)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id v2)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id jv1)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id jv2)) '('('type))))
+(let world (Write! world res_sink (Key) (Way (Apply id n)) '('('type))))
+
+(let world (Commit! world res_sink))
+(return world)
+)
diff --git a/yql/essentials/tests/s-expressions/suites/InMem/default.cfg b/yql/essentials/tests/s-expressions/suites/InMem/default.cfg
new file mode 100644
index 0000000000..00dec6c3f8
--- /dev/null
+++ b/yql/essentials/tests/s-expressions/suites/InMem/default.cfg
@@ -0,0 +1 @@
+res result.txt