Skip to content

Commit a7d2222

Browse files
committed
Avoid loop fix (gemini)
1 parent 77d4418 commit a7d2222

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

datafusion/physical-plan/src/joins/grace_hash_join/exec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ async fn partition_and_spill_one_side(
10391039
const MAX_TOTAL_TARGET_BUFFER_BYTES: usize = 256 * 1024 * 1024;
10401040
const MIN_FLUSH_BYTES: usize = 1 * 1024 * 1024;
10411041
const MAX_FLUSH_BYTES: usize = 32 * 1024 * 1024;
1042-
const MAX_SPILL_FILES_PER_SIDE: usize = 1024;
1042+
const MAX_SPILL_FILES_PER_SIDE: usize = 128;
10431043

10441044
let total_target_buffer = partition_write_buffer_bytes
10451045
.clamp(MIN_TOTAL_TARGET_BUFFER_BYTES, MAX_TOTAL_TARGET_BUFFER_BYTES);

datafusion/physical-plan/src/joins/grace_hash_join/stream.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const SPILL_READAHEAD_BYTES: usize = 256 * 1024 * 1024;
6464
/// Below this size we avoid further repartitioning to keep file counts under control.
6565
const MIN_REPARTITION_BYTES: usize = 16 * 1024 * 1024;
6666
/// Soft cap for compute-friendly partition size even when memory budgets are large.
67-
const COMPUTE_SOFT_MAX_BYTES: usize = 256 * 1024 * 1024;
67+
const COMPUTE_SOFT_MAX_BYTES: usize = 1024 * 1024 * 1024;
6868

6969
enum GraceJoinState {
7070
/// Waiting for the partitioning phase (Phase 1) to finish
@@ -829,6 +829,8 @@ impl GraceHashJoinStream {
829829
human_readable_size(limit),
830830
self.max_partition_passes
831831
);
832+
use log::error;
833+
error!("{}", msg);
832834
return Poll::Ready(Some(Err(
833835
datafusion_common::DataFusionError::ResourcesExhausted(msg),
834836
)));
@@ -1457,13 +1459,25 @@ mod tests {
14571459
#[test]
14581460
fn repartition_count_is_capped() {
14591461
let count =
1460-
compute_repartition_count(16, 1 * 1024 * 1024 * 1024, 64 * 1024 * 1024, 64);
1462+
compute_repartition_count(
1463+
16,
1464+
1 * 1024 * 1024 * 1024,
1465+
64 * 1024 * 1024,
1466+
64,
1467+
true,
1468+
);
14611469
assert_eq!(count, 64);
14621470
}
14631471

14641472
#[test]
14651473
fn repartition_count_grows_by_fan_out() {
1466-
let count = compute_repartition_count(8, 64 * 1024 * 1024, 64 * 1024 * 1024, 256);
1474+
let count = compute_repartition_count(
1475+
8,
1476+
64 * 1024 * 1024,
1477+
64 * 1024 * 1024,
1478+
256,
1479+
true,
1480+
);
14671481
// fan_out=2 (min), base=8 -> 16
14681482
assert_eq!(count, 16);
14691483
}

0 commit comments

Comments
 (0)