Repository navigation
Commit 61c6d51
fix: do not build a null-aware join when the correlation repeats the
`x IN (SELECT y FROM .. WHERE y = x)` writes the `IN` equality a second
time, as a correlated filter. `remove_duplicated_filter` drops that filter,
because `build_join` adds the same equality back as the join filter. The
scope of the subquery is then gone, and the join looked uncorrelated and
null-aware, so a miss gave UNKNOWN.
The result of this shape is never UNKNOWN: every row the subquery keeps for
an outer row satisfies `y = x`, so `y` is not NULL there and the subquery
result is either empty or `{x}`. `PullUpCorrelatedExpr` now reports the
shape, and the mark join and the anti join stay plain for it.
A node above the dropped filter can still put a NULL into the value column,
and then the result is UNKNOWN again. An outer join, a union and a grouping
set do this, so the flag is cleared when the pull up passes one of them.
`f_up` walks the subquery bottom up, so every such node above the filter is
reached after it.
This also fixes apache#25480, which is
the same root cause in a `WHERE ... NOT IN` clause.
Co-Authored-By: Claude Opus 5 <[email protected]>IN predicate1 parent 3af8737 commit 61c6d51
2 files changed
Lines changed: 56 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
77 | 92 | | |
78 | 93 | | |
79 | 94 | | |
| |||
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
| 113 | + | |
98 | 114 | | |
99 | 115 | | |
100 | 116 | | |
| |||
173 | 189 | | |
174 | 190 | | |
175 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
176 | 198 | | |
177 | 199 | | |
178 | 200 | | |
| |||
186 | 208 | | |
187 | 209 | | |
188 | 210 | | |
| 211 | + | |
189 | 212 | | |
| 213 | + | |
190 | 214 | | |
191 | 215 | | |
192 | 216 | | |
| |||
480 | 504 | | |
481 | 505 | | |
482 | 506 | | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
483 | 526 | | |
484 | 527 | | |
485 | 528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
721 | 725 | | |
722 | 726 | | |
723 | 727 | | |
| |||
757 | 761 | | |
758 | 762 | | |
759 | 763 | | |
760 | | - | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
761 | 771 | | |
762 | 772 | | |
763 | 773 | | |
| |||
0 commit comments