aboutsummaryrefslogtreecommitdiffstats
path: root/ydb/library/yql/tests/s-expressions/suites/Casts/SafeCastOverResource.yql
blob: 11fd9ebc3065d3f3a32063b870ca2761bded68d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(

(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))
(let res_sink (DataSink 'result))


(let yson1 (Apply (Udf '"Yson2.Parse") (String '"#") (Just (NamedApply (Udf 'Yson2.Options) '() (AsStruct '('"AutoConvert" (Just (Bool '"false"))) '('"Strict" (Just (Bool '"false"))))))))
(let yson2 (Apply (Udf '"Yson2.Parse") (String '"[]") (Just (NamedApply (Udf 'Yson2.Options) '() (AsStruct '('"AutoConvert" (Just (Bool '"false"))) '('"Strict" (Just (Bool '"false"))))))))


(let targetType (ListType (ResourceType 'Yson2.Node)))
(let src (AsList (Just yson1) (Just yson2)))
(let cast (SafeCast src targetType))
(let world (Write! world res_sink (Key) (Map cast (lambda '(item) (Apply (Udf '"Yson2.Serialize") item))) '('('type))))

(let world (Commit! world res_sink))

(return world)

)