ctsk commented on code in PR #15768:
URL: https://github.com/apache/datafusion/pull/15768#discussion_r2051665380


##########
datafusion/physical-plan/src/repartition/mod.rs:
##########
@@ -298,25 +299,15 @@ impl BatchPartitioner {
                         .into_iter()
                         .enumerate()
                         .filter_map(|(partition, indices)| {
-                            let indices: PrimitiveArray<UInt32Type> = 
indices.into();
                             (!indices.is_empty()).then_some((partition, 
indices))
                         })
                         .map(move |(partition, indices)| {
                             // Tracking time required for repartitioned 
batches construction
                             let _timer = partitioner_timer.timer();
+                            let b: Vec<&RecordBatch> = 
batches.iter().collect();
 
                             // Produce batches based on indices
-                            let columns = take_arrays(batch.columns(), 
&indices, None)?;
-
-                            let mut options = RecordBatchOptions::new();
-                            options = 
options.with_row_count(Some(indices.len()));
-                            let batch = RecordBatch::try_new_with_options(
-                                batch.schema(),
-                                columns,
-                                &options,
-                            )
-                            .unwrap();
-
+                            let batch = interleave_record_batch(&b, &indices)?;

Review Comment:
   Nice change, and  a much clearer performance win than 
https://github.com/apache/datafusion/pull/15479. I expect (without testing) 
that these two PRs interact negatively with one another - Removing coalesce 
will mean that the data is "more scattered" in memory and probably make 
interleave work worse - as well as the computation of the left join keys.



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