Dandandan commented on code in PR #8020:
URL: https://github.com/apache/arrow-datafusion/pull/8020#discussion_r1453460104


##########
datafusion/physical-plan/src/joins/utils.rs:
##########
@@ -224,6 +229,85 @@ pub trait JoinHashMapType {
 
         (input_indices, match_indices)
     }
+
+    /// Matches hashes with taking limit and offset into account.
+    /// Returns pairs of matched indices along with the starting point for next
+    /// matching iteration (`None` if limit has not been reached).
+    ///
+    /// This method only compares hashes, so additional further check for 
actual values
+    /// equality may be required.
+    fn get_matched_indices_with_limit_offset<'a>(
+        &self,
+        iter: impl Iterator<Item = (usize, &'a u64)>,
+        deleted_offset: Option<usize>,
+        limit: usize,
+        offset: JoinHashMapOffset,
+    ) -> (
+        UInt32BufferBuilder,
+        UInt64BufferBuilder,
+        Option<JoinHashMapOffset>,
+    ) {
+        let mut input_indices = UInt32BufferBuilder::new(0);
+        let mut match_indices = UInt64BufferBuilder::new(0);
+
+        let mut output_tuples = 0_usize;
+        let mut next_offset = None;
+
+        let hash_map: &RawTable<(u64, u64)> = self.get_map();
+        let next_chain = self.get_list();
+
+        let (initial_idx, initial_next_idx) = offset;
+        'probe: for (row_idx, hash_value) in iter.skip(initial_idx) {
+            let index = if initial_next_idx.is_some() && row_idx == 
initial_idx {
+                // If `initial_next_idx` is zero, then input index has been 
processed

Review Comment:
   We might combine this logic with `next==0` in the loop below?



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