Repository navigation
Commit d8e7467
authored
fix(duckdb): escape LIKE metacharacters in pushed string filters (#11072)
DuckDB matches the argument of `contains`, `prefix` and `suffix`
literally, and its `LIKE` has no escape character. The converter passed
both to Vortex `LIKE` unchanged, where `%` and `_` are wildcards and `\`
escapes the next character, so filters pushed into a Vortex scan
returned wrong rows:
- `prefix(s, 'page_')`, and `s GLOB 'page_*'`, which DuckDB rewrites to
it, also returned `pageXview`.
- `contains(s, 'a_c')` also returned `abc`, and `contains(s, '%')`
matched every string.
- `s LIKE 'C:\%'` returned `C:%` instead of `C:\x`.
The converter now escapes `%`, `_` and `\` in those arguments, as the
Spark connector does for its string predicates, and `\` in a constant
`LIKE` pattern. A `LIKE` whose pattern is not a constant is left to
DuckDB. Arguments without these characters push the same pattern as
before.
Signed-off-by: jackylee-ch <[email protected]>1 parent 9ba7f6e commit d8e7467
2 files changed
Lines changed: 89 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
109 | 121 | | |
110 | 122 | | |
111 | 123 | | |
| |||
312 | 324 | | |
313 | 325 | | |
314 | 326 | | |
315 | | - | |
| 327 | + | |
316 | 328 | | |
317 | 329 | | |
318 | | - | |
| 330 | + | |
319 | 331 | | |
320 | 332 | | |
321 | 333 | | |
322 | 334 | | |
323 | 335 | | |
324 | 336 | | |
325 | | - | |
| 337 | + | |
326 | 338 | | |
327 | 339 | | |
328 | 340 | | |
| |||
332 | 344 | | |
333 | 345 | | |
334 | 346 | | |
| 347 | + | |
335 | 348 | | |
336 | 349 | | |
337 | 350 | | |
| |||
459 | 472 | | |
460 | 473 | | |
461 | 474 | | |
462 | | - | |
| 475 | + | |
| 476 | + | |
463 | 477 | | |
464 | 478 | | |
465 | 479 | | |
| |||
| 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 | + | |
0 commit comments