(
rows: &mut [(String, serde_json::Value)],
indices: &[usize],
alias: &str,
order_by: &[(SqlExpr, bool)],
)
| 43 | } |
| 44 | |
| 45 | pub(super) fn apply_dense_rank( |
| 46 | rows: &mut [(String, serde_json::Value)], |
| 47 | indices: &[usize], |
| 48 | alias: &str, |
| 49 | order_by: &[(SqlExpr, bool)], |
| 50 | ) { |
| 51 | if indices.is_empty() { |
| 52 | return; |
| 53 | } |
| 54 | let mut current_rank = 1; |
| 55 | set_window_col(&mut rows[indices[0]].1, alias, serde_json::json!(1)); |
| 56 | |
| 57 | for pos in 1..indices.len() { |
| 58 | if !order_keys_equal(rows, indices[pos - 1], indices[pos], order_by) { |
| 59 | current_rank += 1; |
| 60 | } |
| 61 | set_window_col( |
| 62 | &mut rows[indices[pos]].1, |
| 63 | alias, |
| 64 | serde_json::json!(current_rank), |
| 65 | ); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | pub(super) fn apply_ntile( |
| 70 | rows: &mut [(String, serde_json::Value)], |
no test coverage detected