diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-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/ToBytes.yql')
-rw-r--r-- | yql/essentials/tests/s-expressions/suites/InMem/ToBytes.yql | 82 |
1 files changed, 82 insertions, 0 deletions
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) +) |