Dandandan commented on code in PR #22794:
URL: https://github.com/apache/datafusion/pull/22794#discussion_r3368105766
##########
datafusion/physical-plan/src/joins/utils.rs:
##########
@@ -1555,39 +1555,78 @@ pub(crate) fn append_right_indices(
}
}
-/// Returns `range` indices which are not present in `input_indices`
+/// Returns `range` indices which are not present in `input_indices`.
+///
+/// `input_indices` must be sorted ascending.
pub(crate) fn get_anti_indices<T: ArrowPrimitiveType>(
range: Range<usize>,
input_indices: &PrimitiveArray<T>,
) -> PrimitiveArray<T>
where
NativeAdapter<T>: From<<T as ArrowPrimitiveType>::Native>,
{
- let bitmap = build_range_bitmap(&range, input_indices);
- let offset = range.start;
+ debug_assert!(
+ input_indices
+ .values()
+ .windows(2)
+ .all(|w| w[0].as_usize() <= w[1].as_usize()),
+ "get_anti_indices requires ascending input_indices"
+ );
- // get the anti index
- (range)
- .filter_map(|idx| {
- (!bitmap.get_bit(idx -
offset)).then_some(T::Native::from_usize(idx))
- })
- .collect()
+ let mut next_unmatched_idx = range.start;
+ let mut output = PrimitiveBuilder::<T>::new();
+
+ for v in input_indices.iter().flatten() {
Review Comment:
I think `input_indices` shouldn't have nulls? `iter().flatten()` is slower
than `.values()`
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]