metesynnada commented on issue #9896:
URL: 
https://github.com/apache/arrow-datafusion/issues/9896#issuecomment-2030025691

   You may check this method and its usage 
   
   ```rust
   pub fn equal_rows_arr(
       indices_left: &UInt64Array,
       indices_right: &UInt32Array,
       left_arrays: &[ArrayRef],
       right_arrays: &[ArrayRef],
       null_equals_null: bool,
   ) -> Result<(UInt64Array, UInt32Array)> {
       let mut iter = left_arrays.iter().zip(right_arrays.iter());
   
       let (first_left, first_right) = iter.next().ok_or_else(|| {
           DataFusionError::Internal(
               "At least one array should be provided for both left and 
right".to_string(),
           )
       })?;
   
       let arr_left = take(first_left.as_ref(), indices_left, None)?;
       let arr_right = take(first_right.as_ref(), indices_right, None)?;
   
       let mut equal: BooleanArray = eq_dyn_null(&arr_left, &arr_right, 
null_equals_null)?;
   
       // Use map and try_fold to iterate over the remaining pairs of arrays.
       // In each iteration, take is used on the pair of arrays and their 
equality is determined.
       // The results are then folded (combined) using the and function to get 
a final equality result.
       equal = iter
           .map(|(left, right)| {
               let arr_left = take(left.as_ref(), indices_left, None)?;
               let arr_right = take(right.as_ref(), indices_right, None)?;
               eq_dyn_null(arr_left.as_ref(), arr_right.as_ref(), 
null_equals_null)
           })
           .try_fold(equal, |acc, equal2| and(&acc, &equal2?))?;
   
       let filter_builder = FilterBuilder::new(&equal).optimize().build();
   
       let left_filtered = filter_builder.filter(indices_left)?;
       let right_filtered = filter_builder.filter(indices_right)?;
   
       Ok((
           downcast_array(left_filtered.as_ref()),
           downcast_array(right_filtered.as_ref()),
       ))
   }
   ``` 


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