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

Function order_aggregate_datums

src/expr/src/relation/func.rs:331–342  ·  view source on GitHub ↗

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 >`, that wouldn't

(
    datums: I,
    order_by: &[ColumnOrder],
)

Source from the content-addressed store, hash-verified

329/// we perform the shortening _inside_ this function: the input of the `map` is known to
330/// specifically be `std::vec::IntoIter`, which is known to be covariant.)
331pub fn order_aggregate_datums<'a: 'b, 'b, I>(
332 datums: I,
333 order_by: &[ColumnOrder],
334) -> impl Iterator<Item = Datum<'b>>
335where
336 I: IntoIterator<Item = Datum<'a>>,
337{
338 order_aggregate_datums_with_rank_inner(datums, order_by)
339 .into_iter()
340 // (`payload` is coerced here to `Datum<'b>` in the argument of the closure)
341 .map(|(payload, _order_datums)| payload)
342}
343
344/// Assuming datums is a List, sort them by the 2nd through Nth elements
345/// corresponding to order_by, then return the 1st element and computed order by expression.

Callers 8

string_aggFunction · 0.85
jsonb_aggFunction · 0.85
dict_aggFunction · 0.85
array_concatFunction · 0.85
list_concatFunction · 0.85
row_number_no_listFunction · 0.85
lag_lead_no_listFunction · 0.85
first_value_no_listFunction · 0.85

Calls 3

mapMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected