Sqlite reference implementation: https://github.com/sqlite/sqlite/blob/8
37dc09bce7de8971c7488b70cf5da93c60fbed0/src/vdbe.c#L2558
We did not support blobs before and our ordering of the match statements
were incorrect when one of the arguments was NULL
Closes#1337
Currently, to run the fuzz test you need to remove an assert statement.
EDIT: @diegoreis42 pointed it out to me that the method had just changed
actually. Made the change to use `row.len()` instead
# Problem
```
cargo +nightly fuzz run --target=aarch64-apple-darwin expression
Compiling limbo_core v0.0.19-pre.4 (/Users/pedro/Projects/limbo/core)
Compiling limbo-fuzz v0.0.0 (/Users/pedro/Projects/limbo/fuzz)
error[E0599]: `&limbo_core::vdbe::Row` is not an iterator
--> fuzz_targets/expression.rs:198:36
|
198 | assert_eq!(row.count(), 1, "expr: {:?}", expr);
| ^^^^^
| |
| `&limbo_core::vdbe::Row` is not an iterator
| private field, not a method
|
::: /Users/pedro/Projects/limbo/core/vdbe/mod.rs:221:1
|
221 | pub struct Row {
| -------------- doesn't satisfy `limbo_core::vdbe::Row: std::iter::Iterator`
|
= note: the following trait bounds were not satisfied:
`&limbo_core::vdbe::Row: std::iter::Iterator`
which is required by `&mut &limbo_core::vdbe::Row: std::iter::Iterator`
`limbo_core::vdbe::Row: std::iter::Iterator`
which is required by `&mut limbo_core::vdbe::Row: std::iter::Iterator`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `limbo-fuzz` (bin "expression") due to 1 previous error
Error: failed to build fuzz script: ASAN_OPTIONS="detect_odr_violation=0" RUSTFLAGS="-Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-pc-table -Cllvm-args=-sanitizer-coverage-trace-compares --cfg fuzzing -Clink-dead-code -Zsanitizer=address -Cdebug-assertions -C codegen-units=1" "cargo" "build" "--manifest-path" "/Users/pedro/Projects/limbo/fuzz/Cargo.toml" "--target" "aarch64-apple-darwin" "--release" "--config" "profile.release.debug=true" "--bin" "expression"
```
Closes#1334
Fixes#1298
- Fixes Limbo trying to use an index using a WHERE clause constraint
that refers to the same table on both sides, e.g. `WHERE t.x = t.x`
- Fixes not using indexes when the relevant expression is paren wrapped,
e.g.
- `SELECT * FROM t WHERE (indexcol) > 5`
- `SELECT * FROM t WHERE (indexcol > 5)`
- Changes existing table logical expr fuzz test to have primary keys
(which helped me find both issues above)
Closes#1300
Fixed is_empty assertion in #1203 , but simulator still has error.
```sh
[ERROR] error Internal error: select '(engrossing_berger < X'6566651A3C70278D4E200657551D8071A1' AND competitive_petit > 1236742147.9451914)' should return no values for table 'super_becky'
```
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>
Closes#1308
Some enabler work for enabling autoindexing, which means creating a
transient in memory index when a persistent index is not found. This is
used to avoid nested full table scans.
@pereman2 I added some functionality to your `SmallVec` so would
appreciate a review of those parts
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>
Closes#1340
First ~actual~ step to close#741, this time I'm following an approach
way closer to what SQLite does by just creating a normal `BTreeCursor`
and using an in-memory pager (thanks @krishvishal for the insight
🤝).
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>
Closes#1139
"Open a new cursor P1 to a transient table. The cursor is always opened read/write even if the main database is read-only. The ephemeral table is deleted automatically when the cursor is closed.
If the cursor P1 is already opened on an ephemeral table, the table is cleared (all content is erased)."
There is still some work to do, but this is a basic setup
Honestly I don't have 100% sure if this is a good idea, the reasoning is that in any IO we'll want to do memory only operations like creating tables etc, so may want a common way to access it
Me and @diegoreis42 were late at night, running the new fuzzer and saw
some errors with `Bit-Not` and `Not` operations. Added some tests as
well for those fixes.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Closes#1328
Passing 1s and 0s with comments is not rustacean, and since we already follow the pattern of struct flags in other sections of the codebase it's better use it here too.