Commit c22f251
feat(planner): seek a fixed-prefix GLOB range on a BINARY index (B9f)
`col GLOB 'abc*'` now seeks the `[abc, abd)` byte range on a BINARY index and
renders `SEARCH t USING INDEX tb (b>? AND b<?)` instead of scanning. SQLite's
GLOB is always case-sensitive and byte-based, so the index must be BINARY — the
seek is gated on the column's collation, matching sqlite (which scans a NOCASE
index). Implemented as a `BinaryOp::Glob` arm in the shared
collect_range_constraints, so the executor range seek and the eqp_access label
move in lockstep; the new glob_prefix_range helper extracts the literal prefix
(up to the first `*`/`?`/`[`) and forms the exclusive upper bound by incrementing
the last byte (dropping trailing 0xFF; a non-UTF-8 increment yields a
lower-bound-only seek). The full GLOB is re-applied, so results are exact.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent a4a6a97 commit c22f251
3 files changed
Lines changed: 162 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1207 | 1212 | | |
1208 | 1213 | | |
1209 | 1214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30465 | 30465 | | |
30466 | 30466 | | |
30467 | 30467 | | |
| 30468 | + | |
| 30469 | + | |
| 30470 | + | |
| 30471 | + | |
| 30472 | + | |
| 30473 | + | |
| 30474 | + | |
| 30475 | + | |
| 30476 | + | |
| 30477 | + | |
| 30478 | + | |
| 30479 | + | |
| 30480 | + | |
| 30481 | + | |
| 30482 | + | |
| 30483 | + | |
| 30484 | + | |
| 30485 | + | |
| 30486 | + | |
| 30487 | + | |
| 30488 | + | |
| 30489 | + | |
| 30490 | + | |
| 30491 | + | |
| 30492 | + | |
| 30493 | + | |
| 30494 | + | |
| 30495 | + | |
| 30496 | + | |
| 30497 | + | |
| 30498 | + | |
| 30499 | + | |
| 30500 | + | |
| 30501 | + | |
| 30502 | + | |
| 30503 | + | |
30468 | 30504 | | |
30469 | 30505 | | |
30470 | 30506 | | |
| |||
30592 | 30628 | | |
30593 | 30629 | | |
30594 | 30630 | | |
| 30631 | + | |
| 30632 | + | |
| 30633 | + | |
| 30634 | + | |
| 30635 | + | |
| 30636 | + | |
| 30637 | + | |
| 30638 | + | |
| 30639 | + | |
| 30640 | + | |
| 30641 | + | |
| 30642 | + | |
| 30643 | + | |
| 30644 | + | |
| 30645 | + | |
| 30646 | + | |
| 30647 | + | |
| 30648 | + | |
| 30649 | + | |
| 30650 | + | |
| 30651 | + | |
| 30652 | + | |
| 30653 | + | |
30595 | 30654 | | |
30596 | 30655 | | |
30597 | 30656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
0 commit comments