chore(partition): rename vars.
@@ -89,10 +89,10 @@ impl Partitions {
}
pub fn reshuffle(&self, executors: Vec<String>) -> Result<HashMap<String, Partitions>> {
- let mut executors_sort = executors;
- executors_sort.sort();
+ let mut executors_sorted = executors;
+ executors_sorted.sort();
- let executor_nums = executors_sort.len();
+ let num_executors = executors_sorted.len();
let partitions = match self.kind {
PartitionsShuffleKind::Seq => self.partitions.clone(),
PartitionsShuffleKind::Mod => {
@@ -100,7 +100,7 @@ impl Partitions {
let mut parts = self
.partitions
.iter()
- .map(|p| p.hash() % executor_nums as u64)
+ .map(|p| p.hash() % num_executors as u64)
.zip(self.partitions.clone().into_iter())
.collect::<Vec<_>>();
parts.sort_by(|a, b| a.0.cmp(&b.0));
@@ -116,8 +116,8 @@ impl Partitions {
let num_parts = partitions.len();
let mut executor_part = HashMap::default();
- let parts_per_node = (partitions.len() + executor_nums - 1) / executor_nums;
- for (idx, executor) in executors_sort.iter().enumerate() {
+ let parts_per_node = (partitions.len() + num_executors - 1) / num_executors;
+ for (idx, executor) in executors_sorted.iter().enumerate() {
let begin = parts_per_node * idx;
let end = num_parts.min(parts_per_node * (idx + 1));
let parts = partitions[begin..end].to_vec();
@@ -126,7 +126,7 @@ impl Partitions {
Partitions::create(PartitionsShuffleKind::Seq, parts.to_vec()),
);
if end == num_parts {
- executors_sort[(idx + 1)..].iter().for_each(|executor| {
+ executors_sorted[(idx + 1)..].iter().for_each(|executor| {
executor_part.insert(
executor.clone(),
Partitions::create(PartitionsShuffleKind::Seq, vec![]),
