tuples_compare.sql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. /* yt can not */
  4. pragma warning("disable", "4510");
  5. $type = Struct<x:Int32, y:Int32, z:Int32>;
  6. $keys = AsTuple(AsAtom("x"), AsAtom("y"), AsAtom("z"));
  7. $range_for = ($pred) -> (YQL::RangeComputeFor($type, $pred, $keys));
  8. $pred1 = ($row) -> (($row.x, $row.y, $row.z) >= (11, 22, 33));
  9. $pred2 = ($row) -> (($row.x, $row.y, $row.z) > (11, 22, 33));
  10. $pred3 = ($row) -> (($row.x, $row.y, $row.z) < (11, 22, 33));
  11. $pred4 = ($row) -> (($row.x, $row.y, $row.z) <= (11, 22, 33));
  12. $pred5 = ($row) -> (($row.x, $row.y, $row.z) > (111, 222, 333) and ($row.x, $row.y, $row.z) <= (111, 333, 444));
  13. $pred6 = ($row) -> (($row.x, $row.y, $row.z) >= (111, 222, 333) and ($row.x, $row.y, $row.z) < (111, 222, 333));
  14. select
  15. $range_for($pred1),
  16. $range_for($pred2),
  17. $range_for($pred3),
  18. $range_for($pred4),
  19. $range_for($pred5),
  20. $range_for($pred6),
  21. ;
  22. $pred1 = ($row) -> (($row.x, $row.y) >= (11, 22));
  23. $pred2 = ($row) -> (($row.x, $row.y) > (11, 22));
  24. $pred3 = ($row) -> (($row.x, $row.y) < (11, 22));
  25. $pred4 = ($row) -> (($row.x, $row.y) <= (11, 22));
  26. $pred5 = ($row) -> (($row.x, $row.y) > (111, 222) and ($row.x, $row.y) <= (111, 333));
  27. $pred6 = ($row) -> (($row.x, $row.y) >= (111, 222) and ($row.x, $row.y) < (111, 222));
  28. select
  29. $range_for($pred1),
  30. $range_for($pred2),
  31. $range_for($pred3),
  32. $range_for($pred4),
  33. $range_for($pred5),
  34. $range_for($pred6),
  35. ;