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


##########
native/core/src/execution/shuffle/row.rs:
##########
@@ -776,16 +776,27 @@ pub fn process_sorted_row_partition(
         None
     };
 
+    // Create builders once and reuse them across batches.
+    // After finish() is called, builders are reset and can be reused.
+    let mut data_builders: Vec<Box<dyn ArrayBuilder>> = vec![];
+    schema.iter().try_for_each(|dt| {
+        make_builders(dt, batch_size, prefer_dictionary_ratio)
+            .map(|builder| data_builders.push(builder))?;
+        Ok::<(), CometError>(())
+    })?;
+
+    // Open the output file once and reuse it across batches
+    let mut output_data = OpenOptions::new()
+        .create(true)
+        .append(true)
+        .open(&output_path)?;
+
+    // Reusable buffer for serialized batch data
+    let mut frozen: Vec<u8> = Vec::with_capacity(batch_size * 1024);

Review Comment:
   This was arbitrary. I changed this now just to use `Vec::new`.



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