Function mz_expr::relation::func::order_aggregate_datums
source · pub fn order_aggregate_datums<'a: 'b, 'b, I>(
datums: I,
order_by: &[ColumnOrder],
) -> impl Iterator<Item = Datum<'b>>where
I: IntoIterator<Item = Datum<'a>>,
Expand description
Assuming datums is a List, sort them by the 2nd through Nth elements corresponding to order_by, then return the 1st element.
Near the usages of this function, we sometimes want to produce Datums with a shorter lifetime
than ’a. We have to actually perform the shortening of the lifetime here, inside this function,
because if we were to simply return impl Iterator<Item = Datum<'a>>
, that wouldn’t be
covariant in the item type, because opaque types are always invariant. (Contrast this with how
we perform the shortening inside this function: the input of the map
is known to
specifically be std::vec::IntoIter
, which is known to be covariant.)