Jefffrey commented on code in PR #10945:
URL: https://github.com/apache/arrow-rs/pull/10945#discussion_r4102346483


##########
arrow-select/src/take.rs:
##########
@@ -1661,12 +1713,27 @@ 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)
+    downcast_integer_array!(
+        indices => {
+            let indices = indices.to_indices();
+            let columns = record_batch
+                .columns()
+                .iter()
+                .enumerate()
+                .map(|(i, column)| {
+                    if i == 0 {
+                        std::hint::cold_path();

Review Comment:
   looks like we cant use `cold_path()` yet
   
   maybe we can just split the loop:
   
   ```rust
   let mut columns = Vec::with_capacity(no_of_columns);
   let first = take_impl::<_, true>(record_batch.columns()[0], &indices);
   columns.push(first);
   columns.extend(// the rest except first);
   ```



##########
arrow-select/src/take.rs:
##########
@@ -1661,12 +1713,27 @@ 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)
+    downcast_integer_array!(
+        indices => {
+            let indices = indices.to_indices();
+            let columns = record_batch
+                .columns()
+                .iter()
+                .enumerate()
+                .map(|(i, column)| {
+                    if i == 0 {
+                        std::hint::cold_path();

Review Comment:
   looks like we cant use `cold_path()` yet (msrv issue)
   
   maybe we can just split the loop:
   
   ```rust
   let mut columns = Vec::with_capacity(no_of_columns);
   let first = take_impl::<_, true>(record_batch.columns()[0], &indices);
   columns.push(first);
   columns.extend(// the rest except first);
   ```



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

Reply via email to