Compare `left` and `right` using `order`. If that doesn't produce a strict ordering, call `tiebreaker`.
(
order: &[ColumnOrder],
left: &[Datum],
right: &[Datum],
tiebreaker: F,
)
| 3833 | /// Compare `left` and `right` using `order`. If that doesn't produce a strict |
| 3834 | /// ordering, call `tiebreaker`. |
| 3835 | pub fn compare_columns<F>( |
| 3836 | order: &[ColumnOrder], |
| 3837 | left: &[Datum], |
| 3838 | right: &[Datum], |
| 3839 | tiebreaker: F, |
| 3840 | ) -> Ordering |
| 3841 | where |
| 3842 | F: Fn() -> Ordering, |
| 3843 | { |
| 3844 | for order in order { |
| 3845 | let cmp = match (&left[order.column], &right[order.column]) { |
| 3846 | (Datum::Null, Datum::Null) => Ordering::Equal, |
| 3847 | (Datum::Null, _) => { |
| 3848 | if order.nulls_last { |
| 3849 | Ordering::Greater |
| 3850 | } else { |
| 3851 | Ordering::Less |
| 3852 | } |
| 3853 | } |
| 3854 | (_, Datum::Null) => { |
| 3855 | if order.nulls_last { |
| 3856 | Ordering::Less |
| 3857 | } else { |
| 3858 | Ordering::Greater |
| 3859 | } |
| 3860 | } |
| 3861 | (lval, rval) => { |
| 3862 | if order.desc { |
| 3863 | rval.cmp(lval) |
| 3864 | } else { |
| 3865 | lval.cmp(rval) |
| 3866 | } |
| 3867 | } |
| 3868 | }; |
| 3869 | if cmp != Ordering::Equal { |
| 3870 | return cmp; |
| 3871 | } |
| 3872 | } |
| 3873 | tiebreaker() |
| 3874 | } |
| 3875 | |
| 3876 | /// Describe a window frame, e.g. `RANGE UNBOUNDED PRECEDING` or |
| 3877 | /// `ROWS BETWEEN 5 PRECEDING AND CURRENT ROW`. |
no test coverage detected