Repository navigation
Commit bc89cf9
authored
perf: reuse evaluated hash join build keys (apache#27285)
## Which issue does this PR close?
Closes apache#26806.
## Rationale for this change
After apache#26793, computed integer build keys can be evaluated twice over
the concatenated build batch under `NullEqualsNull`: once for the join
and again just to check for nulls when selecting an `ArrayMap`.
## What changes are included in this PR?
Pass the already evaluated key arrays (`&left_values`) to
`array_map_key_range`. Keep the single-key and supported-integer-type
checks inside the function, using the evaluated arrays. Derive the build
row count from `key.len()` inside the function instead of passing a
separate `num_rows` argument. Remove the duplicate expression
evaluation, row-count loop, and unused parameters.
## What is the testing strategy for this PR?
The existing 619 hash join execution tests pass. These cover NULL
handling, non-integer and multiple keys, empty inputs, and map
selection; no new tests are added because join behavior is unchanged.
Formatting, `cargo clippy --all-targets --all-features -- -D warnings`,
and the full workspace test suite with extended tests also pass.
A local example using a computed physical join key was also checked
under LLDB: after entering `build_in_memory`, `BinaryExpr::evaluate` is
now called once instead of twice. The example's NULL and non-NULL cases
retain their results and map selection.
The existing `hash_join_semi_anti/right_semi_d100_h100/1000000`
benchmark was compared with a local main baseline; Criterion reported
the change within its noise threshold. This is a regression check, not a
measurement of the computed-key improvement.
## Are there any user-facing changes?
No SQL result or public API changes. Avoids redundant build-key
evaluation for eligible null-safe hash joins.1 parent ced13f8 commit bc89cf9
1 file changed
Lines changed: 12 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | 163 | | |
165 | 164 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 165 | + | |
169 | 166 | | |
170 | 167 | | |
171 | 168 | | |
172 | 169 | | |
173 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
| 180 | + | |
| 181 | + | |
187 | 182 | | |
188 | 183 | | |
189 | 184 | | |
| |||
213 | 208 | | |
214 | 209 | | |
215 | 210 | | |
216 | | - | |
| 211 | + | |
217 | 212 | | |
218 | 213 | | |
219 | | - | |
| 214 | + | |
220 | 215 | | |
221 | 216 | | |
222 | 217 | | |
| |||
226 | 221 | | |
227 | 222 | | |
228 | 223 | | |
229 | | - | |
| 224 | + | |
230 | 225 | | |
231 | 226 | | |
232 | 227 | | |
233 | 228 | | |
234 | 229 | | |
235 | 230 | | |
236 | 231 | | |
237 | | - | |
| 232 | + | |
238 | 233 | | |
239 | 234 | | |
240 | 235 | | |
| |||
3269 | 3264 | | |
3270 | 3265 | | |
3271 | 3266 | | |
3272 | | - | |
3273 | | - | |
3274 | | - | |
| 3267 | + | |
3275 | 3268 | | |
3276 | 3269 | | |
3277 | 3270 | | |
| |||
0 commit comments