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