Merge 'feat(optimizer): eliminate between statement' from KaguraMilet

Rewrite `Y BETWEEN X AND Z` as `X <= Y AND Y <= Z`. And due to the
support of this optimization rule, limbo should now be able to execute
the `BETWEEN AND` statement.

Closes #490
This commit is contained in:
jussisaurio
2024-12-20 17:23:42 +02:00
2 changed files with 117 additions and 0 deletions

View File

@@ -317,3 +317,20 @@ do_execsql_test where-age-index-seek-regression-test {
do_execsql_test where-age-index-seek-regression-test-2 {
select count(1) from users where age > 0;
} {10000}
do_execsql_test where-simple-between {
SELECT * FROM products WHERE price BETWEEN 70 AND 100;
} {1|hat|79.0
2|cap|82.0
5|sweatshirt|74.0
6|shorts|70.0
7|jeans|78.0
8|sneakers|82.0
11|accessories|81.0}
do_execsql_test between-price-range-with-names {
SELECT * FROM products
WHERE (price BETWEEN 70 AND 100)
AND (name = 'sweatshirt' OR name = 'sneakers');
} {5|sweatshirt|74.0
8|sneakers|82.0}