MCPcopy Create free account
hub / github.com/apache/arrow-rs / slice

Method slice

arrow-array/src/record_batch.rs:681–695  ·  view source on GitHub ↗

Return a new RecordBatch where each column is sliced according to `offset` and `length` # Panics Panics if `offset` with `length` is greater than column length.

(&self, offset: usize, length: usize)

Source from the content-addressed store, hash-verified

679 ///
680 /// Panics if `offset` with `length` is greater than column length.
681 pub fn slice(&self, offset: usize, length: usize) -> RecordBatch {
682 assert!((offset + length) <= self.num_rows());
683
684 let columns = self
685 .columns()
686 .iter()
687 .map(|column| column.slice(offset, length))
688 .collect();
689
690 Self {
691 schema: self.schema.clone(),
692 columns,
693 row_count: length,
694 }
695 }
696
697 /// Create a `RecordBatch` from an iterable list of pairs of the
698 /// form `(field_name, array)`, with the same requirements on

Calls 4

collectMethod · 0.80
iterMethod · 0.45
columnsMethod · 0.45
cloneMethod · 0.45