alamb commented on code in PR #5339:
URL: https://github.com/apache/arrow-datafusion/pull/5339#discussion_r1119306849
##########
datafusion/core/src/physical_plan/joins/cross_join.rs:
##########
@@ -434,15 +453,7 @@ impl CrossJoinStream {
Some(result)
}
other => {
- debug!(
Review Comment:
I think it is a nice improvement that the metrics are now included in things
like `EXPLAIN ANALYZE`
##########
datafusion/core/src/physical_plan/joins/cross_join.rs:
##########
@@ -111,22 +116,28 @@ async fn load_left_input(
let stream = merge.execute(0, context)?;
// Load all batches and count the rows
- let (batches, num_rows) = stream
- .try_fold((Vec::new(), 0usize), |mut acc, batch| async {
- acc.1 += batch.num_rows();
- acc.0.push(batch);
- Ok(acc)
- })
+ let (batches, num_rows, _, _) = stream
+ .try_fold(
+ (Vec::new(), 0usize, metrics, reservation),
+ |mut acc, batch| async {
+ let batch_size = batch.get_array_memory_size();
+ // Reserve memory for incoming batch
+ acc.3.lock().try_grow(batch_size)?;
+ // Update metrics
Review Comment:
❤️
--
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]