Fix redundant expansion in SearchOperatorConversion. (#15625)

This logic error causes sarg expansion to happen twice for IN or NOT IN points.
It doesn't affect the final generated native query, because the
redundant expansions gets combined. But it slows down planning, especially
for large NOT IN.
This commit is contained in:
Gian Merlino 2024-01-05 12:42:12 -08:00 committed by GitHub
parent 9fe67958be
commit 0422d9d507
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -169,7 +169,7 @@ public class SearchOperatorConversion implements SqlOperatorConversion
}
// Use RexUtil.sargRef to expand the rest of the sarg, if any.
if (!sarg.isPoints() || !sarg.isComplementedPoints()) {
if (!sarg.isPoints() && !sarg.isComplementedPoints()) {
// Remaining ranges, after separating out the "IN" and "NOT IN" points.
// The "IN" points are excluded, and the "NOT IN" points are added back in.
final RangeSet<Comparable> remainderRanges = TreeRangeSet.create();