Commit b63bb3e
Fix RandomState mismatch in progressive hash join filtering
This commit addresses a critical correctness issue identified in PR review
where the hash function used in filter expressions had different RandomState
seeds than the RepartitionExec operator, potentially causing incorrect
partition assignments and filtering.
## Key Fixes
**RandomState Consistency**:
- Use RepartitionExec's RandomState (0,0,0,0) instead of custom seeds ('H','A','S','H')
- Ensures `hash(row) % num_partitions` produces same partition assignments as actual partitioning
- Prevents false negatives in progressive filtering logic
**Performance Optimization**:
- Cache ConfigOptions in SharedBoundsAccumulator to avoid repeated allocations
- Single Arc<ConfigOptions> shared across all hash expression creations
**Code Quality**:
- Improved comment clarity replacing outdated "HEAD" references
- Better documentation of deduplication logic
## Why This Matters
Without matching RandomState seeds, our progressive filter expressions could:
- Incorrectly filter out valid join candidates (correctness issue)
- Allow through data that doesn't belong to a partition (performance issue)
- Break the fundamental assumption that hash-based filtering matches partitioning
Resolves: apache#17632 (comment)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent fadb4f6 commit b63bb3e
2 files changed
Lines changed: 18 additions & 5 deletions
Submodule datafusion-testing updated 9 files
- data/sqlite/random/expr/slt_good_102.slt+6-6
- data/sqlite/random/expr/slt_good_104.slt+3-3
- data/sqlite/random/expr/slt_good_11.slt+3-3
- data/sqlite/random/expr/slt_good_12.slt+5-3
- data/sqlite/random/expr/slt_good_2.slt+3-3
- data/sqlite/random/expr/slt_good_4.slt+3-3
- data/sqlite/random/expr/slt_good_60.slt+3-3
- data/sqlite/random/expr/slt_good_88.slt+3-3
- data/sqlite/random/expr/slt_good_96.slt+3-3
Lines changed: 17 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| 122 | + | |
| 123 | + | |
116 | 124 | | |
117 | 125 | | |
118 | 126 | | |
| |||
182 | 190 | | |
183 | 191 | | |
184 | 192 | | |
| 193 | + | |
185 | 194 | | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
189 | 198 | | |
190 | | - | |
191 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
192 | 205 | | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
196 | 209 | | |
197 | 210 | | |
198 | 211 | | |
199 | | - | |
| 212 | + | |
200 | 213 | | |
201 | 214 | | |
202 | 215 | | |
| |||
355 | 368 | | |
356 | 369 | | |
357 | 370 | | |
358 | | - | |
| 371 | + | |
359 | 372 | | |
360 | 373 | | |
361 | 374 | | |
| |||
0 commit comments