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

Function row_number

src/expr/src/relation/func.rs:444–461  ·  view source on GitHub ↗

The expected input is in the format of `[((OriginalRow, [EncodedArgs]), OrderByExprs...)]` The output is in the format of `[result_value, original_row]`. See an example at `lag_lead`, where the input-output formats are similar.

(
    datums: I,
    callers_temp_storage: &'a RowArena,
    order_by: &[ColumnOrder],
)

Source from the content-addressed store, hash-verified

442/// The output is in the format of `[result_value, original_row]`.
443/// See an example at `lag_lead`, where the input-output formats are similar.
444fn row_number<'a, I>(
445 datums: I,
446 callers_temp_storage: &'a RowArena,
447 order_by: &[ColumnOrder],
448) -> Datum<'a>
449where
450 I: IntoIterator<Item = Datum<'a>>,
451{
452 // We want to use our own temp_storage here, to avoid flooding `callers_temp_storage` with a
453 // large number of new datums. This is because we don't want to make an assumption about
454 // whether the caller creates a new temp_storage between window partitions.
455 let temp_storage = RowArena::new();
456 let datums = row_number_no_list(datums, &temp_storage, order_by);
457
458 callers_temp_storage.make_datum(|packer| {
459 packer.push_list(datums);
460 })
461}
462
463/// Like `row_number`, but doesn't perform the final wrapping in a list, returning an Iterator
464/// instead.

Callers 1

eval_datumsMethod · 0.85

Calls 3

row_number_no_listFunction · 0.85
make_datumMethod · 0.80
push_listMethod · 0.80

Tested by

no test coverage detected