HasNullTrue.yql 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (
  2. (let config (DataSource 'config))
  3. (let world (Configure! world config 'PureDataSource 'yt))
  4. (let res_sink (DataSink 'result))
  5. # Optional
  6. (let value (Nothing (OptionalType (DataType 'Int32))))
  7. (let world (Write! world res_sink (Key) (HasNull value) '()))
  8. (let value (Just (Nothing (OptionalType (DataType 'Int32)))))
  9. (let world (Write! world res_sink (Key) (HasNull value) '()))
  10. # Null
  11. (let value (Null))
  12. (let world (Write! world res_sink (Key) (HasNull value) '()))
  13. (let value (Just (Null)))
  14. (let world (Write! world res_sink (Key) (HasNull value) '()))
  15. (let value (Nothing (OptionalType (NullType))))
  16. (let world (Write! world res_sink (Key) (HasNull value) '()))
  17. (let value (Just (Nothing (OptionalType (NullType)))))
  18. (let world (Write! world res_sink (Key) (HasNull value) '()))
  19. # Tuple
  20. (let value '((Int32 '1) (String 'test) (Nothing (OptionalType (DataType 'Int32)))))
  21. (let world (Write! world res_sink (Key) (HasNull value) '()))
  22. # Struct
  23. (let value (AsStruct '('a (Int32 '1)) '('b (Just (Nothing (OptionalType (DataType 'Int32)))))))
  24. (let world (Write! world res_sink (Key) (HasNull value) '()))
  25. # Variant
  26. (let valueType (VariantType (TupleType (DataType 'Int32) (NullType))))
  27. (let value (Variant (Null) '1 valueType))
  28. (let world (Write! world res_sink (Key) (HasNull value) '()))
  29. (let valueType (VariantType (StructType '('a (DataType 'Int32)) '('b (OptionalType (DataType 'String))))))
  30. (let value (Variant (Nothing (OptionalType (DataType 'String))) 'b valueType))
  31. (let world (Write! world res_sink (Key) (HasNull value) '()))
  32. # List
  33. (let value (AsList (Null) (Int32 '1) (Int32 '2)))
  34. (let world (Write! world res_sink (Key) (HasNull value) '()))
  35. (let value (AsList (Int32 '1) (Int32 '2) (Null)))
  36. (let world (Write! world res_sink (Key) (HasNull value) '()))
  37. (let world (Commit! world res_sink))
  38. (return world)
  39. )