Commit cbd1b15
fix: Force CollectLeft partition mode for null-aware anti joins
Null-aware anti joins must use PartitionMode::CollectLeft instead of
PartitionMode::Partitioned because they track probe-side state
(probe_side_non_empty, probe_side_has_null) per-partition, but require
global knowledge for correct NULL handling.
The problem with partitioned mode:
- Hash joins partition rows by hash(join_key)
- Row with NULL key goes to partition X (hash(NULL))
- Row with value 2 goes to partition Y (hash(2))
- Partition X doesn't see any probe rows, even though probe side is
globally non-empty
- This causes partition X to incorrectly return NULL rows
Example that failed in CI:
SELECT * FROM outer_table
WHERE id NOT IN (SELECT id FROM inner WHERE value = 'x');
- Subquery returns [2]
- Row (NULL, 'e') from outer_table hashes to different partition than 2
- That partition sees no probe rows and incorrectly returns (NULL, 'e')
The fix:
- Force PartitionMode::CollectLeft for null-aware anti joins
- This collects the left side (outer table) into a single partition
- All partitions see the same complete probe side
- Correct global state tracking for null handling
Trade-off: Null-aware anti joins lose parallelism on the build side,
but gain correctness. This is acceptable since null-aware anti joins
are typically used for NOT IN subqueries which are less common and
often involve smaller datasets.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <[email protected]>1 parent 2eb483f commit cbd1b15
1 file changed
+11
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
247 | 257 | | |
248 | 258 | | |
249 | 259 | | |
250 | 260 | | |
251 | 261 | | |
252 | 262 | | |
253 | 263 | | |
254 | | - | |
| 264 | + | |
255 | 265 | | |
256 | 266 | | |
257 | 267 | | |
| |||
0 commit comments