Commit 1f59d32
fix: dfbench respects DATAFUSION_RUNTIME_MEMORY_LIMIT env var (#20631)
## Which issue does this PR close?
N/A — discovered while running benchmarks with `bench.sh`.
## Rationale for this change
When running benchmarks via `bench.sh` / `dfbench`, setting
`DATAFUSION_RUNTIME_MEMORY_LIMIT=2G` is ignored for memory pool
enforcement. Most `DATAFUSION_*` env vars work because
`SessionConfig::from_env()` picks them up, but the memory limit is a
special case — it requires constructing a `MemoryPool` in the
`RuntimeEnv`, which `dfbench` only did when `--memory-limit` was passed
as a CLI flag.
## What changes are included in this PR?
In `runtime_env_builder()`, when `self.memory_limit` (CLI flag) is
`None`, fall back to reading the `DATAFUSION_RUNTIME_MEMORY_LIMIT` env
var using the existing `parse_memory_limit()` function. The CLI flag
still takes precedence when provided.
## Are these changes tested?
Yes — added `test_runtime_env_builder_reads_env_var` which sets the env
var, constructs a `CommonOpt` with no CLI memory limit, and verifies the
resulting `RuntimeEnv` has a `Finite(2GB)` memory pool.
## Are there any user-facing changes?
`dfbench` now honors the `DATAFUSION_RUNTIME_MEMORY_LIMIT` environment
variable as a fallback when `--memory-limit` is not passed on the
command line. No breaking changes — existing CLI flag behavior is
unchanged.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 538a201 commit 1f59d32
1 file changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
95 | 103 | | |
96 | 104 | | |
97 | 105 | | |
| |||
144 | 152 | | |
145 | 153 | | |
146 | 154 | | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
147 | 188 | | |
148 | 189 | | |
149 | 190 | | |
| |||
0 commit comments