You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/01/28 22:20:33 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3622: feat: take kernel for RunArray

tustvold commented on code in PR #3622:
URL: https://github.com/apache/arrow-rs/pull/3622#discussion_r1089824326


##########
arrow-select/src/take.rs:
##########
@@ -810,6 +816,70 @@ where
     Ok(DictionaryArray::<T>::from(data))
 }
 
+macro_rules! primitive_run_take {
+    ($t:ty, $o:ty, $indices:ident, $value:ident) => {
+        take_primitive_run_values::<$o, $t>(
+            $indices,
+            as_primitive_array::<$t>($value.values()),
+        )
+    };
+}
+
+/// `take` implementation for run arrays
+///
+/// performs binary search on `run_ends` to get physical indices for the given logical indices.
+/// builds output run array by taking values in the input run array at the physical indices.
+/// for e.g. an input `RunArray{ run_ends = [2,4,6,8], values=[1,2,1,2] }` and `indices=[2,7]`
+/// would be converted to `physical_indices=[1,3]` which will be used to build
+/// output `RunArray{ run_ends=[2], values=[2] }`
+
+pub fn take_run<T, I>(

Review Comment:
   This is paramaterised on both the run end and the value type which is catastrophic for codegen, we **cannot** do this.
   
   How about computing the set of value indices based on the run ends and a new set of run ends, and then passing the value indices off to the normal take kernel?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org