(
rows: &mut [(String, serde_json::Value)],
indices: &[usize],
alias: &str,
order_by: &[(SqlExpr, bool)],
)
| 19 | } |
| 20 | |
| 21 | pub(super) fn apply_rank( |
| 22 | rows: &mut [(String, serde_json::Value)], |
| 23 | indices: &[usize], |
| 24 | alias: &str, |
| 25 | order_by: &[(SqlExpr, bool)], |
| 26 | ) { |
| 27 | if indices.is_empty() { |
| 28 | return; |
| 29 | } |
| 30 | let mut current_rank = 1; |
| 31 | set_window_col(&mut rows[indices[0]].1, alias, serde_json::json!(1)); |
| 32 | |
| 33 | for pos in 1..indices.len() { |
| 34 | if !order_keys_equal(rows, indices[pos - 1], indices[pos], order_by) { |
| 35 | current_rank = pos + 1; |
| 36 | } |
| 37 | set_window_col( |
| 38 | &mut rows[indices[pos]].1, |
| 39 | alias, |
| 40 | serde_json::json!(current_rank), |
| 41 | ); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | pub(super) fn apply_dense_rank( |
| 46 | rows: &mut [(String, serde_json::Value)], |
no test coverage detected