RinChanNOWWW commented on code in PR #5333: URL: https://github.com/apache/arrow-rs/pull/5333#discussion_r1467684882
########## arrow-select/src/take.rs: ########## @@ -769,11 +769,25 @@ to_indices_reinterpret!(Int32Type, UInt32Type); to_indices_identity!(UInt64Type); to_indices_reinterpret!(Int64Type, UInt64Type); +/// Take rows by index from [`RecordBatch`] and returns a new [`RecordBatch`] from those indexes. +pub fn take_record_batch( + record_batch: &RecordBatch, + indices: &[u64], Review Comment: You are right, the `take` function require an `Array` object as the indices, and it's better to have an `Array` here. But there are some cases that we need to do some slice operations and the current APIs are not that convenient. For example: ```rust let all = vec![xxxxx]; let half1 = take_record_batch(&batch, &all[0..len(all) / 2]); let half2 = take_record_batch(&batch, &all[len(all) / 2..]); ``` And the function signature described in #4958 also uses a slice. PTAL @alamb -- 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]
