TryRemoveAllOptionals2.yql 911 B

123456789101112131415161718192021222324
  1. (
  2. (let config (DataSource 'config))
  3. (let world (Configure! world config 'PureDataSource 'yt))
  4. (let res_sink (DataSink 'result))
  5. ### Tuple
  6. # (Int8?, String, (Int32, Int64)?, Just(Nothing(String?)) (success)
  7. (let value '((Just (Int8 '1)) (String 'str) (Just '((Int32 '2) (Int64 '3))) (Just (Nothing (OptionalType (DataType 'String))))))
  8. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  9. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  10. ### Struct
  11. # Struct<Int8?, String, (Int32, Int64)?> (success)
  12. (let value (AsStruct '('a (Just (Int8 '1))) '('b (String 'str)) '('c (Just '((Int32 '2) (Int64 '3)))) '('d (Just (Nothing (OptionalType (DataType 'String)))))))
  13. (let tryRemoveAllOptionalsResult (TryRemoveAllOptionals value))
  14. (let world (Write! world res_sink (Key) tryRemoveAllOptionalsResult '('('type))))
  15. (let world (Commit! world res_sink))
  16. (return world)
  17. )