Commit Graph

1771 Commits

Author SHA1 Message Date
Jorge López
d4de451d45 core: enable rustix/io_uring with io_uring feature 2025-01-13 20:21:15 +01:00
Pekka Enberg
96148af331 Merge 'Fix 8-bit serial type to encoding' from Preston Thorpe
This PR fixes #666
Limbo was treating all single byte integers properly in `core/types.rs`,
but when converted in `sqlite3_ondisk`, it was losing the sign for 8 bit
integers, treating them all as unsigned. Sqlite3 specifies in their file
format that the `1` record serial type is "Value is an 8-bit twos-
complement integer."  https://www.sqlite.org/fileformat.html
We now properly match sqlite3's output
![image](https://github.com/user-attachments/assets/567960ca-
bfc6-4210-9a0e-ae4203a63add)
![image](https://github.com/user-
attachments/assets/ed4e709b-63ea-4de9-bbdc-a3f8b4dfd0f9)

Closes #667
2025-01-13 20:59:54 +02:00
Pekka Enberg
42293115de Merge 'cli: Introduce a selectable IO backend with --io={syscall,io-uring} argument' from Jorge López Tello
Give the user the option of choosing IO backend. There is only a
"syscall" backend, unless built for Linux with `#[cfg(feature =
"io_uring")]` which introduces `--io=io-uring`.
Right now, the choice has only been implemented for the CLI. Bindings
and such default to PlatformIO, except when an "in-memory" database has
been chosen.
Can be tested by running CLI with RUST_LOG=debug

Reviewed-by: Preston Thorpe <preston@unlockedlabs.org>

Closes #654
2025-01-13 20:59:20 +02:00
PThorpe92
0b6061de2f Adjust sqlite serial type to account for single byte signed integer 2025-01-13 13:34:46 -05:00
Pekka Enberg
481bd17219 Merge 'docs: add python bindings' from Jean Arhancet
Document Python binding setup with Maturin.

Closes #653
2025-01-13 19:06:39 +02:00
Pekka Enberg
44550ab749 cargo fmt 2025-01-13 18:58:40 +02:00
Pekka Enberg
c7ea2393b3 Merge 'Store cursor types in program state and remove trait Cursor' from Jussi Saurio
I was planning on starting work on index insertion, but realized we need
to know whether our cursor refers to a table or an index etc., so it
resulted in this refactoring work.
- `cursor_ref` now contains what _type_ of cursor it is (table, index,
pseudo, sorter)
- `program.cursors` is now `program.btree_table_cursors`,
`program.btree_index_cursors` etc and they are unboxed because dynamic
dispatch is no longer necessary
- Cursor trait removed -- 95% of the shit was btree specific anyway, so
I just moved them to `BTreeCursor`. In certain instructions in the VDBE
we expect a btree cursor and in others we expect a pseudo/sorter etc,
lets make that explicit.
- I also removed `BTreeCursor::get_new_rowid()` specific tests that
required macros to generate a mock implementation of the `Cursor` trait
-- main reason is I couldn't figure out how to reimplement this without
the trait, and the second reason is that I don't think we really need
those tests, AND the proc macro is constantly failing in my editor as
well and screwing up `rust-analyzer`

Closes #655
2025-01-13 18:40:46 +02:00
Pekka Enberg
8769bf82a5 Merge 'fix: flaky test in datetime because compare pre-init now.' from Sonny
Removed flaky test that happens sometimes when the CI runner is a bit
slow e.g. in https://github.com/tursodatabase/limbo/actions/runs/1270626
5753/job/35418879041?pr=643
'now' is covered in other test so it should be fine. it is a problem in
time test, for date not so much.
for example it is covered in:
https://github.com/tursodatabase/limbo/blob/bcc85c37a0febdf5c3f29127029f
e10c9906867d/core/vdbe/datetime.rs#L1434C5-L1446C6

Closes #652
2025-01-13 18:39:54 +02:00
Pekka Enberg
fa6a9ed214 Merge 'bindings/java: Fix naming rules' from Kim Seon Woo
## Purpose of this PR
- Set rules for java naming, maybe we can add tests to  automatically
test rules in the future
- For java methods, don't use underbar(IMO using camelcase for java
methods seems to be the common convention)
- If method names collide, append 0 at the back
## Reference
https://github.com/tursodatabase/limbo/issues/615

Closes #645
2025-01-13 18:39:24 +02:00
Pekka Enberg
9d42a48105 Merge 'Implement json_error_position' from Peter Sooley
Furthering work for JSON compatibility as described in #127, this change
adds support for the `json_error_position` function used to find the
error in invalid JSON values.
![image](https://github.com/user-attachments/assets/d61403ef-
bccf-41b0-9128-199066608fac)

Closes #564
2025-01-13 18:21:55 +02:00
Pekka Enberg
1e94dbffcc Merge branch 'main' into json-error-position 2025-01-13 18:21:37 +02:00
JeanArhancet
94ff7ac48c docs: add instructions for creating and using a Python virtual environment 2025-01-12 18:44:58 +01:00
Jorge López Tello
7365bee984 Merge branch 'tursodatabase:main' into selectable-io-backend 2025-01-12 15:11:54 +01:00
Jorge López
aca38031a4 cli: pass Io without option to get_io(), since even when running in-memory we get a default Io from Clap. Also remove last pesky Io::clone() 2025-01-11 22:44:56 +01:00
Jorge López
486389d6ff cli: remove calls to Io::clone() as it is now Copy 2025-01-11 21:54:41 +01:00
Jorge López
b630414722 cli: implement Copy for DbLocation and Io, as suggested by [Preston](https://github.com/PThorpe92) 2025-01-11 21:50:09 +01:00
Jussi Saurio
0dceb02ec0 Merge pull request #650 from tursodatabase/use-more-expect-arguments-exact
expr: add expect_arguments_min!() and use expect_arguments_* macros more universally
2025-01-11 17:43:38 +02:00
Jussi Saurio
92888c54e9 remove get_new_rowid() specific tests that require mocking 2025-01-11 17:41:10 +02:00
Jussi Saurio
bf48c0ae72 Remove trait Cursor 2025-01-11 17:19:25 +02:00
Jorge López
5a45df84db core: add debug line when an IO backend is created. A user can check that the correct one has been selected. 2025-01-11 16:08:41 +01:00
Jussi Saurio
9f44d2a7ac Remove unused Table::Index variant and unused Table methods 2025-01-11 17:07:30 +02:00
Jussi Saurio
9909539b9d Store cursor type (table,index,pseudo,sorter) when allocating cursor 2025-01-11 17:04:16 +02:00
Jorge López
2596e0800e core: expose UnixIO apart from PlatformIO on any Unix, and expose UringIO on Linux with feature io_uring.
cli: add a new argument to select I/O backend (more than one option only for Linux with io_uring feature).

cli: make both Limbo::new() and Limbo::open_db() use get_io(), unifying parsing of database path and eliminating duplicated code.
2025-01-11 15:21:26 +01:00
Jorge López
a17464ca5c cli: Add io_uring feature to match core 2025-01-11 15:03:26 +01:00
Jorge López
e5bd39a8b2 Tiny formatting change, because RustRover keeps redoing it. Having to revert on every commit is not fun. 2025-01-11 15:03:26 +01:00
JeanArhancet
ecf7f00cd8 docs: add python bindings 2025-01-11 14:24:20 +01:00
Jussi Saurio
3e2993f5f5 Merge pull request #626 from psvri/fix_csv_quote_import
Fix import csv failing when file contains single quote
2025-01-11 13:26:45 +02:00
Jussi Saurio
81332c6dc5 Merge pull request #651 from sonhmai/chore/fix-url
chore: update repository link in Cargo.toml
2025-01-11 13:25:22 +02:00
sonhmai
46eba6cc77 fix: flaky test in datetime because compare pre-init now.
'now' is covered in other test so it should be fine.
2025-01-11 16:15:58 +07:00
sonhmai
d5eb41a0e5 chore: update repository link in Cargo.toml 2025-01-11 15:30:54 +07:00
psvri
ce8600a695 Fix import csv failing when single quote is in string 2025-01-11 13:48:21 +05:30
Jussi Saurio
e782f30ffe Add expect_arguments_min!() and use expect_arguments_* macros more universally 2025-01-11 09:55:07 +02:00
Jussi Saurio
bcc85c37a0 Merge 'Implement -> and ->> operators for json' from Kacper Madej
Implements the `->` and `->>` operators. Also fixes a few
inconsistencies between sqlite and limbo for `json_extract` function.
Those three functions are similar, yet return slightly different data
types.

Closes #636
2025-01-11 09:42:16 +02:00
Peter Sooley
b5fed15997 implement json_error_position 2025-01-10 11:12:30 -08:00
Kacper Madej
002d2e3dde Uncomment failing tests 2025-01-10 19:26:39 +07:00
Kacper Madej
7efa87ff31 Merge branch 'main' into right-arrow-json 2025-01-10 19:25:56 +07:00
Pekka Enberg
3bc86a3cfc Merge 'Add CI for java testing' from Kim Seon Woo
## Purpose of the PR
- Add CI for java testing
## Reference
https://github.com/tursodatabase/limbo/issues/615

Closes #643
2025-01-10 13:05:05 +02:00
김선우
84c987d42b Fix naming rules
- No underscore for java
- When method names are the same, append 0 at the back
2025-01-10 19:23:38 +09:00
김선우
071d9513ab Add CI for java testing 2025-01-10 19:13:52 +09:00
Pekka Enberg
d31ccf2933 Merge 'core/optimizer: do expression rewriting on all expressions' from Jussi Saurio
Fixes #640 , unblocks some tests in #636

Closes #641
2025-01-10 11:23:51 +02:00
Pekka Enberg
93e4b8d917 Merge 'bindings/java: Enhance exception handling logic' from Kim Seon Woo
### Purpose of this PR
- Enhance exception handling logic
  - When exceptions has to be thrown from Rust to Java, let's just
return the error message directly.
  - Removes JNI call to get error message using
`Java_org_github_tursodatabase_core_LimboDB_getErrorMessageUtf8`
- Add `throwJavaException` to assure that the exception throwing logic
works corretly

Closes #642
2025-01-10 11:22:08 +02:00
김선우
90258a44b4 Add throwJavaException 2025-01-10 17:47:27 +09:00
Jussi Saurio
1bcdf99eab core/optimizer: do expression rewriting on all expressions 2025-01-10 10:04:07 +02:00
Kacper Madej
1a46988a73 Fix hardcoded numbers in macros 2025-01-10 14:50:38 +07:00
Kacper Madej
1a85601261 Update docs 2025-01-10 13:41:47 +07:00
Kacper Madej
a2e1ef2439 Use newest SQLite on Github Actions 2025-01-10 13:31:38 +07:00
김선우
3e26e7ebc5 Remove newSQLException and add throwLimboException in the LimboDB.java 2025-01-10 14:58:35 +09:00
Kacper Madej
536fbe9d9e Fix imports 2025-01-10 12:24:08 +07:00
Kacper Madej
91d4ac3ac0 Fix expression chaining 2025-01-10 12:14:57 +07:00
Kacper Madej
0f4e5ad26d Implement simplified json path 2025-01-10 11:50:43 +07:00