aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Casts/AlterToOverNull.yqls
blob: 6039cd0719b8cb9527f66813c3052c3bdc88b8f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(

(library "alterto.yql")
(import alterto_module '"alterto.yql")

(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))

# Null -> Uint16?
(let targetType (OptionalType (DataType 'Uint16)))
(let world (Apply (bind alterto_module 'doAlterTo) world (Null) targetType (Just (Uint16 '12345))))

# Just(Null) -> Null
(let alterToResult (AlterTo (Just (Null)) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
(let res_sink (DataSink 'result))
(let world (Write! world res_sink (Key) alterToResult '('('type))))

# Nothing(Null?) -> Null
(let alterToResult (AlterTo (Nothing (OptionalType (NullType))) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
(let res_sink (DataSink 'result))
(let world (Write! world res_sink (Key) alterToResult '('('type))))

# Nothing(Uint16?) -> Null
(let alterToResult (AlterTo (Nothing (OptionalType (DataType 'Uint16))) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
(let res_sink (DataSink 'result))
(let world (Write! world res_sink (Key) alterToResult '('('type))))

# Null -> Null?
(let alterToResult (AlterTo (Null) (OptionalType (NullType)) (lambda '(x) (String 'OK)) (String 'FAIL)))
(let res_sink (DataSink 'result))
(let world (Write! world res_sink (Key) alterToResult '('('type))))

(let world (Commit! world res_sink))
(return world)

)