Jefffrey commented on code in PR #10945:
URL: https://github.com/apache/arrow-rs/pull/10945#discussion_r3909963910
##########
arrow-select/src/take.rs:
##########
@@ -1372,12 +1385,37 @@ pub fn take_record_batch(
record_batch: &RecordBatch,
indices: &dyn Array,
) -> Result<RecordBatch, ArrowError> {
- let columns = record_batch
- .columns()
- .iter()
- .map(|c| take(c, indices, None))
- .collect::<Result<Vec<_>, _>>()?;
- RecordBatch::try_new(record_batch.schema(), columns)
+ unsafe { take_record_batch_unchecked(record_batch, indices) }
Review Comment:
i think this is only safe when doing it on subsequent columns after the
first column; the idea being that after doing (checked) take on the first
column, we know for the next columns all indices are within bounds (otherwise
wouldve panicked) since invariant of record batch is all columns are of same
length
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]