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

Method truncate

datafusion/physical-expr-common/src/sort_expr.rs:418–427  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 ///

Callers 15

update_docsFunction · 0.45
resolve_overlapMethod · 0.45
split_up_extra_infoMethod · 0.45
output_fieldsMethod · 0.45
emit_columnsMethod · 0.45
take_nMethod · 0.45
vectorized_equal_toMethod · 0.45
emitMethod · 0.45
take_nMethod · 0.45
take_nMethod · 0.45
delegated_decodeFunction · 0.45

Calls 2

lenMethod · 0.45
iterMethod · 0.45

Tested by 2

test_infer_schema_streamFunction · 0.36