Truncates the `LexOrdering`, keeping only the first `len` elements. Returns `true` if truncation made a change, `false` otherwise. Negative cases happen in two scenarios: (1) When `len` is greater than or equal to the number of expressions inside this `LexOrdering`, making truncation a no-op, or (2) when `len` is `0`, making truncation impossible.
(&mut self, len: usize)
| 416 | /// to the number of expressions inside this `LexOrdering`, making truncation |
| 417 | /// a no-op, or (2) when `len` is `0`, making truncation impossible. |
| 418 | pub fn truncate(&mut self, len: usize) -> bool { |
| 419 | if len == 0 || len >= self.exprs.len() { |
| 420 | return false; |
| 421 | } |
| 422 | for PhysicalSortExpr { expr, .. } in self.exprs[len..].iter() { |
| 423 | self.set.swap_remove(expr); |
| 424 | } |
| 425 | self.exprs.truncate(len); |
| 426 | true |
| 427 | } |
| 428 | |
| 429 | /// Check if reversing this ordering would satisfy another ordering requirement. |
| 430 | /// |