Commit Graph

2694 Commits

Author SHA1 Message Date
Pekka Enberg
808ae4e7bf Merge 'simulator: add more properties and make the generated queries more complex' from Alperen Keleş
We have been working with a very small subset of SQL so far. As a rather
lightweight next phase, I propose that we make the generated queries
more realistic, slowly converging into the type definitions in
`limbo/core`. This PR will gradually implement such advances, the first
commit demonstrates how `LIMIT` is added to `SELECT`.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #793
2025-02-07 13:40:23 +02:00
Pekka Enberg
8c0c967ea2 Merge 'Implement json_quote' from Pedro Muniz
Hi! This is my first PR on the project, so I apologize if I did not
follow a convention from the project.
#127
This PR implements json_quote as specified in their source:
https://www.sqlite.org/json1.html#jquote. It follows the internal doc
guidelines for implementing functions. Most tests were added from sqlite
test suite for json_quote, while some others were added by me. Sqlite
test suite for json_quote depends on json_valid to test for correct
escape control characters, so that specific test at the moment cannot be
done the same way.

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>
Reviewed-by: Sonny (@sonhmai)

Closes #763
2025-02-07 13:33:05 +02:00
Pekka Enberg
400dd6dd42 Merge 'bindings/java: Implement custom logger ' from Kim Seon Woo
## Purpose of the PR
- As bindings/java is just a library, we shouldn't have to add specific
library dependency(such as slf4j) to itself
- In order to load bindings/java to 3rd party software(such as
Datagrip), we shouldn't provide a library with slf4j included
## Changes
- Remove slf4j, logback dependency and files
- Add custom logger implementation
## ETC
We can now connect to Datagrip(but there are some errors though)
![image](https://github.com/user-
attachments/assets/ec8becf1-b9a8-415a-8943-74edee9b29c3)
## Reference
[Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #915
2025-02-07 12:37:56 +02:00
Pekka Enberg
0841ed2bdb Merge 'bindings/java: Implement basic functionality of PreparedStatement ' from Kim Seon Woo
## Purpose of this PR
- Implement basic functionality of `PreparedStatement`
  - `connection.prepareStatement(...)`
  - `setNull`, `setBoolean`, `setInt`, `setDouble` ...
## Changes
- Add binding functions in rust side
- Implement `JDBC4Connection`'s `prepareStatement(sql)`
- Implement basic methods of `JDBC4PreparedStatement`
## TODO
- We can improve the performance of batching the binding operations(and
not execute immediately). For example, we can defer calling limbo's
`bind_at` when query is actually executed.
## Reference
[Issue](https://github.com/tursodatabase/limbo/issues/615)

Closes #913
2025-02-07 12:37:25 +02:00
Pekka Enberg
7169706809 Merge 'Add support for delete row' from Krishna Vishal
**Core delete tasks**:
- [x] Implement free page functionality
- [x] Clear overflow pages if any before deleting their cells using free
page.
- [x] Implement delete for leaf page
- [ ] Balance after delete properly
**Auxiliary tasks to make delete work properly**:
- [x] Implement block coalescing in `free_cell_range` to reduce
fragmentation.
- [x] Track page fragmentation in `free_cell_range`.
- [x] Update page offsets in `drop_cell` and update cell pointer array
after dropping a cell.
- [x] Add TCL tasks
Closes #455
--------
I will add support for balancing after delete once `balance_nonroot` is
extended. In the current state of `balance_nonroot` balancing won't work
after delete and corrupts page.
But delete itself is functional now.

Closes #785
2025-02-07 12:36:23 +02:00
Pekka Enberg
da3981d99c Update README.md 2025-02-07 10:55:46 +02:00
Jussi Saurio
b37745ec14 Merge 'Add quickcheck tests for generate_series() and refine implementation' from Jussi Saurio
Adds `quickcheck` property based tests to the recently merged
`generate_series` implementation and fixes various issues in it:
- `0` for `step` should be treated as `1`
- missing `step` should be treated as `1`
- a string like `a` for `step` should be treated as `1`
- saturating overflow
- return an empty series for a variety of invalid inputs, instead of
erroring
For the future:
We should have e2e/fuzz tests comparing sqlite implementation to limbo
implementation

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #910
2025-02-07 10:40:25 +02:00
Jussi Saurio
49e08c43b7 remove invalid comments 2025-02-07 10:11:31 +02:00
Jussi Saurio
cb9d929eab call cursor methods instead of duplicating logic 2025-02-07 10:09:42 +02:00
Pekka Enberg
7809df913a core/mvcc: Rename Database to MvStore 2025-02-07 07:40:33 +02:00
김선우
cd8f580f54 Nit 2025-02-07 13:50:00 +09:00
김선우
edc964a2cb Implement logger 2025-02-07 13:49:07 +09:00
김선우
f88daf2803 Fix lint 2025-02-07 12:44:24 +09:00
김선우
eeb457f7a1 Implement basic functionality of JDBC4PreparedStatement 2025-02-07 12:33:13 +09:00
pedrocarlo
c3cad5dfdd corrected to use newly created as_str function to convert to string slice 2025-02-07 00:07:51 -03:00
pedrocarlo
8fe71309c0 cargo fmt 2025-02-06 23:46:00 -03:00
pedrocarlo
c8bb1fd353 unreachable to agg and record types, as it should not be possible to pass them to json_quote 2025-02-06 23:43:30 -03:00
김선우
f5c4f4e8a1 Implement JDBC4Connection#prepareStatement 2025-02-07 11:42:36 +09:00
pedrocarlo
b678375c69 increasing string capacity to reduce allocations 2025-02-06 23:37:30 -03:00
pedrocarlo
90ecaf40b5 removed unnecessary string allocations for escaped json value 2025-02-06 23:37:30 -03:00
pedrocarlo
eb40505c31 some tests in sqlite rely on commands not implemented in limbo yet 2025-02-06 23:36:02 -03:00
pedrocarlo
26388cc802 fix: cargo fmt 2025-02-06 23:36:02 -03:00
pedrocarlo
782a18d4bd modify COMPAT.md 2025-02-06 23:36:02 -03:00
pedrocarlo
303a687e65 rebase to main 2025-02-06 23:35:58 -03:00
김선우
cc09cb7d51 Add bindInt 2025-02-07 11:35:54 +09:00
김선우
21d6f33c6b Implement bindXXX functions on rust and java side 2025-02-07 11:25:23 +09:00
김선우
d574e2c277 Add comments on errors.rs 2025-02-07 11:24:43 +09:00
김선우
88c2a15b6f Add requireNotNull method in CommonUtils 2025-02-07 09:51:37 +09:00
김선우
f6919f028e Add columnNames to LimboResultSet 2025-02-07 09:25:22 +09:00
Jussi Saurio
93c3689070 make tests better and fix more edge cases 2025-02-06 23:41:31 +02:00
Krishna Vishal
7cb7eb4e65 Merge branch 'main' into delete-btree-row 2025-02-07 01:15:21 +05:30
krishvishal
349fd51559 Get db_header from Pager instead of BTreeCursor.
Fix page_cache in btree tests to use `parking_lot::RwLock`
2025-02-07 00:11:06 +05:30
krishvishal
ea174e32f1 chore: cargo fmt 2025-02-06 23:39:12 +05:30
krishvishal
c80007d8a0 Add local constants for free_page offsets for clarity. 2025-02-06 23:39:12 +05:30
krishvishal
8a2c5808c2 Add TCL tests for delete 2025-02-06 23:39:12 +05:30
krishvishal
f836ad7561 Remove write to PAGE_HEADER_OFFSET_CELL_CONTENT_AREA in insert_into_cell. This causes corruption when you reuse cell spaces from free_list. 2025-02-06 23:39:12 +05:30
krishvishal
7d67895306 1. Added frangmentation handling to find_free_cell
2. Added asserts and corruption error to `allocate_cell_space`
2025-02-06 23:39:09 +05:30
krishvishal
8263bd0482 Update page offsets in drop_cell and update cell pointer array after dropping a cell. 2025-02-06 23:36:27 +05:30
krishvishal
73dae3003d Implement block coalescing in free_cell_range to reduce fragmentation and also added fragmentation tracking. 2025-02-06 23:36:26 +05:30
krishvishal
95da2244bb Implemented delete(). Now we are able to delete a row. It handles both interior page and leaf page cell differently. 2025-02-06 23:34:27 +05:30
krishvishal
f62ec61694 Added a unit-test to test the case where clear_overflow_pages function is called on cell with no overflow pages 2025-02-06 23:34:26 +05:30
krishvishal
8c763780a8 Added free list and free_page functionality in Pager module. Now we can add dropped pages to free list, so pages can be reused in allocate_page. 2025-02-06 23:34:12 +05:30
krishvishal
83b214a4e3 Added clear_over_pages it deletes all the overflow pages related to a cell. 2025-02-06 23:27:07 +05:30
Jussi Saurio
bf045da9dc Fix python extension test for generate_series() 2025-02-06 19:11:04 +02:00
Jussi Saurio
d5f58f5fea Add quickcheck tests for generate_series() and refine implementation 2025-02-06 18:36:21 +02:00
Jussi Saurio
098da0794f Merge 'Complete initial pass on virtual tables' from Preston Thorpe
EDIT:
Ok this should finally be all set.  There were some massive changes that
had taken place since the original PR 🫠 🫠
merge conflicts were serious
As soon as this is merged, I will finish the rest of what is needed for
`CREATE VIRTUAL TABLE some_table USING some_extension('some argument or
sql');`
I added tests for the series extension.
This PR is already big and covers a LOT of surface area, so we should
ideally try to get this in first, and I'll go back and complete the rest
of the functionality 👍

Closes #858
2025-02-06 16:29:14 +02:00
PThorpe92
ae88d51e6f Remove TableReferenceType enum to clean up planner 2025-02-06 09:15:39 -05:00
PThorpe92
cd83ac6146 Remove error from vcursor trait in extensions 2025-02-06 09:15:39 -05:00
PThorpe92
a8ae957162 Add tests for series extension, finish initial vtable impl 2025-02-06 09:15:39 -05:00
PThorpe92
ad30ccdc0e Add docs in extension README for vtable modules 2025-02-06 09:15:39 -05:00