Dandandan commented on code in PR #2359:
URL:
https://github.com/apache/datafusion-ballista/pull/2359#discussion_r3841785270
##########
ballista/core/src/execution_plans/sort_shuffle/writer.rs:
##########
@@ -1271,11 +1276,14 @@ fn compute_partition_indices(
hash_buffer,
)?;
- let mut out: Vec<Vec<u32>> = (0..num_partitions).map(|_|
Vec::new()).collect();
+ out.resize_with(num_partitions, Vec::new);
+ for rows in out.iter_mut() {
+ rows.clear();
+ }
for (row, &h) in hash_buffer.iter().enumerate() {
out[(h % num_partitions as u64) as usize].push(row as u32);
Review Comment:
This is also commonly a slow path, in DataFusion I went so far to replace it
with strength reduce https://github.com/apache/datafusion/pull/21900
--
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]