Commit Graph

744 Commits

Author SHA1 Message Date
김선우
28bd0275c0 Run cargo fmt, clippy 2024-08-15 18:56:02 +09:00
김선우
aff13de125 Nit 2024-08-15 18:50:40 +09:00
김선우
dc48c2e71d Add substring scala function with 2 arg 2024-08-15 18:47:32 +09:00
김선우
3fa3c5c002 Add substr scala function 2024-08-15 18:27:18 +09:00
Pekka Enberg
08c1e13679 Merge 'Handle count(*)' from Vegard Stikbakke
This PR adds support for `count(*)`. I did not find any other functions than `count` which expect a `*` argument yet, but I'm sure there are some?

Surprisingly (to me) I did not need to make any changes to `translate_expr`, only to `analyze_expr`.

```
limbo> SELECT count(id) FROM users;
2
limbo> SELECT count(*) FROM users;
2
limbo> SELECT count(*) FROM users where id = 1;
1
limbo> SELECT count(id) FROM users where id = 1;
1
```

Other aggregation functions such as sum fail, since they expect a specific column:
```
limbo> select sum(*) from users;
Parse error: sum bad number of arguments
```

Closes #285
2024-08-11 16:57:18 +03:00
Vegard Stikbakke
e54fd83f49 Handle FunctionCallStar in analyze_expr 2024-08-11 13:59:49 +02:00
Pekka Enberg
f75b43f28e Merge 'Add to sqlite3 static lib to cargo dist bundle' from Pekka Enberg
Closes #222
2024-08-11 12:22:28 +03:00
Pekka Enberg
f633fc91cf sqlite3: Add to cargo dist bundle 2024-08-11 12:14:43 +03:00
Pekka Enberg
3f96b1d798 Merge 'Initial pass on Python API' from Jean Arhancet
This pull request introduces the initial setup for the Python bindings
(#248).

- Setup Configuration: Added the Python binding stack, including the
  `pyo3 `crates, `pyproject.toml`, `build.rs`, and other necessary
  files.

- Database Class: Implemented the Database class with a constructor to
  establish a connection and a query function to execute SQL queries.

- Testing: Created `database.db` with a sample users table and two
  entries, as outlined in README.md, and added three pytest functions to
  validate the Python output.

Closes #276
2024-08-11 12:09:27 +03:00
JeanArhancet
7c362b129f feat: impl python binding
refactor: pep-0249

refactor: rust comment and requirements-dev.txt

fix: name conflict
2024-08-11 08:58:18 +02:00
Pekka Enberg
fc1f61acf9 Merge 'Use limbo instead of cargo run in command in README' from Vegard Stikbakke
Use `limbo` instead of `cargo run` in the example command in the README
since we've already installed the program and have it on our path.

Closes #284
2024-08-10 21:34:20 +03:00
Vegard Stikbakke
16f1e9c40b Use limbo instead of cargo run in command in README
Use `limbo` instead of `cargo run` in the example command in the README since we've already installed the program and have it on our path.
2024-08-10 20:24:02 +02:00
Pekka Enberg
5083ba8ae9 Merge 'Update cbindgen dependency' from Pekka Enberg
Fixes #63

Closes #282
2024-08-10 14:53:07 +03:00
Pekka Enberg
5219fc7258 Update cbindgen dependency
Fixes #63
2024-08-10 14:29:20 +03:00
Pekka Enberg
896651229a Merge 'github: Cache Rust build dependencies' from Pekka Enberg
Let's use a Github action to cache build dependencies in hopes to reduce
disk utilization.

Closes #280
2024-08-10 08:40:49 +03:00
Pekka Enberg
f3fc55eb8d github: Cache Rust build dependencies
Let's use a Github action to cache build dependencies in hopes to reduce
disk utilization.
2024-08-10 08:34:11 +03:00
Pekka Enberg
6b78573f79 Merge 'Implement NewRowid' from GV
Fixes https://github.com/penberg/limbo/issues/275

Closes #278
2024-08-09 21:18:10 +03:00
gandeevanr
23a7d389b1 added unit tests for NewRowid 2024-08-08 19:04:10 -07:00
gandeevanr
a9cb8157b5 initial pass at implementing NewRowId 2024-08-07 09:04:09 -07:00
Pekka Enberg
0cb45d4ebb Merge 'core: add datetime modifiers helpers.' from Sonny
Adding the foundational helpers for integrating with supporting datetime Functions modifiers later.
part of https://github.com/penberg/limbo/issues/158.

Integrating with date time functions in `vdbe` `Program.step` will come in other PRs later.
reference to sqlite eaa560f3fc/src/date.c (L723)

Closes #277
2024-08-07 16:20:53 +03:00
sonhmai
c104e50a66 core: add datetime modifiers helpers.
Building the helpers for integrating with supporting datetime Functions modifiers later.
2024-08-07 13:43:51 +07:00
Pekka Enberg
d4d7042373 Merge 'Use the correct integer PK column idx as the row-id alias' from GV
This pull request addresses [issue #256](https://github.com/penberg/limbo/issues/256).

However, it currently breaks insertions into tables that lack a row-id
alias due to the NewRowId not being implemented yet. I have created an
[issue](https://github.com/penberg/limbo/issues/275) to track this
problem and will submit a separate pull request to resolve it soon.

Closes #274
2024-08-06 08:11:10 +03:00
Pekka Enberg
7b06150df6 Update CHANGELOG.md and COMPAT.md 2024-08-06 08:06:43 +03:00
Pekka Enberg
5b7d112e74 Merge 'implementation of json function json(X)' from Jean Arhancet
Add the `json` function `json(X)` (related to the issue https://github.com/penberg/limbo/issues/127)

Closes #230
2024-08-06 08:05:33 +03:00
JeanArhancet
15ab7955d3 add licences 2024-08-05 21:34:30 +02:00
gandeevanr
2b86f89d8d use the correct integer PK column idx as the row-id alias 2024-08-04 18:53:54 -07:00
JeanArhancet
4050a3ebe2 refactor: impl json5 direclty 2024-08-04 12:47:08 +02:00
JeanArhancet
4d0a25c1b4 test: add json tcl test 2024-08-04 10:56:52 +02:00
JeanArhancet
8dbced6a39 refactor: delete Insn Json 2024-08-04 10:56:51 +02:00
JeanArhancet
552090cb29 feat: add json support 2024-08-04 10:54:27 +02:00
Pekka Enberg
a765828206 Merge 'First pass on WebAssembly I/O' from Pekka Enberg
Just some basic plumbing to call Node filesystem API from Rust.

Closes #270
2024-08-04 11:45:19 +03:00
Pekka Enberg
933bf89bb9 wasm: VFS interface to use Node filesystem API
This adds a basic VFS interface to use Node filesystem API from Rust
code. Not a lot, but parses the SQLite database file header and
completes database open without errors.
2024-08-04 11:12:21 +03:00
Pekka Enberg
7df979cd3a wasm: Enable console.error() panic hook
Makes debugging a little bit easier...
2024-08-04 09:45:27 +03:00
Pekka Enberg
e5034acb9e Merge 'fix: ctrl-c stop current query execution' from Jean Arhancet
Fix #260 by ensuring `Ctrl-C` interrupts the query without terminating
the process. Implement the SQLite strategy where pressing `Ctrl-C` twice
exits the shell.

Closes #269
2024-08-04 08:13:39 +03:00
JeanArhancet
38a1b85094 fix: ctrl-c stop current query execution 2024-08-03 22:58:52 +02:00
Pekka Enberg
31308f3699 core: Switch SQLite to use locking_mode EXCLUSIVE
Let's switch the SQLite benchmarks to use similar file locking protocol
as we do. Improves SQLite's performance by 2x, but Limbo is still
faster.

Before:

rusqlite/Prepare statement: 'SELECT * FROM users LIMIT 1'
                        time:   [2.1027 µs 2.1239 µs 2.1563 µs]
                        thrpt:  [463.75 Kelem/s 470.83 Kelem/s 475.57 Kelem/s]

After:

rusqlite/Execute prepared statement: 'SELECT * FROM users LIMIT 1'
                        time:   [940.07 ns 944.16 ns 949.39 ns]
                        thrpt:  [1.0533 Melem/s 1.0591 Melem/s 1.0638 Melem/s]
2024-08-03 21:13:50 +03:00
Pekka Enberg
89079d1ccd Merge 'core: fix clippy' from Sonny
Closes #268
2024-08-03 17:53:51 +03:00
sonhmai
0e7bd95e4e core: fix clippy 2024-08-03 20:14:26 +07:00
Pekka Enberg
e890a1d64f Merge 'More WAL work' from Pekka Enberg
Turn the WAL into a trait and open + parse WAL header.

Closes #267
2024-08-03 14:10:36 +03:00
Pekka Enberg
a290b2f102 core: Open WAL file and parse header 2024-08-03 12:48:16 +03:00
Pekka Enberg
ed4116e7c2 core: Introduce Wal trait
We're going to need it for WebAssembly anyway, which does not have
standard filesystem support.
2024-08-03 12:34:10 +03:00
Pekka Enberg
d9b1cac27b testing: Add test database + WAL file 2024-08-03 12:16:34 +03:00
Pekka Enberg
7937c165fe Merge 'Storage layer cleanups' from Pekka Enberg
Closes #265
2024-08-03 11:00:33 +03:00
Pekka Enberg
18883b5a7e core: Document top-level storage module 2024-08-03 10:44:19 +03:00
Pekka Enberg
090a577dd5 core: Move DatabaseStorage to storage/database.rs 2024-08-03 10:41:10 +03:00
Pekka Enberg
83650a797a core: Document DatabaseStorage purpose 2024-08-03 10:37:41 +03:00
Pekka Enberg
3f7c788e5b core: Rename DatabaseStorage methods
Let's call them read_page() and write_page().
2024-08-03 10:35:14 +03:00
Pekka Enberg
8a54e31803 core: Rename PageIO to DatabaseStorage 2024-08-03 10:33:52 +03:00
Pekka Enberg
4349b946e5 core: Eliminate PageSource wrapper
The PageSource wrapper is useless. Let's inline it and use PageIO
directly.
2024-08-03 10:27:20 +03:00
Pekka Enberg
90308defb2 Merge 'Fix serial type decoding for BLOB and TEXT' from Lauri Virtanen
Replace `>` with `>=` to match the [SQLite documentation](https://www.sqlite.org/fileformat.html#record_format).

Serial type value `12` is for 0-size BLOB, and `13` is for 0-size TEXT.

Closes #264
2024-08-02 22:25:10 +03:00