Pekka Enberg
bda1e4e6ab
Merge 'Add support for json_object function' from Jorge Hermo
...
Relates to #127 . This PR is still in draft and I have a few left things
to do (tests, improve implementation), just opening it so anyone can
track this work meanwhile.
Closes #664
2025-01-20 09:36:56 +02:00
Pekka Enberg
39ceddc7c1
Merge 'bindings/java: Implement JDBC ResultSet' from Kim Seon Woo
...
## Purpose of this PR
Associate jdbc's `ResultSet` with the returned values from limbo's step
function.
## Changes
### Rust
- `Java_org_github_tursodatabase_core_LimboStatement_step` now returns
an object of java's `LimboStepResult.java`
### Java
- Added `LimboStepResult.java` in order to distinguish the type of
`StepResult`(which limbo returns) and to encapsulate the interpretation
of limbo's `StepResult`
- Change `JDBC4ResultSet` inheriting `LimboResultSet` to composition.
IMO when using inheritance, it's too burdensome to fit unmatching parts
together.
- Enhance `JDBC4Statement.java`'s `execute` method
- By looking at the `ResultSet` created after executing the qury, it's
now able to determine the (boolean) result.
## Reference
- https://github.com/tursodatabase/limbo/issues/615
Closes #743
2025-01-20 09:33:33 +02:00
Pekka Enberg
a338a19130
Merge 'Make clippy happy' from Sonny
...
Closes #751
2025-01-20 09:18:19 +02:00
Pekka Enberg
c25d9a1824
Merge 'Implement Not' from Vrishabh
...
This PR adds support for Not operator and Opcode.
Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com >
Closes #748
2025-01-20 09:17:45 +02:00
Pekka Enberg
11551e8ae9
Merge 'Improve changes() and total_changes() functions and add tests' from Ben Li
...
#144
- The previous `changes()` function returns 1 no matter what
- Modified `changes()` and `total_changes()` to be closer to the sqlite
implementation
- Store local `n_change` counter in the `Program` struct
- Update `last_change` and `total_changes` values in `Connection`
struct on halt
- Add `change_cnt_on` flag to `Program` struct that is `true` for
insert and delete (also need later on for update)
- Added TCL tests
Closes #749
2025-01-20 09:16:20 +02:00
Pekka Enberg
02b8fb86b8
github: Fix Nyrkiö action git hash
...
Github actions complains about the following so let's fix it:
Error: Unable to resolve action `nyrkio/github-action-benchmark@ec6fe57`, the
provided ref `ec6fe57` is the shortened version of a commit SHA, which is not
supported. Please use the full commit SHA
`ec6fe57d80fd83c83c10c6ef3f53899ce993aebb` instead.
2025-01-20 08:53:16 +02:00
Pekka Enberg
eeffe10f61
Merge 'Add Nyrkiö change point detection to 'cargo bench' workflow' from Henrik Ingo
...
Closes #750
2025-01-20 08:52:14 +02:00
sonhmai
75f0cf9e20
chore: make clippy happy
2025-01-20 13:29:23 +07:00
Henrik Ingo
ea0b1c3f2a
Needs a speicif git sha if not version
2025-01-20 05:17:22 +02:00
Henrik Ingo
b87b80a422
Remove version from github-action-benchmark. For now.
2025-01-20 05:12:32 +02:00
Henrik Ingo
b2936b0cd6
Add Nyrkiö change point detection to 'cargo bench' workflow
...
This adds a separate push-only.yml workflow. For now pull request
API wasn't integrated yet, so shouldn't run on PRs.
2025-01-20 05:09:10 +02:00
ben594
2ec52d14f1
Update compatibility status
2025-01-19 20:51:16 -05:00
ben594
6c4ee1e905
Update changes on delete
...
Remove unwrap
2025-01-19 20:51:16 -05:00
ben594
a54222d12b
Created basic tcl tests for changes and total_changes
2025-01-19 20:51:16 -05:00
ben594
28ce68091f
Modified changes and total_changes scalarfuncs to be more like sqlite
...
Fmt and clippy
Remove print
2025-01-19 20:51:13 -05:00
psvri
e616bd5361
Implement Not
2025-01-20 00:21:23 +05:30
김선우
ddfbf11659
Fix test
2025-01-19 22:14:17 +09:00
김선우
e8a62b67d2
Disable failing test
2025-01-19 21:56:50 +09:00
김선우
8f9e70417d
Implement executeQuery and executeUpdate
2025-01-19 21:56:50 +09:00
김선우
fb2b5eb11f
Add debugging logs
2025-01-19 21:56:50 +09:00
김선우
f8cc08e5ad
Remove unused method
2025-01-19 21:56:50 +09:00
김선우
24ead40f88
Change LimboStatement.java to throw exception when the result is null which is the error case
2025-01-19 21:56:50 +09:00
김선우
9c3c6271a3
Remove System.out.println
2025-01-19 21:56:50 +09:00
김선우
10a7b1b035
Disable for now
2025-01-19 21:56:50 +09:00
김선우
5fbce67774
Temporarily remove restrictions of running test for 1 second
2025-01-19 21:56:50 +09:00
김선우
f80823a297
Add LimboStepResult.java constructor
2025-01-19 21:56:50 +09:00
김선우
b80438226b
Commit for testing
2025-01-19 21:56:49 +09:00
김선우
9de80e19aa
Fix limbo_statement.rs to handle other StepResults
2025-01-19 21:56:49 +09:00
김선우
647f7124bf
Update test code's while loop to run for max 1 second
2025-01-19 21:56:49 +09:00
김선우
0f46aaa0ec
Update JDBC4Statement.java execute method to return result correctly
2025-01-19 21:56:40 +09:00
김선우
afbf041e2f
Enhance docs
2025-01-19 21:56:40 +09:00
김선우
6967b62bc0
Add invokeFrom field to NativeInvocation.java
2025-01-19 21:56:40 +09:00
김선우
33effdbfd4
Implement JDBC4ResultSEt.java's next() method
2025-01-19 21:56:40 +09:00
김선우
73f8eab651
Remove the tight coupling(using inheritance) between LimboXXX and JDBCXXX and favor composition instead
2025-01-19 21:56:40 +09:00
Pekka Enberg
876788588b
github: Fix Python release workflow
2025-01-19 13:42:00 +02:00
Pekka Enberg
0abb917604
Limbo 0.0.13
2025-01-19 13:30:56 +02:00
Pekka Enberg
466bc8be0c
Merge 'npm packaging for node and web' from Elijah Morgan
...
Add web support to npm package.
**Still a WIP need to do some cleanup still**
I assumed it is better to keep the server code and web code together in
the same package (bigger download number). It took quite a bit of
experimentation but the ultimate experience is
node - commonjs
```js
const { Database } = require("limbo-wasm/node");
```
web - module
```js
const worker = new Worker(new URL('limbo-wasm/web/limbo-worker.js', import.meta.url), { type: 'module' });
```
Like I said this took a lot of experimentation on my part as this is my
first time trying to create an npm package let alone that mixes commonjs
and modules.
The structure is an npm workspace with two sub packages (web and node).
```
node
├── dist
│ ├── README.md
│ ├── index.d.ts
│ ├── index.js
│ ├── index_bg.wasm
│ ├── index_bg.wasm.d.ts
│ └── snippets
│ └── limbo-wasm-d1562e55b90f5289
│ └── node
│ └── src
│ └── vfs.js
├── package.json
└── src
└── vfs.js
web
├── dist
│ ├── README.md
│ ├── index.d.ts
│ ├── index.js
│ ├── index_bg.wasm
│ ├── index_bg.wasm.d.ts
│ └── snippets
│ └── limbo-wasm-d1562e55b90f5289
│ └── web
│ └── src
│ └── web-vfs.js
├── html
│ ├── index.html
│ ├── limbo-opfs-test.html
│ └── limbo-test.html
├── node_modules
├── package.json
├── playwright.config.js
├── src
│ ├── limbo-worker.js
│ ├── opfs-interface.js
│ ├── opfs-sync-proxy.js
│ ├── opfs-worker.js
│ ├── opfs.js
│ └── web-vfs.js
├── test
│ ├── helpers.js
│ ├── limbo.test.js
│ ├── opfs.test.js
│ └── setup.js
└── vite.config.js
```
The output of wasm-pack gets put in <web/node>dist
JS code moves into <web/node>src/
Tests move under web/test
The npm package looks like (you can see I need to cleanup some of the
stuff that gets included).
```
-rw-r--r-- 0 0 0 195 Oct 26 1985 package/web/html/index.html
-rw-r--r-- 0 0 0 2733 Oct 26 1985 package/web/html/limbo-opfs-test.html
-rw-r--r-- 0 0 0 162 Oct 26 1985 package/web/html/limbo-test.html
-rw-r--r-- 0 0 0 632 Oct 26 1985 package/web/test/helpers.js
-rw-r--r-- 0 0 0 18128 Oct 26 1985 package/node/dist/index.js
-rw-r--r-- 0 0 0 21732 Oct 26 1985 package/web/dist/index.js
-rw-r--r-- 0 0 0 1836 Oct 26 1985 package/web/src/limbo-worker.js
-rw-r--r-- 0 0 0 2108 Oct 26 1985 package/web/test/limbo.test.js
-rw-r--r-- 0 0 0 1764 Oct 26 1985 package/web/src/opfs-interface.js
-rw-r--r-- 0 0 0 3409 Oct 26 1985 package/web/src/opfs-sync-proxy.js
-rw-r--r-- 0 0 0 1430 Oct 26 1985 package/web/src/opfs-worker.js
-rw-r--r-- 0 0 0 3976 Oct 26 1985 package/web/src/opfs.js
-rw-r--r-- 0 0 0 4502 Oct 26 1985 package/web/test/opfs.test.js
-rw-r--r-- 0 0 0 269 Oct 26 1985 package/web/playwright.config.js
-rw-r--r-- 0 0 0 0 Oct 26 1985 package/web/test/setup.js
-rw-r--r-- 0 0 0 519 Oct 26 1985 package/node/dist/snippets/limbo-wasm-d1562e55b90f5289/node/src/vfs.js
-rw-r--r-- 0 0 0 519 Oct 26 1985 package/node/src/vfs.js
-rw-r--r-- 0 0 0 608 Oct 26 1985 package/web/vite.config.js
-rw-r--r-- 0 0 0 435 Oct 26 1985 package/web/dist/snippets/limbo-wasm-d1562e55b90f5289/web/src/web-vfs.js
-rw-r--r-- 0 0 0 435 Oct 26 1985 package/web/src/web-vfs.js
-rw-r--r-- 0 0 0 146 Oct 26 1985 package/web/node_modules/.vite/deps/_metadata.json
-rw-r--r-- 0 0 0 309 Oct 26 1985 package/node/package.json
-rw-r--r-- 0 0 0 671 Oct 26 1985 package/package.json
-rw-r--r-- 0 0 0 23 Oct 26 1985 package/web/node_modules/.vite/deps/package.json
-rw-r--r-- 0 0 0 602 Oct 26 1985 package/web/package.json
-rw-r--r-- 0 0 0 153 Oct 26 1985 package/web/node_modules/.vite/vitest/results.json
-rw-r--r-- 0 0 0 1296 Oct 26 1985 package/node/dist/README.md
-rw-r--r-- 0 0 0 1296 Oct 26 1985 package/README.md
-rw-r--r-- 0 0 0 1296 Oct 26 1985 package/web/dist/README.md
-rw-r--r-- 0 0 0 1217 Oct 26 1985 package/node/dist/index_bg.wasm.d.ts
-rw-r--r-- 0 0 0 1217 Oct 26 1985 package/web/dist/index_bg.wasm.d.ts
-rw-r--r-- 0 0 0 449 Oct 26 1985 package/node/dist/index.d.ts
-rw-r--r-- 0 0 0 2554 Oct 26 1985 package/web/dist/index.d.ts
-rw-r--r-- 0 0 0 2215065 Oct 26 1985 package/node/dist/index_bg.wasm
-rw-r--r-- 0 0 0 2213889 Oct 26 1985 package/web/dist/index_bg.wasm
```
resolves #624
Closes #657
2025-01-19 12:53:21 +02:00
Pekka Enberg
ef1e0ae282
Add vanity badges to README.md
2025-01-19 12:44:56 +02:00
Pekka Enberg
246ffec9d0
Update badges in README
2025-01-19 12:36:26 +02:00
Pekka Enberg
f5e5428d45
Merge 'Syntactic improvements' from Jorge López Tello
...
This is a purely syntactic PR. It doesn't change behavior, just rewrites
some loops and removes unneeded parts, like lifetime annotations and
references. Mainly because the Clippy and IDE warnings get annoying.
Don't worry about the number of commits, I just separated based on type
of change.
Closes #732
2025-01-19 12:17:28 +02:00
Pekka Enberg
5851d6643a
Revert "core: Move re-exports at top of lib.rs"
...
This reverts commit c8a979eb4b . It
conflicts with a cleanup PR I am about to merge.
2025-01-19 12:17:06 +02:00
Pekka Enberg
c8a979eb4b
core: Move re-exports at top of lib.rs
...
Clean up the code a bit by moving re-exports at the top of lib.rs to
make them more visible to the reader.
2025-01-19 11:34:59 +02:00
Pekka Enberg
0561ff1545
Merge 'Fix scalar API in extensions, add documentation and error handling' from Preston Thorpe
...
Closes #728
Changes the API to one macro/annotation on the relevant function
```rust
#[scalar(name = "uuid4_str", alias = "gen_random_uuid")]
fn uuid4_str(_args: &[Value]) -> Value {
let uuid = uuid::Uuid::new_v4().to_string();
Value::from_text(uuid)
}
register_extension! {
scalars: { uuid4_str, uuid4 }
}
```
The only downside of this, is that for functions that use their
arguments, because this is not a trait, there is not really a way of
enforcing the function signature like there is with the other way.
Documentation has been added for this in the `scalar` macro, so
hopefully will not be an issue.
Also this PR cleans up the Aggregate API by changing the `args` and
`name` functions to constant associated types, as well as adds some
error handling and documentation.
```rust
impl AggFunc for Median {
type State = Vec<f64>;
const NAME: &'static str = "median";
const ARGS: i32 = 1;
fn step(state: &mut Self::State, args: &[Value]) {
if let Some(val) = args.first().and_then(Value::to_float) {
state.push(val);
}
}
//.. etc
```
Closes #735
2025-01-19 09:53:31 +02:00
Pekka Enberg
3e28541b53
Merge 'Fix null compare operations not giving null' from Vrishabh
...
In limbo when we do any compare operations like `Eq, gt, lt, gte, lte`
with nulls , we were actually giving the result as true where as sqlite3
gives null. This is because if we had a null, we were incorrectly going
to conditional branch and not increment program by 1. Also the sqlite
generates `ZeroOrNull` op in these cases
(https://github.com/sqlite/sqlite/blob/version-3.45.3/src/expr.c#L4644 )
but we were generating a Integer instruction. The below outputs can give
a clearer picture.
This PR aims to fix this.
sqlite3 output
```
SQLite version 3.48.0
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> select 8 = null;
sqlite> select 8 > null;
sqlite> explain select 8 > null;
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 6 0 0
1 Integer 1 1 0 0
2 Gt 3 4 2 64
3 ZeroOrNull 2 1 3 0
4 ResultRow 1 1 0 0
5 Halt 0 0 0 0
6 Integer 8 2 0 0
7 Null 0 3 0 0
8 Goto 0 1 0 0
sqlite> explain select 8 = null;
addr opcode p1 p2 p3 p4 p5 comment
---- ------------- ---- ---- ---- ------------- -- -------------
0 Init 0 6 0 0
1 Integer 1 1 0 0
2 Eq 3 4 2 64
3 ZeroOrNull 2 1 3 0
4 ResultRow 1 1 0 0
5 Halt 0 0 0 0
6 Integer 8 2 0 0
7 Null 0 3 0 0
8 Goto 0 1 0 0
```
Limbo Output
```
Limbo v0.0.12
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> select 8 = null;
1
limbo> select 8 > null;
1
limbo> explain select 8 > null;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 8 0 0 Start at 8
1 Integer 8 2 0 0 r[2]=8
2 Null 0 3 0 0 r[3]=NULL
3 Integer 1 1 0 0 r[1]=1
4 Gt 2 3 6 0 if r[2]>r[3] goto 6
5 Integer 0 1 0 0 r[1]=0
6 ResultRow 1 1 0 0 output=r[1]
7 Halt 0 0 0 0
8 Transaction 0 0 0 0
9 Goto 0 1 0 0
limbo> explain select 8 = null;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 8 0 0 Start at 8
1 Integer 8 2 0 0 r[2]=8
2 Null 0 3 0 0 r[3]=NULL
3 Integer 1 1 0 0 r[1]=1
4 Eq 2 3 6 0 if r[2]==r[3] goto 6
5 Integer 0 1 0 0 r[1]=0
6 ResultRow 1 1 0 0 output=r[1]
7 Halt 0 0 0 0
8 Transaction 0 0 0 0
9 Goto 0 1 0 0
limbo>
```
Limbo Output with this PR
```
Limbo v0.0.12
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database
limbo> select 8 = null;
limbo> select 8 > null;
limbo> explain select 8 > null;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 8 0 0 Start at 8
1 Integer 8 2 0 0 r[2]=8
2 Null 0 3 0 0 r[3]=NULL
3 Integer 1 1 0 0 r[1]=1
4 Gt 2 3 6 0 if r[2]>r[3] goto 6
5 ZeroOrNull 2 1 3 0 ((r[2]=NULL)|(r[3]=NULL)) ? r[1]=NULL : r[1]=0
6 ResultRow 1 1 0 0 output=r[1]
7 Halt 0 0 0 0
8 Transaction 0 0 0 0
9 Goto 0 1 0 0
limbo> explain select 8 = null;
addr opcode p1 p2 p3 p4 p5 comment
---- ----------------- ---- ---- ---- ------------- -- -------
0 Init 0 8 0 0 Start at 8
1 Integer 8 2 0 0 r[2]=8
2 Null 0 3 0 0 r[3]=NULL
3 Integer 1 1 0 0 r[1]=1
4 Eq 2 3 6 0 if r[2]==r[3] goto 6
5 ZeroOrNull 2 1 3 0 ((r[2]=NULL)|(r[3]=NULL)) ? r[1]=NULL : r[1]=0
6 ResultRow 1 1 0 0 output=r[1]
7 Halt 0 0 0 0
8 Transaction 0 0 0 0
9 Goto 0 1 0 0
```
Closes #733
2025-01-19 09:09:12 +02:00
Pekka Enberg
cdcc98540a
cargo fmt
2025-01-19 08:52:01 +02:00
Pekka Enberg
e2efdf724e
Merge 'Fix panics on invalid aggregate function arguments' from Krishna Vishal
...
This pull request fixes panics when there's an aggregate function call
with too few or too many arguments.
Closes #726
2025-01-19 08:51:55 +02:00
Krishna Vishal
5cf78b7d54
chore: clippy remove unused imports
2025-01-19 07:18:31 +05:30
Krishna Vishal
acad562c07
Remove unnecessary Result
2025-01-19 06:50:00 +05:30
Krishna Vishal
870a2ea802
clean up
2025-01-19 06:40:40 +05:30
Krishna Vishal
fa0503f0ce
1. Changes to extension.py
...
2. chore: cargo fmt
2025-01-19 04:58:05 +05:30