Commit Graph

75 Commits

Author SHA1 Message Date
Nikita Sivukhin
e7c501a3be add simple fuzz test with table data 2025-02-15 16:27:11 +04:00
Nikita Sivukhin
610d41ae9e add fuzz test for math functions 2025-02-15 14:33:37 +04:00
Nikita Sivukhin
aa3cafba51 add fuzz test for replace and substr 2025-02-15 13:21:40 +04:00
Pekka Enberg
604ca4085d Merge 'Make record values private' from Tiago
This is an attempt to move towards #881. I am not sure this is the
direction you want to take. In any case, I thought I would take a crack
at converting `values` from `Record` to private and see how bad it would
be.
In the end, as you can see, it is not so bad. I think performance-wise
it shouldn't be a bad hit with Rust's zero-cost abstraction. Also,
during the process I noticed a couple improvements that could be made
here and there but I honestly wanted to start with something small
enough that wouldn't be too hard to review.
Anyway, let me know if this is really how you would like to proceed.

Closes #962
2025-02-10 11:23:21 +02:00
Pekka Enberg
00a546e775 Merge 'Fix string funcs' from Nikita Sivukhin
Add fuzz test for string functions and fix 2 bugs in implementation of
`LTRIM/RTRIM/TRIM` and `QUOTE`:
- `QUOTE` needs to escape internal quote(`'`) symbols
- `LTRIM`/`RTRIM`/`TRIM` needs to check if they have additional argument

Closes #958
2025-02-10 11:17:51 +02:00
Pekka Enberg
55058cade3 Merge 'Fix cast' from Nikita Sivukhin
Fix codegen for `CAST` expression and also adjust implementation of
`CAST: Real -> Int` because `SQLite` use "closest integer between the
REAL value and zero" as a CAST result.

Closes #956
2025-02-10 10:53:56 +02:00
Pekka Enberg
09b402e261 Merge 'Fix coalesce' from Nikita Sivukhin
Add `COALESCE` function in fuzz test and fix bug (found by fuzzer with
`COALESCE`) related to the resolution of labels which needs to be
resolved to next emitted instruction.
Before, code assumed that no two labels will need to be resolved to next
emitted instruction. But this assumption is wrong (at least in current
codegen logic) for example for following expression `COALESCE(0,
COALESCE(0, 0))`. Here, both `COALESCE` functions will create label and
resolve it to next emitted instruction in the end of generation. So, in
this case one of the labels will be actually "orphaned" and never be
assigned any position in the emitted code.

Closes #955
2025-02-10 10:53:44 +02:00
Pekka Enberg
31886e8f4c Merge 'Fix case and emit' from Nikita Sivukhin
(after fixing complicated b-tree bugs - I want to end my day with the
joy of fixing simple bugs)
This PR fix bug in emit (which was introduced after switch from
`HashMap` to `Vec`) and also align `CASE` codegen in case of `NULL`
result from `WHEN` clause with SQLite behaviour.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #953
2025-02-10 10:53:31 +02:00
Tiago Ribeiro
d00b44d7cd Update integration tests to use the new retrieval methods to access Record values. 2025-02-10 00:31:31 -07:00
Nikita Sivukhin
f22bfad695 reduce amount of iterations in fuzz test 2025-02-09 23:44:38 +04:00
Nikita Sivukhin
459a78bc64 add fuzz test for few string functions 2025-02-09 23:43:34 +04:00
Nikita Sivukhin
d2fb772936 adjust CAST fuzzing options 2025-02-09 22:47:06 +04:00
Nikita Sivukhin
e3e399f9b1 fixup fuzz 2025-02-09 22:31:13 +04:00
Nikita Sivukhin
9a3af4bd06 add CAST expression in the fuzz test 2025-02-09 22:20:13 +04:00
Nikita Sivukhin
abcebf7915 add coalesce in fuzz test 2025-02-09 21:55:43 +04:00
Nikita Sivukhin
c3b7938266 add case expr in fuzzer and adjust probabilities 2025-02-09 21:33:14 +04:00
Aarni Koskela
eaea02c567 Fix a handful of typos 2025-02-09 18:08:29 +02:00
Pekka Enberg
c210821100 core: Move result row to ProgramState
Move result row to `ProgramState` to mimic what SQLite does where `Vdbe`
struct has a `pResultRow` member. This makes it easier to deal with result
lifetime, but more importantly, eventually lazily parse values at the edges of
the API.
2025-02-06 11:52:26 +02:00
Levy A.
dcd32e1ec8 fix: clippy + new errors 2025-02-03 16:58:13 -03:00
Nikita Sivukhin
f43a326649 add examples of tests found by fuzzer 2025-02-03 11:25:14 +04:00
Nikita Sivukhin
529c2df6f6 add few scalar function with binary result in logical fuzz test 2025-02-03 11:25:14 +04:00
Nikita Sivukhin
17d06a1d28 adjust options for logical fuzz test 2025-02-03 11:25:14 +04:00
Nikita Sivukhin
c2950d144e add logical expression fuzz tests 2025-02-03 11:25:14 +04:00
Nikita Sivukhin
41419ab11a add env logger and fix range 2025-02-02 20:12:56 +04:00
Nikita Sivukhin
300f278ff3 use TempDatabase from commons in tests/ 2025-02-02 19:34:15 +04:00