Commit Graph

2225 Commits

Author SHA1 Message Date
김선우
79da888c45 Fix labeler.yml 2025-01-30 07:38:58 +09:00
Pekka Enberg
f086c1b32f Update COMPAT.md 2025-01-29 19:57:04 +02:00
Pekka Enberg
06edf33878 Merge 'json_patch() function implementation' from Ihor Andrianov
First review #820
The function follows RFC 7386 JSON Merge Patch semantics:
* If the patch is null, the target is replaced with null
* If the patch contains a scalar value, the target is replaced with that
value
* If both target and patch are objects, the patch is recursively applied
* null values in the patch result in property removal from the target

Closes #821
2025-01-29 19:54:12 +02:00
Pekka Enberg
db72756d2a Merge 'Changes to json serialization/deserialization' from Ihor Andrianov
Change JSON deserialization to enable json_patch implementation with
SQLite-compatible behavior:
* Preserves duplicate keys in JSON objects
* Applies patches only to the first occurrence of each key
* Trade-off: Changes key lookup from O(1) to O(n) to support duplicate
keys
* Have to be merged before json_patch() function

Closes #820
2025-01-29 19:53:41 +02:00
Pekka Enberg
ffb692b4a1 github: Configure a single Github actions token 2025-01-29 19:49:39 +02:00
Pekka Enberg
4af6eb2f71 Merge 'Refactor Json serialization to accommodate formatters for pretty printing' from Pedro Muniz
Json serialization logic was pulled from serde_json. Google's json5
serialization code was not flexible enough to allow for pretty printing
json, so I believe that the formatter design is a good layer to abstract
this logic. This refactor will trivially enable the implementation of
json_pretty function from sqlite. My other PR for json_quote, #763,
depends a tiny bit on a helper utility from the previous serialization
implementation. If this PR is considered first, I will change the code
in my other PR to account for this.

Reviewed-by: Diego Reis (@diegoreis42)
Reviewed-by: Kacper Madej (@madejejej)

Closes #771
2025-01-29 19:03:14 +02:00
Ihor Andrianov
0048f77b45 add unit tests 2025-01-29 18:05:41 +02:00
Ihor Andrianov
4e7c4e7ced fixes to pass tests 2025-01-29 18:05:41 +02:00
Ihor Andrianov
166d0a7165 add more tests and fixed test for latest sqlite v 2025-01-29 18:05:41 +02:00
Ihor Andrianov
0714ab64af add tests for tricky edge cases 2025-01-29 18:05:40 +02:00
Ihor Andrianov
2407a29e90 refactored into patcher struct and made code more modular and readable 2025-01-29 18:05:40 +02:00
Ihor Andrianov
f164dbdb1e fix case where first patched value applied wins 2025-01-29 18:05:40 +02:00
Ihor Andrianov
8ba43bfc17 add tests for duplicate preservation and first-one-win behavior 2025-01-29 18:05:40 +02:00
Ihor Andrianov
6a605939e6 naming refine 2025-01-29 18:05:39 +02:00
Ihor Andrianov
3f7458faef add general tests 2025-01-29 18:05:39 +02:00
Ihor Andrianov
846a73188a add json_patch implementation 2025-01-29 18:05:39 +02:00
Ihor Andrianov
98be735f5a add json_patch to expr and vm 2025-01-29 18:05:39 +02:00
Ihor Andrianov
70396d7425 add function definition 2025-01-29 18:05:38 +02:00
Ihor Andrianov
5c55615896 add Removed enum type to discard removed fields on parsing stage 2025-01-29 17:59:48 +02:00
Ihor Andrianov
f97d085934 add deserialization patch to represent obj as ordered Vec and preserve duplicates 2025-01-29 17:59:48 +02:00
Pekka Enberg
489e3242c9 Merge 'Add github workflow labeler to automatically add labels ' from Kim Seon Woo
## Purpose of this PR
- Automatically add labels to PRs for easy classification
- We can add useful rules as needed
## Changes
- Add 2 files to configure labeler
- For now, changes under certain directory will add labels
## ETC
- workflow repo: https://github.com/marketplace/actions/labeler

Closes #817
2025-01-29 17:14:36 +02:00
김선우
4e4d7b2805 Add labeler 2025-01-29 20:50:00 +09:00
Pekka Enberg
e47240705c Merge 'bindings/go: Progress on Go driver, first working incremental state' from Preston Thorpe
This PR brings the Go database/sql driver to it's first working state
and adds a Go package to demonstrate.
The example pkg demonstrates (in it's most bare/naive form at this
point):
1. Open database (memory, in this case)
2. Create connection
3. Prepare statement (Create table)
4. `Exec`
5. Prepare statement (Insert, bind 3 arguments (int, string, blob) (
6. `Exec`
7. Prepare statement (Select *)
8. `Columns` -> print columns
9. `Query` -> print rows
10. Close db connection
![image](https://github.com/user-
attachments/assets/b59ec9f5-9ac6-4a59-9cad-fbb57893fbf8)
still tons of work to do but I at least wanted to get it to a state
where it's not totally broken.
I'll add some actual tests tomorrow

Closes #796
2025-01-29 13:10:52 +02:00
Pekka Enberg
aec7f1ddd2 Merge 'bindings/java: Implement methods in JDBC4ResultSet' from Kim Seon Woo
## Purpose of this PR
- Implement `JDBC4ResultSet`'s `getXXX(columnIndex)` methods
## Changes
- `JDBC4ResultSet`'s `getXXX(columnIndex)` methods are implemented
- Add some docs for clarification(+ leaving history)
## Reference
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #813
2025-01-29 09:45:26 +02:00
Pekka Enberg
cfc585813b Merge 'implement sqlite_source_id function' from Glauber Costa
Closes #811
2025-01-29 09:45:00 +02:00
Pekka Enberg
53cb1ffe38 Merge 'update COMPAT matrix for journal_mod pragma' from Glauber Costa
it seems like it is supported now

Closes #809
2025-01-29 09:44:28 +02:00
Pekka Enberg
99c532bd7c Merge 'bindings/go: Avoid potentially expensive operations on prepare' from Glauber Costa
This simple patch makes sure we can operate with a reference to the
string instead of being forced to transform it to a string, and makes
sure that the Arc doesn't have to be cloned (which can be expensive in
multi-core systems).
This doesn't really make a large difference in benchmarks, given how
expensive Parse::new() is.

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #808
2025-01-29 09:43:54 +02:00
Pekka Enberg
dfbd1ae44d Merge 'Add quickcheck property tests for vector extension' from Jussi Saurio
Cursor helped me use the `quickcheck` APIs and also taught me things
about vectors, hope it didn't lie to me

Closes #806
2025-01-29 09:43:18 +02:00
Pekka Enberg
277f0e75cd Merge 'Initial pass on vector extension' from Pekka Enberg
This pull requests adds some libSQL vector extension functions such as
`vector()` and `vector_distance_cos()`, which can be used for exact
nearest neighbor search as follows:
```
limbo> SELECT embedding, vector_distance_cos(embedding, '[9, 9, 9]')
   ...> FROM movies ORDER BY vector_distance_cos(embedding, '[9, 9, 9]');
[4, 5, 6]|0.013072490692138672
[1, 2, 3]|0.07417994737625122
```
Note that libSQL also support approximate nearest neighbour search with
DiskANN indexing, which is something we eventually want to port to Limbo
as well.

Closes #798
2025-01-29 09:43:04 +02:00
김선우
9fd2c67b4d Add tests for out of bound access to arrays 2025-01-29 12:04:07 +09:00
김선우
7fe5ba84c7 Fix test that uses wrong data types 2025-01-29 11:59:42 +09:00
김선우
3649e8f67c Add test to verify behavior on null columns 2025-01-29 11:56:49 +09:00
김선우
041c8fbddc Fix executeQuery to not run statement.execute() 2025-01-29 11:53:44 +09:00
김선우
2e62abe6df Implement basic getXX methods for JDBC4ResultSet 2025-01-29 11:41:56 +09:00
Glauber Costa
8f24d18ad8 implement sqlite_source_id function 2025-01-28 14:55:38 -05:00
Glauber Costa
cd58d6c37e update COMPAT matrix for journal_mod pragma
it seems like it is supported now
2025-01-28 14:04:23 -05:00
Glauber Costa
bf1cfe3a1d avoid potentially expensive operations on prepare, query, execute
This simple patch makes sure we can operate with a reference to the
string instead of being forced to transform it to a string, and makes
sure that the Arc doesn't have to be cloned (which can be expensive in
multi-core systems).

This doesn't really make a large difference in benchmarks, given how
expensive Parse::new() is.
2025-01-28 13:44:34 -05:00
PThorpe92
bf6b80edab Continue progress go database/sql driver, add tests and CI 2025-01-28 11:24:57 -05:00
Jussi Saurio
c950b177aa Add test for property: vector -> text -> vector produces an equal vector 2025-01-28 16:09:48 +02:00
Jussi Saurio
e01555467f Add quickcheck property tests for vector extension 2025-01-28 15:53:11 +02:00
Pekka Enberg
ac188808b6 Update README.md 2025-01-28 14:37:50 +02:00
Pekka Enberg
a9d2ef3878 Update COMPAT.md 2025-01-28 14:26:09 +02:00
Pekka Enberg
b9c89e79c2 testing: Add few TCL tests for vector extensions 2025-01-28 14:24:09 +02:00
Pekka Enberg
ee05ad172b core: Bundle vector extension by default 2025-01-28 14:24:09 +02:00
Pekka Enberg
9462426685 Vector extension functions
This patch adds some libSQL vector extension functions such as
`vector()` and `vector_distance_cos()`, which can be used for exact
nearest neighbor search as follows:

```
limbo> SELECT embedding, vector_distance_cos(embedding, '[9, 9, 9]')
   ...> FROM movies ORDER BY vector_distance_cos(embedding, '[9, 9, 9]');
[4, 5, 6]|0.013072490692138672
[1, 2, 3]|0.07417994737625122
```
2025-01-28 14:24:09 +02:00
Pekka Enberg
0eedea0bdb Merge 'Fix panic when double quoted strings are used for column names.' from Krishna Vishal
Now:
```sql
limbo> create table t (a,b,c); insert into t (a,b,c) values ("hello", 234, 432);
thread 'main' panicked at core/translate/expr.rs:1621:29:
internal error: entered unreachable code: Id should be resolved to a Column before translation
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
After fix:
```sql
limbo> create table t (a,b,c); insert into t (a,b,c) values ("hello", 234, 432);

  × Parse error: no such column: "hello" - should this be a string literal in single-quotes?

limbo>
```
Closes #800

Reviewed-by: Diego Reis (@diegoreis42)
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #801
2025-01-28 14:20:58 +02:00
Pekka Enberg
d164ad1035 Merge 'Improve docs' from Sonny
Improving docs
1. adding journaling modes in compat
2. reformat the tables in compat
3. adding ref resources for DST

Closes #804
2025-01-28 14:19:18 +02:00
Pekka Enberg
3baca19f75 Merge 'bindings/java: Implement close() for LimboStatement and LimboResultSet ' from Kim Seon Woo
## Purpose of this PR
- Implement `close()` method for `LimboStatement`(+`JDBC4Statement`) and
`LimboResultSet`(+ `JDBC4ResultSet`)
## Changes
- Add `consumeAll` method in `LimboResultSet`
- Implement `close()` methods
  - Because  `JDBC4Statement` has longer lifecycle in compared to
`LimboStatement`, we manage different `close` fields(`LimboStatement` is
created when first `execute` method is called on `JDBC4Statemenet`)
## Reference
- [Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #799
2025-01-28 14:18:01 +02:00
Pekka Enberg
810ad77951 Merge 'bindings/java: Add README.md for bindings/java' from Kim Seon Woo
## Purpose of thie PR
- Add README.md for bindings/java
## Reference
- https://github.com/tursodatabase/limbo/issues/615

Closes #802
2025-01-28 14:17:47 +02:00
sonhmai
f59379e0c9 fix wrong replacement in compat 2025-01-28 11:35:49 +07:00