Commit Graph

2963 Commits

Author SHA1 Message Date
Nikita Sivukhin
3233d60bea trying to debug hungs in CI 2025-02-15 18:03:29 +04:00
Nikita Sivukhin
ee8b03528d fix codegen for and predicate - as jump_if_condition_is_true can be overwritten higher in the stack 2025-02-15 16:27:27 +04:00
Nikita Sivukhin
e7c501a3be add simple fuzz test with table data 2025-02-15 16:27:11 +04:00
Pekka Enberg
f220f9a948 Merge 'Add modified clickbench script to repo + CI' from Jussi Saurio
Closes #1014
2025-02-15 12:05:15 +02:00
Jussi Saurio
e8c0717f5b Add modified clickbench script to repo + CI 2025-02-15 11:48:06 +02:00
Pekka Enberg
30f700174c Merge 'Added IdxLE and IdxLT opcodes' from Omolola Olamide
I added the two opcodes as an initial step. They are pretty easy to
implement since we already have the counterparts i.e., IdxGE and IdxGT
Is there a design reason behind their omission @penberg @PThorpe92?
I noticed the same for SeekLE and SeekLT.

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

Closes #1010
2025-02-15 11:10:17 +02:00
Pekka Enberg
7e173291d5 Merge 'cleanup shell tests and cli' from Clyde K.
Refactored CLI, cleaned up duplicate code.
@PThorpe92

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #941
2025-02-15 11:08:58 +02:00
Pekka Enberg
20e37e485a Merge 'Implement the legacy_file_format pragma' from Glauber Costa
easy implementation, sqlite claims it is a noop now
"This pragma no longer functions. It has become a no-op. The
capabilities formerly provided by PRAGMA legacy_file_format are now
available using the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option to the
sqlite3_db_config() C-language interface."

Closes #1007
2025-02-15 11:03:05 +02:00
Pekka Enberg
c53897cb6c Merge 'Support numeric column references in GROUP BY' from Jussi Saurio
We already supported this for ORDER BY but not GROUP BY - again noticed
this when running against some clickbench queries

Closes #1008
2025-02-15 11:02:28 +02:00
Pekka Enberg
71b15ae4f1 Merge 'cli: Basic dump support' from Glauber Costa
Basic dump support
This is a basic support for the very useful .dump command. It doesn't
yet implement any of the dump options sqlite has, and it doesn't add
some of the logic for things like indexes, since we don't have them.

Closes #1011
2025-02-15 10:49:56 +02:00
Pekka Enberg
a853e6f538 Merge 'select: fix bug with referring to a mixed-case alias' from Jussi Saurio
was running some clickbench queries against limbo and noticed this one

Closes #1006
2025-02-15 10:49:17 +02:00
Glauber Costa
82ceaebe01 Basic dump support
This is a basic support for the very useful .dump command.
It doesn't yet implement any of the dump options sqlite has,
and it doesn't add some of the logic for things like indexes,
since we don't have them.
2025-02-14 15:54:46 -05:00
[B
e52f218136 fix format 2025-02-14 21:10:51 +01:00
[B
5214cf9859 Added IdxLE and IdxLT opcodes 2025-02-14 20:22:30 +01:00
Jussi Saurio
eca196a54b Support numeric column references in GROUP BY 2025-02-14 16:57:45 +02:00
Glauber Costa
fbe439f6c2 Implement the legacy_file_format pragma
easy implementation, sqlite claims it is a noop now

"This pragma no longer functions. It has become a no-op. The capabilities
formerly provided by PRAGMA legacy_file_format are now available using
the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option to the sqlite3_db_config()
C-language interface."
2025-02-14 09:50:29 -05:00
Jussi Saurio
a7300a4e0c select: fix bug with referring to a mixed-case alias 2025-02-14 16:40:58 +02:00
Pekka Enberg
d9f4558255 build: Clean up top-level Cargo.toml 2025-02-14 12:43:17 +02:00
Pekka Enberg
a302828376 core/transalte: Fix invalid sqlite3_parser import 2025-02-14 12:27:57 +02:00
Pekka Enberg
43574528c9 Merge 'Switch to workspace dependencies' from Pekka Enberg
...makes it easier to specify a version, which is needed for `cargo
publish`.

Closes #991
2025-02-14 12:21:24 +02:00
Pekka Enberg
64cdfd829e Merge 'core/translate: BEGIN EXCLUSIVE support' from Pekka Enberg
After reading the fine print, SQLite documentation explains that `BEGIN
IMMEDIATE` and `BEGIN EXCLUSIVE` are the same thing in WAL mode:
https://www.sqlite.org/lang_transaction.html
As that's the only mode we support, let's just add code generation for
`BEGIN EXCLUSIVE`.
Fixes #1002

Closes #1003
2025-02-14 12:20:22 +02:00
Pekka Enberg
20e881ae0d testing: Disable transaction tests for now 2025-02-14 12:19:58 +02:00
Pekka Enberg
e3925c4531 core/vdbe: Fix Program::halt() to respect autocommit state 2025-02-14 12:11:37 +02:00
Pekka Enberg
b949ef5360 Update COMPAT.md 2025-02-14 11:58:54 +02:00
Pekka Enberg
76bdbb54ef core/translate: BEGIN EXCLUSIVE support
After reading the fine print, SQLite documentation explains that `BEGIN
IMMEDIATE` and `BEGIN EXCLUSIVE` are the same thing in WAL mode:

https://www.sqlite.org/lang_transaction.html

As that's the only mode we support, let's just add code generation for
`BEGIN EXCLUSIVE`.

Fixes #1002
2025-02-14 11:52:18 +02:00
Pekka Enberg
567a2e9a9f Merge 'BEGIN IMMEDIATE + COMMIT support' from Pekka Enberg
Closes #1000
2025-02-14 11:48:38 +02:00
Pekka Enberg
ae3c6b7ec5 core/vdbe: Fix AutoCommit instruction to halt the VM
Pointed out by Jussi
2025-02-14 11:43:16 +02:00
Pekka Enberg
948585bb42 core/vdbe: Extract Program::halt() helper
We need this for AutoCommit opcode too.
2025-02-14 11:42:24 +02:00
Pekka Enberg
4b7270de11 Merge 'fix some typo' from meteorgan
Closes #999
2025-02-14 10:37:40 +02:00
Pekka Enberg
a8cadf205c Merge 'doc: Use limbo_cli as package instead for running limbo cli' from Takayuki Maeda
I found invalid option while reading CONTRIBUTING.md and trying some
commands in it.
error:
```
$ cargo run --package limbo --bin limbo database.db
error: no bin target named `limbo`.

$ rustc --version
rustc 1.83.0 (90b35a623 2024-11-26)
```
ref: https://github.com/tursodatabase/limbo/blob/291637cc7120303fd7337c3
42cf5dbc9363faa85/cli/Cargo.toml#L17

Closes #995
2025-02-14 10:35:42 +02:00
Pekka Enberg
076331d8cf testing: Basic BEGIN + END test 2025-02-14 10:26:55 +02:00
Pekka Enberg
5626ca450f core/translate: COMMIT support
```
limbo> EXPLAIN COMMIT;
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     3     0                    0   Start at 3
1     AutoCommit         1     0     0                    0   auto_commit=true, rollback=false
2     Halt               0     0     0                    0
3     Goto               0     1     0                    0
```
2025-02-14 10:26:55 +02:00
Pekka Enberg
9fff9f6081 core/translate: BEGIN IMMEDIATE support
Emit the following code sequence for `BEGIN IMMEDIATE`:

```
limbo> EXPLAIN BEGIN IMMEDIATE;
addr  opcode             p1    p2    p3    p4             p5  comment
----  -----------------  ----  ----  ----  -------------  --  -------
0     Init               0     4     0                    0   Start at 4
1     Transaction        0     1     0                    0
2     AutoCommit         0     0     0                    0   auto_commit=false, rollback=false
3     Halt               0     0     0                    0
4     Goto               0     1     0                    0
```

Please note that SQLite emits *two* transaction instructions -- one for
main database and one for temporary tables. However, since we don't
support the latter, we only emit one transaction instruction.
2025-02-14 10:26:31 +02:00
Pekka Enberg
34b0c7c09a core/vdbe: AutoCommit instruction 2025-02-14 10:26:31 +02:00
Takayuki Maeda
291637cc71 use limbo_cli instead 2025-02-14 01:45:33 +09:00
meteorgan
744df6eedf fix some typo 2025-02-13 23:03:41 +08:00
CK-7vn
5f02521d08 cleanup shell tests and cli 2025-02-13 00:49:12 -05:00
Takayuki Maeda
e9b4d933b5 remove unnecessary option for running limbo cli 2025-02-13 05:00:43 +09:00
Pekka Enberg
248a369afc Merge 'build: Update cargo-dist to latest' from Pekka Enberg
Closes #992
2025-02-12 18:13:05 +02:00
Pekka Enberg
d63be7492d build: Update cargo-dist to latest 2025-02-12 17:30:02 +02:00
Pekka Enberg
ac54c35f92 Switch to workspace dependencies
...makes it easier to specify a version, which is needed for `cargo publish`.
2025-02-12 17:28:04 +02:00
Pekka Enberg
e464f99234 Revert "github: Update to "ubuntu-22.04" image"
This reverts commit bb8ab4088b. We need `cargo-dist` to do this...
2025-02-12 17:20:33 +02:00
Pekka Enberg
d1e8bb986f Fix RustDoc imports 2025-02-12 17:17:33 +02:00
Pekka Enberg
2e5fc62c45 bindings/rust: Add example.rs 2025-02-12 16:55:05 +02:00
Pekka Enberg
0b83e98031 bindings/rust: Make "limbo_core" workspace dependency 2025-02-12 16:53:41 +02:00
Pekka Enberg
c612b0932e bindings/rust: Rename crate to "limbo" 2025-02-12 16:49:53 +02:00
Pekka Enberg
a8a22e412c github: Add timeout to compatibility tests
...one job was running non-stop for an hour, which is clearly not right.
2025-02-12 09:56:39 +02:00
Pekka Enberg
01671d1d1e Merge 'Performance improvements for Unix I/O backend' from Preston Thorpe
This PR reworks the unix I/O backend, removing runtime reference
counting/borrow checking and optimizing away the hashmap in favor of a
static array, with an unlikely fallback vec.
The only reason the fallback vec is there is because unlike the
`io_uring` module, we cannot simply index into the array with the fd  as
the OS could theoretically give us a fd up to I believe 1024 so keeping
an array of that size for a few elements is unnecessary.

Closes #940
2025-02-12 09:29:41 +02:00
Pekka Enberg
e4d4e5cd5d Merge 'Streamline dependencies to build for all wasm targets' from Doug A
In order [experimentally
compile](https://github.com/DougAnderson444/wit-limbo) `limbo_core` to a
[wasm component](https://component-model.bytecodealliance.org/), limbo
needed to have no reliance on `js`, `js-sys`, `wasm-bindgen`, et al.
(for those who aren't familiar, there are many `wasm` runtimes and not
all of them play nice with `wasm-bindgen`)
This PR simply cleans up the dependencies, and puts them behind optional
flags and whatnot in order to enable this. Both `log` and `tracing` were
being used, so I reduced this only to `tracing`.
End result is limbo can be used like this:
https://github.com/DougAnderson444/wit-limbo
We can open a discussion on the possibilities that running limbo as a
wasm component can offer, including potentially using composable
components to implement the sqlite runtime extensions, as well as giving
us a clean interface for PlatformIO operations -- define them once,
implement many ways on various platforms. I'm new to limbo, but it looks
like current extension are Rust based deps and features flags, whereas
sqlite is runtime, right? What if limbo was runtime extensible too?
The WIT interface is largely sync (though I believe wasmtime has an
async feature), but in my limited exposure to limbo so far a lot of the
wasm seems sync already anyway. Again, topic for further discussion.
Suffice to say, aligning these deps in this way paves the road for
further experiments and possibilities.
Related: https://github.com/neilg63/julian_day_converter/pull/2
Related: https://github.com/tursodatabase/limbo/issues/950
Closes: https://github.com/tursodatabase/limbo/issues/950

Closes #983
2025-02-12 09:24:04 +02:00
Pekka Enberg
cc4ecf43c4 Merge 'extensions/regexp: Add support for regexp_replace()' from lgualtieri75
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #986
2025-02-12 09:21:52 +02:00