paleolimbot commented on code in PR #514:
URL: https://github.com/apache/sedona-db/pull/514#discussion_r2691706308
##########
rust/sedona-spatial-join/src/utils/join_utils.rs:
##########
@@ -355,25 +359,45 @@ pub(crate) fn get_semi_indices<T: ArrowPrimitiveType>(
where
NativeAdapter<T>: From<<T as ArrowPrimitiveType>::Native>,
{
- let mut bitmap = BooleanBufferBuilder::new(range.len());
- bitmap.append_n(range.len(), false);
- input_indices
- .iter()
- .flatten()
- .map(|v| v.as_usize())
- .filter(|v| range.contains(v))
- .for_each(|v| {
- bitmap.set_bit(v - range.start, true);
- });
-
+ let bitmap = build_range_bitmap(&range, input_indices);
let offset = range.start;
-
// get the semi index
(range)
.filter_map(|idx| (bitmap.get_bit(idx -
offset)).then_some(T::Native::from_usize(idx)))
.collect()
}
+pub(crate) fn get_mark_indices<T: ArrowPrimitiveType, R: ArrowPrimitiveType>(
+ range: &Range<usize>,
+ input_indices: &PrimitiveArray<T>,
+) -> PrimitiveArray<R>
+where
+ NativeAdapter<T>: From<<T as ArrowPrimitiveType>::Native>,
+{
Review Comment:
It would help (me + future llms) to have a comment on what exactly this is
doing (outputting an array consisting of all zeroes where some of the values
are null?).
Does it need to be generic on Range and the primitive type? (might be much
easier to read if one can assume these are just int64s).
--
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]