mustafasrepo commented on code in PR #9303:
URL: https://github.com/apache/arrow-datafusion/pull/9303#discussion_r1498744668
##########
datafusion/physical-plan/src/limit.rs:
##########
@@ -512,21 +511,8 @@ impl LimitStream {
self.fetch = 0;
self.input = None; // clear input so it can be dropped early
- let limited_columns: Vec<ArrayRef> = batch
- .columns()
- .iter()
- .map(|col| col.slice(0, col.len().min(batch_rows)))
- .collect();
- let options =
-
RecordBatchOptions::new().with_row_count(Option::from(batch_rows));
- Some(
- RecordBatch::try_new_with_options(
- batch.schema(),
- limited_columns,
- &options,
- )
- .unwrap(),
- )
+ // It is guaranteed that batch_rows is <= batch.num_rows
+ Some(batch.slice(0, batch_rows))
Review Comment:
Added it to be more explicit. Thanks
--
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]