| 715 | } |
| 716 | |
| 717 | fn eq<'b>(left: ResultSpec<'b>, right: ResultSpec<'b>) -> ResultSpec<'b> { |
| 718 | eagerly(left, right, |left, right| { |
| 719 | // `eq` might return true if there's any overlap between the range of its two arguments... |
| 720 | let maybe_true = match left.clone().intersect(right.clone()) { |
| 721 | Values::Empty => ResultSpec::nothing(), |
| 722 | _ => ResultSpec::value(Datum::True), |
| 723 | }; |
| 724 | |
| 725 | // ...and may return false if the union contains at least two distinct values. |
| 726 | // Note that the `Empty` case is handled by `eagerly` above. |
| 727 | let maybe_false = match left.union(right) { |
| 728 | Values::Within(a, b) if a == b => ResultSpec::nothing(), |
| 729 | _ => ResultSpec::value(Datum::False), |
| 730 | }; |
| 731 | |
| 732 | maybe_true.union(maybe_false) |
| 733 | }) |
| 734 | } |
| 735 | |
| 736 | /// `add_timestamp_interval` and friends do calendar-month arithmetic |
| 737 | /// with day-clamping, which is non-monotone in either argument when |