MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / compare_rows

Method compare_rows

src/expr/src/relation.rs:3809–3830  ·  view source on GitHub ↗

Compare two (references to) rows.

(
        &self,
        left_row: &RowRef,
        right_row: &RowRef,
        tiebreaker: impl Fn() -> Ordering,
    )

Source from the content-addressed store, hash-verified

3807
3808 /// Compare two (references to) rows.
3809 pub fn compare_rows(
3810 &self,
3811 left_row: &RowRef,
3812 right_row: &RowRef,
3813 tiebreaker: impl Fn() -> Ordering,
3814 ) -> Ordering {
3815 let order = if self.limit == 0 {
3816 Ordering::Equal
3817 } else {
3818 // These borrows should never fail, since this struct is non-sync and this function
3819 // is non-recursive.
3820 let mut left_ref = self.left_vec.borrow_mut();
3821 let mut right_ref = self.right_vec.borrow_mut();
3822 let left_cols = left_ref.borrow_with_limit(left_row, self.limit);
3823 let right_cols = right_ref.borrow_with_limit(right_row, self.limit);
3824 compare_columns(self.order.as_ref(), &left_cols, &right_cols, || {
3825 Ordering::Equal
3826 })
3827 };
3828 // Tiebreak without the vecs borrowed, in case that recursively invokes this function.
3829 order.then_with(tiebreaker)
3830 }
3831}
3832
3833/// Compare `left` and `right` using `order`. If that doesn't produce a strict

Callers 5

newMethod · 0.80
merge_sortedMethod · 0.80
process_responseMethod · 0.80
fold_topk_constantMethod · 0.80

Calls 3

borrow_with_limitMethod · 0.80
compare_columnsFunction · 0.70
as_refMethod · 0.45

Tested by

no test coverage detected