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,
)
| 571 | /// This utility function checks whether `current_cols` is ahead of the `old_cols` |
| 572 | /// in terms of `sort_options`. |
| 573 | fn 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`. |
| 591 | pub(crate) fn get_orderby_values(order_by_columns: Vec<SortColumn>) -> Vec<ArrayRef> { |
no test coverage detected
searching dependent graphs…