advancedxy commented on code in PR #523:
URL: https://github.com/apache/datafusion-comet/pull/523#discussion_r1628574405


##########
core/src/execution/datafusion/shuffle_writer.rs:
##########
@@ -947,12 +948,18 @@ async fn external_shuffle(
         partitioning,
         metrics,
         context.runtime_env(),
-        context.session_config().batch_size(),
+        batch_size,
     );
 
     while let Some(batch) = input.next().await {
         let batch = batch?;
-        repartitioner.insert_batch(batch).await?;
+        let mut start = 0;
+        while start < batch.num_rows() {
+            let end = (start + batch_size).min(batch.num_rows());
+            let batch = batch.slice(start, end - start);
+            repartitioner.insert_batch(batch).await?;
+            start = end;
+        }

Review Comment:
   It seems like this code should be handled in the ShuffleRepartitioner's 
insert_batch method? We can rename the previous `insert_batch` function to 
`insert_batch_internal` or something similar and call it multiple time in the 
new `insert_batch` function.
   
   The batch size is an internal parameter of ShuffleRepartitioner's 
constructor, which is not exposed. We may change the implementation in the 
future. By handling it internally, we can ensure the buffer size is respected 
even the implementation changes.



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