Skip to content

Commit 06847b5

Browse files
committed
simplify error check
1 parent addd71d commit 06847b5

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

  • datafusion/core/src/physical_plan/aggregates

datafusion/core/src/physical_plan/aggregates/row_hash.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,14 @@ impl Stream for GroupedHashAggregateStream {
247247
// allocate memory
248248
// This happens AFTER we actually used the memory, but simplifies the whole accounting and we are OK with
249249
// overshooting a bit. Also this means we either store the whole record batch or not.
250-
match result.and_then(|allocated| {
250+
let result = result.and_then(|allocated| {
251251
self.row_aggr_state.reservation.try_grow(allocated)
252-
}) {
253-
Ok(_) => {}
254-
Err(e) => {
255-
return Poll::Ready(Some(Err(
256-
ArrowError::ExternalError(Box::new(e)),
257-
)))
258-
}
252+
});
253+
254+
if let Err(e) = result {
255+
return Poll::Ready(Some(Err(ArrowError::ExternalError(
256+
Box::new(e),
257+
))));
259258
}
260259
}
261260
// inner had error, return to caller

0 commit comments

Comments
 (0)