MCPcopy Create free account
hub / github.com/apache/datafusion / is_row_ahead

Function is_row_ahead

datafusion/physical-expr/src/window/window_expr.rs:573–588  ·  view source on GitHub ↗

This utility function checks whether `current_cols` is ahead of the `old_cols` in terms of `sort_options`.

(
    old_col: &ArrayRef,
    current_col: Option<&ArrayRef>,
    sort_options: &SortOptions,
)

Source from the content-addressed store, hash-verified

571/// This utility function checks whether `current_cols` is ahead of the `old_cols`
572/// in terms of `sort_options`.
573fn is_row_ahead(
574 old_col: &ArrayRef,
575 current_col: Option<&ArrayRef>,
576 sort_options: &SortOptions,
577) -> Result<bool> {
578 let Some(current_col) = current_col else {
579 return Ok(false);
580 };
581 if old_col.is_empty() || current_col.is_empty() {
582 return Ok(false);
583 }
584 let last_value = ScalarValue::try_from_array(old_col, old_col.len() - 1)?;
585 let current_value = ScalarValue::try_from_array(current_col, 0)?;
586 let cmp = compare_rows(&[current_value], &[last_value], &[*sort_options])?;
587 Ok(cmp.is_gt())
588}
589
590/// Get order by expression results inside `order_by_columns`.
591pub(crate) fn get_orderby_values(order_by_columns: Vec<SortColumn>) -> Vec<ArrayRef> {

Callers 2

Calls 4

compare_rowsFunction · 0.85
is_gtMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…