Commit Graph

1443 Commits

Author SHA1 Message Date
PThorpe92
fbf42458b8 Use custom expr equality check in translation and planner 2024-12-22 21:46:31 -05:00
Pekka Enberg
264b901191 Merge 'Macro for generating opcode description from Rustdoc' from Vignesh
Reference Issue: #393
This PR implements a procedural macro derive_description that automates
the generation of a get_description method for enums. The macro extracts
documentation comments (specified with `/// Description...`) associated
with enum variants and generates an implementation that provides
optional descriptions for each variant.

Closes #528
2024-12-21 10:37:01 +02:00
Pekka Enberg
bff2b6016e Merge 'simulator: Use "mod.rs" for module top-level files' from Pekka Enberg
Let's use "mod.rs" for the module top-level file as we do in the rest of
the Limbo codebase for consistency.

Closes #529
2024-12-21 10:29:12 +02:00
Pekka Enberg
13f229020e simulator: Use "mod.rs" for module top-level files
Let's use "mod.rs" for the module top-level file as we do in the rest of
the Limbo codebase for consistency.
2024-12-21 09:50:23 +02:00
vignesh-j-shetty
a43a1d204c renamed macro crate 2024-12-21 13:19:04 +05:30
vignesh-j-shetty
1e72fee343 Implemented proc_macro_derive extract description from rust docs and generate get_description function 2024-12-21 12:23:04 +05:30
Pekka Enberg
64c26e486f Merge 'Structured Generation for the Simulator' from Alperen Keleş
- added Arbitrary and ArbitraryOf<T> traits for mroe centralized
generation
- implemented random generation for tables and structured queries

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #464
2024-12-21 08:44:05 +02:00
Pekka Enberg
307a7cb5d1 Merge 'Improve error reporting in Python bindings' from amuldotexe
Solving issue #494   , changes made at 5 places where todo macros were
replaced with relevant errors to avoid the crashes _for now_

Reviewed-by: Avinash Sajjanshetty <opensource@avi.im>

Closes #526
2024-12-21 08:34:46 +02:00
alpaylan
8f8b97d54b add the missing rowresult variant 2024-12-20 12:27:54 -05:00
alpaylan
d2723b777b update table create probability, print interactions as info logs 2024-12-20 12:18:03 -05:00
Alperen Keleş
54c3423fec Merge branch 'tursodatabase:main' into main 2024-12-20 12:17:10 -05:00
jussisaurio
82bc9501fd Merge 'feat(optimizer): eliminate between statement' from KaguraMilet
Rewrite `Y BETWEEN X AND Z` as `X <= Y AND Y <= Z`. And due to the
support of this optimization rule, limbo should now be able to execute
the `BETWEEN AND` statement.

Closes #490
2024-12-20 17:23:42 +02:00
KaguraMilet
ef39f11a9f fix(optimizer): process Parenthesized expression 2024-12-20 23:11:17 +08:00
amuldotexe
b7b22f303f ran cargofmt 2024-12-20 20:36:35 +05:30
amuldotexe
f912771ae6 gracefully handling errors for issue https://github.com/tursodatabase/limbo/issues/494 , changes made 5 places where todo macros were replaced with relevant errors 2024-12-20 20:32:03 +05:30
KaguraMilet
d5d7185995 add between expr tests 2024-12-20 22:49:44 +08:00
jussisaurio
5b4ef4412b Merge 'Implement json_array' from Kacper Madej
Implements [json_array](https://sqlite.org/json1.html#jarray).
As a side quest, this PR also fixes an issue with the `CHAR` function
which didn't work properly if the parameters were  non-leaf AST nodes.
The PR is quite big, because as I mentioned in https://github.com/tursod
atabase/limbo/issues/127#issuecomment-2541307979 we had to modify
`OwnedValue::Text` to support a `subtype` parameter, which is what
SQLite does.

Closes #504
2024-12-20 16:35:40 +02:00
Kacper Madej
e2fc03e822 Update COMPAT.md 2024-12-20 11:32:57 +01:00
Kacper Madej
cdb24d3de1 Handle issues with nested arguments 2024-12-20 11:32:57 +01:00
Kacper Madej
19ae42dfa3 Implement json_array 2024-12-20 11:15:48 +01:00
Pekka Enberg
8387e7903c sqlite: Fix source formatting 2024-12-20 09:30:03 +02:00
Pekka Enberg
07ae003db7 Update PERF.md 2024-12-20 09:22:44 +02:00
Pekka Enberg
56710b0187 sqlite3: Implement sqlite3_free_table() 2024-12-20 09:18:31 +02:00
Pekka Enberg
03ae123060 Add PERF.md with Mobibench instructions 2024-12-20 09:15:21 +02:00
Pekka Enberg
d0fa9e07f7 Merge 'sqlite3: Add sqlite3_wal_checkpoint_*() API' from Pekka Enberg
This wires up checkpointing to the SQLite C API. We don't respect the
checkpointing mode because core does not have that nor do we report back
some stats.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #480
2024-12-20 09:06:04 +02:00
Pekka Enberg
875619791b Merge 'Implement basic sqlite3_get_table() API' from Diego Reis
#479
This is my first draft for implementing `sqlite3_get_table()`, it is
highly inspired on the actual implementation found [here](https://raw.gi
thubusercontent.com/rusqlite/rusqlite/92fdc11fea0ecea6400dfcb74c1c3ca362
14a7d4/libsqlite3-sys/sqlite3/sqlite3.c), I made some basic manual
testing in `example.c` and it works fine but an extensive test suite is
recommended.

Closes #519
2024-12-20 09:05:50 +02:00
alpaylan
b355568023 use ticks as the main simulator driver, handle disconnects correctly, add multi-connection setup 2024-12-19 23:40:04 -05:00
Diego Reis
3a0e56bca5 Implement basic sqlite3_get_table() API 2024-12-19 23:13:51 -03:00
jussisaurio
acdfe2be0c Merge 'cleanup: replace &(*x) with x.as_ref() for smart pointer derefs' from Ziyak Jehangir
The only instances of the &(*x) dereferencing pattern in the codebase,
is used with Completion smart pointers. Changed it to use as_ref(). No
functional changes.

Closes #516
2024-12-19 17:43:59 +02:00
Pekka Enberg
91a5994eac Merge 'Fix Python binding packaging' from Gökmen Görgen
Somehow the `make` command does not work because of the name
mismatching. This PR will fix only this issue.
For reproducing the issue:
```
$ make

Checking requirements files...
mkdir -p .tmp
pip-compile pyproject.toml --quiet             --output-file=.tmp/requirements.txt
pip-compile pyproject.toml --quiet --extra=dev --output-file=.tmp/requirements-dev.txt
diff -u requirements.txt     .tmp/requirements.txt     || (echo "requirements.txt doesn't match pyproject.toml"     && exit 1)
--- requirements.txt    2024-12-17 02:19:29.887227723 +0000
+++ .tmp/requirements.txt       2024-12-17 02:19:38.046065295 +0000
@@ -1,2 +1,2 @@
 typing-extensions==4.12.2
-    # via limbo (pyproject.toml)
+    # via pylimbo (pyproject.toml)
requirements.txt doesn't match pyproject.toml
make: *** [Makefile:28: check-requirements] Error 1
```
## Another issue...
`maturin` is still not in requirements dev list. Shall we continue to
install it manually or add it to dev list?

Closes #495
2024-12-19 17:13:52 +02:00
jussisaurio
80d438ba58 Merge 'Handle all SQLite quoting syntax' from Kacper Madej
This PR adds missing SQLite quoting syntax:
https://sqlite.org/lang_keywords.html
Closes #483
Closes #497
```bash
➜  limbo git:(missing-quoting) ✗ cargo run --package limbo --bin limbo home.db
Limbo v0.0.9
Enter ".help" for usage hints.
limbo> select * from home limit 1;
Documents|dir|280|2024-10-13 06:26:05.605048960+02:00
limbo> select * from [home] limit 1;
Documents|dir|280|2024-10-13 06:26:05.605048960+02:00
limbo> select * from `home` limit 1;
Documents|dir|280|2024-10-13 06:26:05.605048960+02:00
limbo> select * from "home" limit 1;
Documents|dir|280|2024-10-13 06:26:05.605048960+02:00
```

Closes #492
2024-12-19 17:00:23 +02:00
Ziyak Jehangir
99d1b0e5a3 cleanup: replace &(*x) with x.as_ref() for smart pointer derefs 2024-12-19 19:36:04 +05:30
Pere Diaz Bou
dbe6b8d899 Merge 'Add statement interruption support' from Pekka Enberg
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #512
2024-12-19 12:59:19 +01:00
Pekka Enberg
e93ac38e55 Add statement interruption support
This adds an interrupt() method to Statement that allows apps to
interrupt a running statement. Please note that this is different from
`sqlite3_interrupt()` which interrupts all ongoing operations in a
database. Although we want to support that too, per statement interrupt
is much more useful to apps.
2024-12-19 12:30:32 +02:00
Pekka Enberg
10ab841d56 Merge 'Fix limbo_sqlite3 static library build' from mag1c1an1
Static lib was built successfully  on MacOS 15.0.1 (24A348) and Linux
fedora 6.12.4-orbstack-00286-g339578031cbf

Closes #511
2024-12-19 11:44:53 +02:00
mag1c1an1
ab306e9550 Fix issue #499 (add crate-type in libmo_sqlite3)
Signed-off-by: mag1c1an1 <mag1cian@icloud.com>
2024-12-19 17:33:06 +08:00
alpaylan
cb20ca7e40 fix formatting 2024-12-18 17:10:18 -05:00
alpaylan
39b5dbed55 change gen.range based queries into frequency and one_of calls 2024-12-18 17:09:44 -05:00
Gökmen Görgen
682f014817 add maturin as dev dependency. 2024-12-18 21:14:58 +00:00
Pekka Enberg
69e3dd28f7 Limbo 0.0.10 2024-12-18 20:45:55 +02:00
Kacper Madej
9e01c22a5e Handle quoting identifiers properly 2024-12-18 19:45:06 +01:00
Pere Diaz Bou
94d69c5a4e Merge 'pragma: inital approach to handle pragma statements' from Raul Ferrando
This change refactors how PRAGMA statements are handled, introducing a
more organized and extensible structure to simplify adding new PRAGMA
properties in the future.
Previously, only the `cache_size` PRAGMA was supported. With this
update, support for the `journal_mode` PRAGMA has been added.

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #501
2024-12-18 17:34:35 +01:00
Raul Ferrando
d74012bb59 fix pragma parsing potential errors 2024-12-18 17:26:16 +01:00
Raul Ferrando
a6d1a7cb56 pragma: inital approach to handle pragma statements
This change refactors how PRAGMA statements are handled, introducing a
more organized and extensible structure to simplify adding new PRAGMA
properties in the future.

Previously, only the `cache_size` PRAGMA was supported. With this
update, support for the `journal_mode` PRAGMA has been added.
2024-12-18 17:26:16 +01:00
Pere Diaz Bou
26b4608088 Merge 'Fix CI build' from Kacper Madej
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #505
2024-12-18 17:25:03 +01:00
Kacper Madej
89f5167315 Fix CI build 2024-12-18 16:43:35 +01:00
Pekka Enberg
c16c660aa6 Merge 'cli: added .tables command' from Konstantinos Artopoulos
This PR adds the `.tables` command. I use it a lot in sqlite and I
noticed it was missing from here so I decided to contribute.
Let me know if any changes or improvements are required.

Reviewed-by: Preston Thorpe <alpkeles99@gmail.com>

Closes #503
2024-12-18 12:31:00 +02:00
Konstantinos Artopoulos
fb2908b3e9 refactor(testing): move .table tests to shelltests.py 2024-12-18 09:10:37 +02:00
alpaylan
66e7a4edec fix formatting 2024-12-17 18:30:55 -05:00
alpaylan
7d4d803a13 implement interaction plans 2024-12-17 18:24:39 -05:00