andygrove commented on code in PR #1440:
URL: https://github.com/apache/datafusion-comet/pull/1440#discussion_r1972545720


##########
native/core/src/execution/shuffle/shuffle_writer.rs:
##########
@@ -572,15 +567,12 @@ impl ShuffleRepartitioner {
             output_data.write_all(&output_batches[i])?;
             output_batches[i].clear();
 
-            // append partition in each spills
-            for spill in &output_spills {
-                let length = spill.offsets[i + 1] - spill.offsets[i];
-                if length > 0 {
-                    let mut spill_file =
-                        
BufReader::new(File::open(spill.file.path()).map_err(Self::to_df_err)?);
-                    spill_file.seek(SeekFrom::Start(spill.offsets[i]))?;
-                    std::io::copy(&mut spill_file.take(length), &mut 
output_data)
-                        .map_err(Self::to_df_err)?;
+            if let Some(spill_data) = 
self.buffered_partitions[i].spill_file.as_ref() {

Review Comment:
   Yes, that is correct. We never truncate the spill file. We just append to 
it. At the end of the shuffle, we copy the contents of each spill file to the 
shuffle file. I will add some comments to make this clearer.



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