Commit Graph

10673 Commits

Author SHA1 Message Date
Lauri Virtanen
f69fdc1645 Support unary math functions 2024-12-16 19:31:20 +02:00
Lauri Virtanen
793a85a14c Tolerate floating point minor differences in compatibility tests 2024-12-16 19:31:20 +02:00
Lauri Virtanen
9720f63a55 Add types for mathematical functions 2024-12-16 19:31:20 +02:00
Lauri Virtanen
9e0a9b5490 Add mathematical functions table to COMPAT.md 2024-12-16 19:31:10 +02:00
Pekka Enberg
a5cb75ac61 Update CHANGELOG 2024-12-16 18:49:45 +02:00
Pekka Enberg
61269e9c03 Merge 'Fix primary key handling' from Jussi Saurio
Closes #438
**Fixes:**
- Return the actual primary key instead of the rowid when the primary
key is not a rowid alias
sqlite:
```
limbo> create table foo (pk TEXT PRIMARY KEY, value);
sqlite> insert into foo values ('one', 'payload');
sqlite> insert into foo values ('two', 'payload');
sqlite> select * from foo;
one|payload
two|payload
```
limbo now:
```
limbo> create table foo (pk TEXT PRIMARY KEY, value);
limbo> insert into foo values ('one', 'payload');
limbo> insert into foo values ('two', 'payload');
limbo> select * from foo;
one|payload
two|payload
```
limbo before:
```
limbo> select * from foo;
1|payload
2|payload
```
Then, discovered two issues when running the whole TCL test suite
against a copy of `testing.db` that does not have rowid aliases in the
tables:
- Fix trying to convert a Scan into an IndexSearch when the associated
Expr refers to a different instance of the same table in a self-join
- Fix `scan_loop_body_labels` being pushed to in different parts of the
codegen for Scan/Search nodes resulting in incorrect label resolutions
**Additions:**
- Add a new db `testing/testing_norowidalias.db` that is a carbon copy
of `testing/testing.db` except the `id` columns of `users` and
`products` are not rowid aliases (i.e. they are `INT PRIMARY KEY`
instead of `INTEGER PRIMARY KEY`
- Run all TCL tests against both test databases with `do_execsql_test`
```
(testing/testing.db)                        Running test: coalesce-from-table
(testing/testing_norowidalias.db)           Running test: coalesce-from-table
(testing/testing.db)                        Running test: coalesce-from-table-column
(testing/testing_norowidalias.db)           Running test: coalesce-from-table-column
(testing/testing.db)                        Running test: coalesce-from-table-multiple-columns
(testing/testing_norowidalias.db)           Running test: coalesce-from-table-multiple-columns
(testing/testing.db)                        Running test: glob-fn
(testing/testing_norowidalias.db)           Running test: glob-fn
(testing/testing.db)                        Running test: where-glob
(testing/testing_norowidalias.db)           Running test: where-glob
(testing/testing.db)                        Running test: where-glob-question-mark
(testing/testing_norowidalias.db)           Running test: where-glob-question-mark
```
- Allow running tests against specific db file with
`do_execsql_test_on_specific_db $path`
- Wondering if I should add a new table with e.g. text primary key and
add some db-specific tests on that table...?

Closes #449
2024-12-16 18:49:19 +02:00
Pekka Enberg
7943fa1e35 bindings/wasm: Add API reference document
The aim is towards libSQL/better-sqlite3 compatibility. Lift the API
reference document from libsql-js.git and update it accordingly to what
`limbo-wasm` supports.
2024-12-16 18:45:18 +02:00
alpaylan
53ecedaceb fix formatting 2024-12-16 10:49:56 -05:00
alpaylan
be18c6e8f0 break simulator into parts, add readme 2024-12-16 10:49:05 -05:00
KaguraMilet
1df3189db6 feat(optimizer): support NOT BETWEEN AND with De Morgan's Laws. 2024-12-16 23:28:54 +08:00
KaguraMilet
da781dffa0 feat(optimizer): eliminate between statement 2024-12-16 20:34:25 +08:00
Pere Diaz Bou
a03749be21 Merge 'Page cache by page_number and frame_number' from Pere Diaz Bou
Since page cache is now shared by default, we need to cache pages by
page number and something else. I chose to go with max_frame of
connection, because this connection will have a max_frame set until from
the start of a transaction until the end of it.
With key pairs of (pgno, max_frame) we make sure each connection is
caching based on the snapshot it is at as two different connections
might have the same pageno being using but a different frame. If both
have same max_frame then they will share same page.

Closes #468
2024-12-16 10:08:34 +01:00
Pekka Enberg
e04de2c924 Merge 'Add tests explciitly for shell behavior, more cli options' from Preston Thorpe
This adds the initial collection of tests specifically for `limbo`
shell/cli behavior, to separate the concern from testing the underlying
dbms.
Also adds `Echo` mode, and `quiet` mode cli argument for better
experience piping output of limbo on the command line.
After writing a ton of tests in `tcl`, I realized that there is no
reason at all to write these particular tests in tcl anymore, so I
rewrote them in python :)
Shell tests were added to `make test` to run in CI

Closes #487
2024-12-16 10:24:11 +02:00
Pekka Enberg
21dbc011a4 Merge 'fix: core/translate: Dont assume GROUP BY has aggregates' from Jussi Saurio
Closes #485

Closes #486
2024-12-16 10:18:32 +02:00
PThorpe92
7ca0abc61d Replace tcl with python tests and add to makefile 2024-12-15 21:40:42 -05:00
PThorpe92
fb70be752e Add first tests for shell specific options and behavior 2024-12-15 18:23:40 -05:00
PThorpe92
d6c6b84d8f Add echo and quiet modes for shell 2024-12-15 18:21:16 -05:00
jussisaurio
419ccc327e Dont assume GROUP BY has aggregates 2024-12-16 00:30:38 +02:00
Pere Diaz Bou
a4d7fee090 typos 2024-12-15 22:54:32 +01:00
Pere Diaz Bou
78d8bb1fa6 comments for everyone 2024-12-15 22:52:49 +01:00
Pere Diaz Bou
37005a23d2 fix checkpoint 2024-12-15 18:55:23 +00:00
alpaylan
0172c512ac fix formatting 2024-12-15 12:51:01 -05:00
alpaylan
ec1c796650 change the boolean name to a more descriptive version 2024-12-15 12:50:38 -05:00
Pekka Enberg
66b251f4ab Merge 'Add display message for in-memory database' from Jean Arhancet
#477

Closes #482
2024-12-15 14:59:06 +02:00
JeanArhancet
6bf8988fa0 Add display message for in-memory database 2024-12-15 11:30:27 +01:00
Pere Diaz Bou
de3449be5a add todo for cache invalidation 2024-12-15 10:03:10 +01:00
Pere Diaz Bou
c6481c4250 add missing propagation error 2024-12-15 10:02:08 +01:00
Pere Diaz Bou
e75b90e35b add contents to checkpoint page 2024-12-15 10:01:22 +01:00
Pekka Enberg
f1937ee47f sqlite3: Add sqlite3_wal_checkpoint_*() API
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.

Refs: #478
2024-12-15 10:58:52 +02:00
Pekka Enberg
1616ee02d2 Pin toolchain to Rust version 1.83
It's annoying for the CI to trip over formatting because you happen to
have a different version of Rust locally.
2024-12-15 10:54:52 +02:00
Pekka Enberg
636b78d4ff Merge 'Minimal cargo-c support' from Luca Barbato
Fixes #437

Closes #458
2024-12-15 09:30:12 +02:00
Pekka Enberg
9deea33afa cli: Add Limbo version back to shell 2024-12-15 09:26:07 +02:00
Pekka Enberg
15e55fbf74 Update CHANGELOG.md 2024-12-15 09:23:36 +02:00
Pekka Enberg
131ee6707e Merge 'In-memory mode' from Preston Thorpe
https://github.com/tursodatabase/limbo/issues/53
This PR implements a (naive) in-memory option and makes it the default
connection when no DB file argument is passed to the CLI. If a
`:memory:` parameter is passed in place of a path to a database file, to
replicate sqlite's behavior.
It's slightly more difficult to test for obvious reasons, so I added
some dumb and probably temporary ones until I can craft a better
solution. Let it be noted that I had never touched `tcl` previously if
that wasn't obvious ;)
also cleaned up a bit of previous pr, replacing`format!` calls to
writeln with `write_fmt` to prevent double allocations.
EDIT: I originally had these additional tests running with the `test-
compat`, but they would hang whenever running on github actions for
whatever reason.

Closes #476
2024-12-15 09:20:06 +02:00
Pekka Enberg
7907944f10 Update COMPAT.md 2024-12-15 09:14:50 +02:00
Pekka Enberg
fab82d800c Merge 'update compat.md' from Jussi Saurio
From "Partial" to "Yes":
```
SELECT
SELECT ... WHERE
SELECT ... ORDER BY
SELECT ... GROUP BY
SELECT ... HAVING
SELECT ... JOIN
SELECT ... CROSS JOIN
SELECT ... INNER JOIN
```
Opcodes from "No" to "Yes":
```
Compare
Gosub
IdxGE
IsNull
Jump
Return
SeekGe
SeekGt
Transaction
```
Added "Yes" for
```
PrevAsync
PrevAwait
```
Added `+` to the list of supported unary operations
Also added some comments to the syntax support table

Closes #474
2024-12-15 09:14:09 +02:00
PThorpe92
7fc9835899 Optimize replace byte vec with boxed array in memory page 2024-12-14 23:39:51 -05:00
PThorpe92
ce2851ac8d Fix properly opening new connection in shell 2024-12-14 21:20:10 -05:00
PThorpe92
a4ed8d07a5 Temporary tests for POC on in-memory IO impl 2024-12-14 20:52:45 -05:00
PThorpe92
89819eebf6 Expose memoryIO from limbo_core 2024-12-14 20:52:45 -05:00
PThorpe92
49f8429cc0 Enable :memory: as default option for cli when no DB provided 2024-12-14 20:52:45 -05:00
PThorpe92
a323db6f46 Add in-memory IO implementation 2024-12-14 20:52:44 -05:00
alpaylan
8e094de6aa fix random character generation 2024-12-14 14:57:32 -05:00
alpaylan
a1b2ab3f54 change names to more descriptive versions, fix the equal row comparison to check the ordering 2024-12-14 14:46:22 -05:00
alpaylan
31fcdb8727 add workload percentage back to the simulator, fix the smaller/larger UTF8 string generator 2024-12-14 14:46:22 -05:00
Alperen Keleş
5284603c6e Merge branch 'tursodatabase:main' into main 2024-12-14 14:46:12 -05:00
jussisaurio
30920d9ddc update compat.md 2024-12-14 21:30:49 +02:00
jussisaurio
cf085bdb98 Merge 'core: update btree.rs' from Ikko Eltociear Ashimine
postion -> position

Closes #473
2024-12-14 21:24:36 +02:00
Ikko Eltociear Ashimine
043fba2632 core: update btree.rs
postion -> position
2024-12-15 03:31:46 +09:00
jussisaurio
987a8bfb5d Run all tcl tests on 2 separate dbs (1. with rowid aliases 2. without rowid aliases) 2024-12-14 17:13:45 +02:00