EmilyMatt commented on code in PR #20314:
URL: https://github.com/apache/datafusion/pull/20314#discussion_r2840741843
##########
datafusion/physical-plan/src/sorts/sort.rs:
##########
@@ -850,11 +850,13 @@ pub(crate) fn get_reserved_bytes_for_record_batch_size(
/// Estimate how much memory is needed to sort a `RecordBatch`.
/// This will just call `get_reserved_bytes_for_record_batch_size` with the
/// memory size of the record batch and its sliced size.
-pub(super) fn get_reserved_bytes_for_record_batch(batch: &RecordBatch) ->
Result<usize> {
- Ok(get_reserved_bytes_for_record_batch_size(
- get_record_batch_memory_size(batch),
- batch.get_sliced_size()?,
- ))
+pub(crate) fn get_reserved_bytes_for_record_batch(batch: &RecordBatch) ->
Result<usize> {
+ batch.get_sliced_size().map(|sliced_size| {
+ get_reserved_bytes_for_record_batch_size(
+ get_record_batch_memory_size(batch),
+ sliced_size,
+ )
+ })
}
Review Comment:
I believe this is preferable
--
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]