Commit Graph

1926 Commits

Author SHA1 Message Date
CK-7vn
57274fa40b Correct CLI comment handling to mimic sqlite behavior 2025-01-17 13:59:34 -05:00
Pekka Enberg
20837d217b Update COMPAT.md 2025-01-17 19:50:43 +02:00
Pekka Enberg
02d410eb79 Merge 'Add regexp extension' from Vrishabh
Implements some of the regexp functions as an extension from
[sqlean](https://github.com/nalgeon/sqlean/blob/main/docs/regexp.md)

Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #717
2025-01-17 19:49:22 +02:00
Pekka Enberg
67b4b24580 Merge 'Reduce liblimbo_sqlite3.a size' from Pekka Enberg
This reduces `liblimbo_sqlite3.a` size from 37M to 15M.
Refs #714

Closes #715
2025-01-17 13:42:23 +02:00
Pekka Enberg
21c5fe2909 cargo: Switch to "line-tables-only" debug symbols
...reduces size of `liblimbo_sqlite3.a` to 15 MB.

Suggested by @psvri
2025-01-17 11:52:17 +02:00
Pekka Enberg
4943217045 cargo: Disable LTO..
..to reduce `liblimbo_sqlite3.a` size from 37M to 20M. As it turns out,
LLVM emits its bitcode into static libraries when LTO is enabled to be
"more aggressive" in optimizations

Refs #714
2025-01-17 11:52:17 +02:00
Pekka Enberg
b2cbc3e0eb Merge 'github: Switch to upload-artifact v4' from Pekka Enberg
The current version is getting deprecated:
https://github.blog/news-insights/product-news/get-started-with-v4-of-
github-actions-artifacts/

Closes #716
2025-01-17 11:52:00 +02:00
Pekka Enberg
f550ee5f11 github: Switch to upload-artifact v4
The current version is getting deprecated:

https://github.blog/news-insights/product-news/get-started-with-v4-of-github-actions-artifacts/
2025-01-17 11:44:34 +02:00
Pekka Enberg
718ba17c0a Merge 'Fix cli comments parsing' from Diego Reis
#711
I followed the patterns that sqlite has, so everything after `--` is
treated as a comment. A bunch of spaces and a `--` is treated as a
comment also.

Closes #718
2025-01-17 07:40:29 +02:00
Diego Reis
285eeccb84 Fix cli comments parsing 2025-01-16 20:20:36 -03:00
psvri
e43271f53b Implement regexp extension 2025-01-16 23:15:59 +05:30
psvri
3e9f3ae652 Fix all args not being passed to external functions 2025-01-16 23:15:01 +05:30
Pekka Enberg
20ea8fb941 Make Clippy happy 2025-01-16 15:57:08 +02:00
Pekka Enberg
41b8228744 Merge 'Enable all features and targets in clippy for CI' from Jorge Hermo
I think we should run clippy in CI with all the features and targets
enabled.
This would help to get more clippy coverage as with the current CI
command, some code paths were not covered by clippy. For example, `test`
modules were not covered by it as we need at least the `--tests` flag
(or `--all-targets`)

Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #707
2025-01-16 15:10:11 +02:00
Pekka Enberg
cc1e281314 Merge 'Extension cleanups' from Pekka Enberg
Reviewed-by: Preston Thorpe (@PThorpe92)

Closes #713
2025-01-16 14:54:18 +02:00
Pekka Enberg
38f7dec9e7 merge-pr.py: Fix random emails appearing in commit logs
...my good friend Claude was probably drunk when he wrote that code.
2025-01-16 14:54:10 +02:00
Pekka Enberg
e2cf5cf145 Merge 'cli: Improve .schema command output on errors' from Pekka Enberg
Improve `.schema` output on errors by marking them as comments. This
allows you to pipe any `.schema` output to another shell.

Reviewed-by: Preston Thorpe <cory.pride83@gmail.com>

Closes #712
2025-01-16 14:49:46 +02:00
Pekka Enberg
9209641a07 cargo fmt 2025-01-16 14:43:23 +02:00
Pekka Enberg
e8420a3cb7 Update Cargo.lock 2025-01-16 14:42:07 +02:00
Pekka Enberg
93903555aa Rename limbo_extension crate to limbo_ext 2025-01-16 14:40:52 +02:00
Pekka Enberg
f83b34287e Move limbo_extension crate to extensions/core 2025-01-16 14:39:12 +02:00
Pekka Enberg
f711d2b7ed cli: Improve .schema command output on errors
Improve `.schema` output on errors by marking them as comments. This
allows you to pipe any `.schema` output to another shell.
2025-01-16 14:25:48 +02:00
Pekka Enberg
465c923db1 Update COMPAT.md 2025-01-16 09:14:46 +02:00
Jorge Hermo
f5616f5ddb Update vendored/sqlite3-parser/Cargo.toml 2025-01-15 23:50:28 +01:00
Jorge Hermo
fe30a7b505 chore: include limbo-wasm in clippy checks 2025-01-15 23:39:45 +01:00
Jorge Hermo
c6b9b0c9a1 chore: update clippy ci command 2025-01-15 23:25:04 +01:00
Jorge Hermo
15f7928551 chore: enable all features in clippy ci and fix more clippy lints 2025-01-15 23:23:12 +01:00
Pekka Enberg
2aaa981b18 Merge 'Initial implementation of Statement::bind_at' from Levy A.
Resolves #607.
- [x] Index parameters.
- [x] Named parameters.
- [x] Parameter count.
- [ ] More tests.
- [ ] Expose to Sqlite3 API.

Closes #675
2025-01-15 22:52:56 +02:00
Levy A.
9b8722f38e refactor: more well rounded implementation
`?0` parameters are now handled by the parser.
2025-01-15 16:53:26 -03:00
Levy A.
5de2694834 feat: more parameter support
add `Statement::{parameter_index, parameter_name, parameter_count,
bind_at}`. some refactoring is still needed, this is quite a rough
iteration
2025-01-15 16:51:04 -03:00
Levy A.
d3582a382f fix: small bugs 2025-01-15 16:51:04 -03:00
Levy A.
6e0ce3dd01 chore: cargo fmt 2025-01-15 16:51:04 -03:00
Levy A.
08c8c655e9 feat: initial implementation of Statement::bind 2025-01-15 16:51:04 -03:00
Pekka Enberg
b589203fea Merge 'Fix MustBeInt opcode semantics' from Vrishabh
In sqlite3 , we can create primary key with only integer column and
during insert we can pass any value which can be parsed into integer as
shown below. When I tried the same with limbo, it failed. The cause of
this was due to MustBeInt opcode behaviour not aligned with sqlite. This
PR aims to fix it.
Sqlite output
```
SQLite version 3.45.3
sqlite> create table temp (t1 integer, primary key (t1));
sqlite> insert into temp values (1),(2.0),('3'),('4.0');
sqlite> select * from temp;
1
2
3
4
```
Limbo output main branch
```
limbo>     create table temp (t1 integer, primary key (t1));
limbo>     insert into temp values (1),(2.0),('3'),('4.0');
Parse error: MustBeInt: the value in the register is not an integer
limbo>     select * from temp;
1
```
Limbo output with this PR
```
limbo> create table temp (t1 integer, primary key (t1));
limbo> insert into temp values (1),(2.0),('3'),('4.0');
limbo> select * from temp;
1
2
3
4
```

Closes #706
2025-01-15 21:14:54 +02:00
psvri
845de125db Align MustBeInt logic with sqlite 2025-01-16 00:09:45 +05:30
Pekka Enberg
f7af8150d2 Merge 'Simulator: show inner error if any' from Jussi Saurio
Seed 16184573510628167771 in git hash 7c549bc produces a missing row
error, but the underlying error is `Parse error: table
breathtaking_dimitrakis not found`, which was not obvious without
exposing the error in the message the simulator prints on assertion
failure.
This PR just exposes the inner error, if any.

Closes #704
2025-01-15 19:45:49 +02:00
Jussi Saurio
0f4cc8f0cc Simulator: expose inner error in assertion failure, if any 2025-01-15 19:22:05 +02:00
Pekka Enberg
bdc06f2d66 Merge 'Implement ShiftRight' from Vrishabh
This PR adds support for ShiftRight operator and Opcode.

Closes #703
2025-01-15 18:53:23 +02:00
Pekka Enberg
c01c80baee Merge 'Run all statements from sql argument in cli' from Vrishabh
When we had multiple sql statements in cli/interactive shell, we were
only running one from them as  shown below. This PR fixes them.
One added benefit of this is we can add complex sql in the tcl test
files like the changes in insert.test .
sqlite3 output
```
❯ sqlite3  :memory: "select 1;select 2"
1
2
```
Limbo main branch output
```
❯ ./target/debug/limbo.exe :memory: "select 1;select 2;"
1
```
Limbos output with this PR
```
❯ ./target/debug/limbo.exe :memory: "select 1;select 2;"
1
2
```

Reviewed-by: Preston Thorpe <cory.pride83@gmail.com>

Closes #673
2025-01-15 18:44:17 +02:00
Pekka Enberg
7c549bc978 Merge 'Expr: fix recursive binary operation logic' from Jussi Saurio
I believe this closes #682
```
limbo> CREATE TABLE proficient_barrett (imaginative_etrebilal BLOB,lovely_wilson BLOB);
INSERT INTO proficient_barrett VALUES (X'656E67726F7373696E675F636861636F', X'776F6E64726F75735F626F75726E65');
limbo> SELECT * FROM proficient_barrett
WHERE (
    (
        (
            (
                imaginative_etrebilal != X'6661766F7261626C655F636F726573'
                OR
                (imaginative_etrebilal > X'656E67726F7373696E675F6368616439')
            )
            AND
            (
                imaginative_etrebilal = X'656E676167696E675F6E6163696F6E616C'
                OR
                TRUE
            )
        )
        OR
        FALSE
    )
    AND
    (
        imaginative_etrebilal > X'656E67726F7373696E675F63686164F6'
        OR
        TRUE
    )
);
engrossing_chaco|wondrous_bourne
```
@PThorpe92 I don't think we need the `parent_op` machinery at all, we
just need to not jump to the `jump_target_when_true` label given by the
parent if we are evaluating the first condition of an AND.
related: https://github.com/tursodatabase/limbo/pull/633

Reviewed-by: Preston Thorpe <cory.pride83@gmail.com>

Closes #698
2025-01-15 18:32:59 +02:00
Pekka Enberg
4fafaba607 simulator: Reduce generated sequence size defaults
...otherwise the simulator runs forever...
2025-01-15 18:32:03 +02:00
psvri
d3f28c51f4 Implement ShiftRight 2025-01-15 21:21:51 +05:30
Pekka Enberg
519ba75642 Merge 'Implement ShiftLeft' from Vrishabh
This PR adds support for ShiftLeft operator and Opcode.

Closes #701
2025-01-15 17:14:19 +02:00
psvri
5b4d82abbf Implement ShiftLeft 2025-01-15 18:54:07 +05:30
psvri
9cc9577c91 Run all statements from sql argument in cli 2025-01-15 18:19:39 +05:30
Jussi Saurio
84ef8a8951 translate_condition_expr(): unify how the AND and OR cases look 2025-01-15 14:24:40 +02:00
Jussi Saurio
f8b3b06163 Expr: fix recursive binary operation logic 2025-01-15 14:12:08 +02:00
Pekka Enberg
ffe65140c1 Merge 'simulator: add counterexample minimization' from Alperen Keleş
This PR introduces counterexample minimization(shrinking) in the
simulator. It will require changes to the current structure in various
places, so I've opened it as a draft PR for now, in order to not
overwhelm the reviewers all at once.
- [x] Turn interactions plans into sequences of properties instead of
sequences of interactions, adding a semantic layer.
- [x] Add assumptions to the properties, rendering a property invalid if
its assumptions are not valid.
- [x] Record the failure point in a failing assertion, as shrinking by
definition works when the same assertion fails for a smaller input.
- [ ] Add shrinking at three levels,
  - [x] top level(removing whole properties),
  - [x] property level(removing interactions within properties),
  - [ ] interaction level(shrinking values in interactions to smaller
ones).
- [ ] Add [marauders](https://github.com/alpaylan/marauders) as a dev
dependency, inject custom mutations to a testing branch for evaluating
the simulator performance.
- [ ] Integrate the simulator evaluation with the CI.

Closes #623
2025-01-15 13:12:17 +02:00
alpaylan
ea6ad8d414 remove debug print 2025-01-15 12:44:43 +03:00
alpaylan
c446e29a50 add missed updates from the merge 2025-01-15 11:42:48 +03:00