in.sql 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 (1, 2, -1)),
  10. AsTuple(AsAtom("x"))
  11. );
  12. -- opaque collection
  13. select YQL::RangeComputeFor(
  14. Struct<x:UInt32>,
  15. ($row) -> ($row.x IN ListFromRange(-1, 3)),
  16. AsTuple(AsAtom("x"))
  17. );
  18. -- optional collection
  19. select YQL::RangeComputeFor(
  20. Struct<x:UInt32>,
  21. ($row) -> (($row.x IN Just(AsSet(-1, 1, 2))) ?? false),
  22. AsTuple(AsAtom("x"))
  23. );
  24. -- optional items
  25. select YQL::RangeComputeFor(
  26. Struct<x:UInt32>,
  27. ($row) -> (($row.x IN (-1, 10u, 20, 1/0)) ?? false),
  28. AsTuple(AsAtom("x"))
  29. );
  30. -- tuple
  31. select YQL::RangeComputeFor(
  32. Struct<x:UInt32, y:Uint32, z:Uint32>,
  33. ($row) -> (($row.y, $row.x, $row.z) IN [(1,2,3), (100,200,300)]),
  34. AsTuple(AsAtom("x"), AsAtom("y"), AsAtom("z"))
  35. );
  36. -- tuple partial
  37. select YQL::RangeComputeFor(
  38. Struct<x:UInt32, y:Uint32, z:Uint32>,
  39. ($row) -> (($row.y, $row.x, $row.z) IN [Just(Just((1,2,3))), (100,200,300), null]),
  40. AsTuple(AsAtom("x"), AsAtom("y"))
  41. );
  42. -- tuple with implicit nulls
  43. select YQL::RangeComputeFor(
  44. Struct<x:UInt32, y:Uint32, z:Uint32>,
  45. ($row) -> (($row.y, $row.x) IN ((1,2,3), (100, 200, 300))),
  46. AsTuple(AsAtom("x"), AsAtom("y"))
  47. );