ctsk commented on code in PR #16083:
URL: https://github.com/apache/datafusion/pull/16083#discussion_r2119313686


##########
datafusion/physical-plan/src/joins/utils.rs:
##########
@@ -1126,6 +1153,28 @@ where
         .collect()
 }
 
+pub(crate) fn get_mark_indices<T: ArrowPrimitiveType>(
+    range: &Range<usize>,
+    input_indices: &PrimitiveArray<T>,
+) -> PrimitiveArray<UInt32Type>
+where
+    NativeAdapter<T>: From<<T as ArrowPrimitiveType>::Native>,
+{
+    let mut builder = PrimitiveBuilder::<UInt32Type>::new();
+
+    for idx in range.clone() {
+        let matched = input_indices.iter().flatten().any(|v| v.as_usize() == 
idx);

Review Comment:
   Adapting the code from `get_semi_indices` to reuse the bitmap as the null 
mask:
   
   ```rust
   pub(crate) fn get_mark_indices<T: ArrowPrimitiveType>(
       range: Range<usize>,
       input_indices: &PrimitiveArray<T>,
   ) -> PrimitiveArray<UInt32Type>
   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);
           });
   
       PrimitiveArray::new(
           vec![0; range.len()].into(),
           Some(NullBuffer::new(bitmap.finish())),
       )
   }
   ```



-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to