merge_adjacent.sql 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. /* yt can not */
  4. pragma warning("disable", "4510");
  5. pragma warning("disable", "1108");
  6. -- basic in
  7. select YQL::RangeComputeFor(
  8. Struct<x:UInt32>,
  9. ($row) -> ($row.x in ListFromRange(-100, 100)),
  10. AsTuple(AsAtom("x"))
  11. );
  12. -- maxint
  13. select YQL::RangeComputeFor(
  14. Struct<x:Int32?>,
  15. ($row) -> (($row.x in ListFromRange(2147483547ul, 2147483648ul)) ?? false),
  16. AsTuple(AsAtom("x"))
  17. );
  18. -- date
  19. select YQL::RangeComputeFor(
  20. Struct<x:Date>,
  21. ($row) -> ($row.x in ListFromRange(Date("2105-01-01"), Date("2105-12-31")) or $row.x == Date("2105-12-31")),
  22. AsTuple(AsAtom("x"))
  23. );
  24. -- datetime
  25. select YQL::RangeComputeFor(
  26. Struct<x:Datetime>,
  27. ($row) -> ($row.x == Datetime("2105-12-31T23:59:58Z") or $row.x == Datetime("2105-12-31T23:59:59Z")),
  28. AsTuple(AsAtom("x"))
  29. );
  30. -- timestamp
  31. select YQL::RangeComputeFor(
  32. Struct<x:Timestamp>,
  33. ($row) -> ($row.x == Timestamp("2105-12-31T23:59:59.999998Z") or $row.x == Timestamp("2105-12-31T23:59:59.999999Z")),
  34. AsTuple(AsAtom("x"))
  35. );