Commit Graph

451 Commits

Author SHA1 Message Date
김선우
8fbcd10e0e Add support for ifnull scalar function 2024-08-16 09:25:04 +09:00
Pekka Enberg
39e77bac9f Merge 'Implement scala function substring(...) ' from Kim Seon Woo
Implement scala function `substring(x, y, z)` and `substring(x, y)`

### EXPLAIN SELECT substring('limbo', 3);
![image](https://github.com/user-attachments/assets/0138d802-c40e-4990-8657-05a0d54ee00f)

### EXPLAIN SELECT substring('limbo', 1, 2);
![image](https://github.com/user-attachments/assets/1babeb1b-f5ca-4b8f-ae19-c4f06b51d4b6)

### Related issue
https://github.com/penberg/limbo/issues/144

Closes #286
2024-08-15 19:45:22 +03:00
김선우
ac440495bd Nit 2024-08-15 18:59:46 +09:00
김선우
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
Vegard Stikbakke
e54fd83f49 Handle FunctionCallStar in analyze_expr 2024-08-11 13:59:49 +02: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
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
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
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
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
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
Lauri Virtanen
145af04c7e Fix serial type decoding for BLOB and TEXT
Replace `>` with `>=` to match the SQLite documentation. Serial type
value `12` is for 0-size BLOB, and `13` is for 0-size TEXT.
2024-08-02 21:50:50 +03:00
Pekka Enberg
0affdada2a core: Move datetime.rs to vdbe/
The file contains SQL functions invoked by the VDBE so let's move the
file there.
2024-08-02 17:34:10 +03:00
Pekka Enberg
9c479734be core: Rename to exec_time()
Follow the same naming convention as other SQL functions.
2024-08-02 17:34:10 +03:00
Pekka Enberg
465dfa3cb5 core: Rename to exec_date()
Follow the same naming convention as other SQL functions.
2024-08-02 17:34:10 +03:00
Pekka Enberg
69eb851120 core/datetime: Move get_max_datetime_exclusive() to bottom
Move the function so that it's callers are above the function definition
for smoother flow when reading the code.
2024-08-02 16:15:22 +03:00
Pekka Enberg
6ffb03216f core/datetime: Simplify error handling 2024-08-02 16:15:22 +03:00
Pekka Enberg
3412b65b8a core/datetime: Remove TimeUnit
...it's not used for anything much.
2024-08-02 16:04:09 +03:00
Pekka Enberg
763bf17c9e core/datetime: Use "cfg(test)" annotation for tests 2024-08-02 16:03:53 +03:00
Pekka Enberg
f8492c85ae core/datetime: Remove trace calls
We should trace in high-level code like VDBE interpreter loop, but not
in error handling path of specific SQL functions.
2024-08-02 16:03:46 +03:00
jussisaurio
20c085614f Add ability to annotate instructions with comments 2024-08-01 20:34:45 +03:00
jussisaurio
02cae50324 use move_to() in btree_seek_rowid() 2024-08-01 18:32:01 +03:00
jussisaurio
f344e07868 extract method 2024-08-01 17:54:29 +03:00
jussisaurio
7e88ad64da Rename and comment 2024-08-01 17:53:21 +03:00
jussisaurio
f46b13690f augment comment 2024-08-01 17:47:13 +03:00
jussisaurio
6860329940 rename and add comments 2024-08-01 17:45:40 +03:00
jussisaurio
81c2f2eca6 Add comment 2024-08-01 17:40:39 +03:00
jussisaurio
583fe31667 rebase fix 2024-08-01 17:26:00 +03:00
jussisaurio
551b11303f Broaden the type of expr that qualifies as seekrowid candidate 2024-08-01 17:23:59 +03:00
jussisaurio
64f7e48f1b Cleanup 2024-08-01 17:23:59 +03:00
jussisaurio
8feb443048 Use SeekRowid instruction on expr1 = expr2 constraints if they contain primary keys 2024-08-01 17:23:59 +03:00