Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
remove slice test function
Browse files Browse the repository at this point in the history
  • Loading branch information
Igosuki committed Jan 3, 2022
1 parent 995c939 commit 55d01ec
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,31 +297,6 @@ impl RecordBatch {
let Self { columns, schema } = self;
(columns, schema)
}

/// 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.
pub fn slice(&self, offset: usize, length: usize) -> RecordBatch {
if self.schema.fields().is_empty() {
assert!((offset + length) == 0);
return RecordBatch::new_empty(self.schema.clone());
}
assert!((offset + length) <= self.num_rows());

let columns = self
.columns()
.iter()
.map(|column| column.slice(offset, length).into())
.collect();

Self {
schema: self.schema.clone(),
columns,
}
}
}

/// Options that control the behaviour used when creating a [`RecordBatch`].
Expand Down

0 comments on commit 55d01ec

Please sign in to comment.