Skip to content

Commit 96b9172

Browse files
author
Gene Bordegaray
committed
address comments
1 parent a0a727c commit 96b9172

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

  • datafusion/physical-plan/src/repartition

‎datafusion/physical-plan/src/repartition/mod.rs‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -737,22 +737,25 @@ impl BatchPartitioner {
737737
return Ok(vec![]);
738738
}
739739

740-
let indices_array: PrimitiveArray<UInt32Type> = reordered_indices.into();
741-
let reordered_batch = {
740+
let batches = {
742741
let _timer = timer.timer();
742+
let indices_array: PrimitiveArray<UInt32Type> = reordered_indices.into();
743743
let columns = take_arrays(batch.columns(), &indices_array, None)?;
744744

745745
let mut options = RecordBatchOptions::new();
746746
options = options.with_row_count(Some(indices_array.len()));
747-
RecordBatch::try_new_with_options(batch.schema(), columns, &options).unwrap()
747+
let reordered_batch =
748+
RecordBatch::try_new_with_options(batch.schema(), columns, &options)?;
749+
750+
partition_ranges
751+
.into_iter()
752+
.map(|(partition, start, len)| {
753+
Ok((partition, reordered_batch.slice(start, len)))
754+
})
755+
.collect()
748756
};
749757

750-
Ok(partition_ranges
751-
.into_iter()
752-
.map(|(partition, start, len)| {
753-
Ok((partition, reordered_batch.slice(start, len)))
754-
})
755-
.collect())
758+
Ok(batches)
756759
}
757760
}
758761

0 commit comments

Comments
 (0)