Commit 125c97f
committed
opt: fix incorrect filter elimination in join reordering
A bug in join reordering which incorrectly eliminated filters has been
fixed. The join reordering logic could sometimes eliminate filters of
the form `a=a` when constructing new inner-joins. It incorrectly assumed
these filters to be redundant because a column is always equivalent to
itself. However, `a=a` is a null-rejecting filter, so it can only be
omitted if `a` is guaranteed to be non-null by something else, like
another filter or a `NOT NULL` constraint.
There is no release note because, as far as we know, this bug is not
possible to hit in production. The only reproduction we have requires
optimization rules to be disabled, which can only happen in tests.
Fixes #146507
Release note: None1 parent 8fcfd5a commit 125c97f
File tree
3 files changed
+77
-10
lines changed- pkg/sql/opt
- props
- xform
- testdata/rules
3 files changed
+77
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
97 | | - | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
620 | 620 | | |
621 | 621 | | |
622 | 622 | | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
623 | 626 | | |
624 | 627 | | |
625 | 628 | | |
| |||
631 | 634 | | |
632 | 635 | | |
633 | 636 | | |
634 | | - | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
635 | 642 | | |
636 | 643 | | |
637 | 644 | | |
| |||
887 | 894 | | |
888 | 895 | | |
889 | 896 | | |
890 | | - | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
891 | 902 | | |
892 | 903 | | |
893 | 904 | | |
| |||
900 | 911 | | |
901 | 912 | | |
902 | 913 | | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
903 | 921 | | |
904 | 922 | | |
905 | 923 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3558 | 3558 | | |
3559 | 3559 | | |
3560 | 3560 | | |
3561 | | - | |
| 3561 | + | |
3562 | 3562 | | |
3563 | 3563 | | |
3564 | 3564 | | |
| |||
3608 | 3608 | | |
3609 | 3609 | | |
3610 | 3610 | | |
3611 | | - | |
| 3611 | + | |
3612 | 3612 | | |
3613 | 3613 | | |
3614 | 3614 | | |
| |||
3628 | 3628 | | |
3629 | 3629 | | |
3630 | 3630 | | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
| 3635 | + | |
| 3636 | + | |
| 3637 | + | |
| 3638 | + | |
| 3639 | + | |
| 3640 | + | |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
| 3648 | + | |
| 3649 | + | |
| 3650 | + | |
| 3651 | + | |
| 3652 | + | |
| 3653 | + | |
| 3654 | + | |
| 3655 | + | |
| 3656 | + | |
| 3657 | + | |
| 3658 | + | |
| 3659 | + | |
| 3660 | + | |
| 3661 | + | |
| 3662 | + | |
| 3663 | + | |
| 3664 | + | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
| 3668 | + | |
| 3669 | + | |
| 3670 | + | |
| 3671 | + | |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
0 commit comments