Kristofferjoha commented on code in PR #27360:
URL: https://github.com/apache/datafusion/pull/27360#discussion_r4682574583


##########
datafusion/physical-plan/src/aggregates/group_values/multi_group_by/bytes_view.rs:
##########
@@ -451,20 +451,28 @@ impl<B: ByteViewType> ByteViewGroupValueBuilder<B> {
         // Unfortunately, some taken views non-inlined
         let view = ByteView::from(*view);
         let last_remaining_buffer_index = view.buffer_index as usize;
+        let last_take_len = (view.offset + view.length) as usize;
 
         // Check should we take the whole `last_remaining_buffer_index` buffer
-        let take_whole_last_buffer = self.should_take_whole_buffer(
-            last_remaining_buffer_index,
-            (view.offset + view.length) as usize,
-        );
+        let take_whole_last_buffer =
+            self.should_take_whole_buffer(last_remaining_buffer_index, 
last_take_len);
+
+        // Remaining views all point into `in_progress` past the bytes drained 
from it
+        let offset_shift = if !take_whole_last_buffer
+            && last_remaining_buffer_index == self.completed.len()
+        {
+            last_take_len
+        } else {
+            0
+        };

Review Comment:
   Added, plus the matching one for buffer_index >= shifts on the line above, 
since that subtraction relies on the same rule.



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

Reply via email to