Commit Graph

11 Commits

Author SHA1 Message Date
PThorpe92
2c526c4c37 Add io_yield_x macros to reduce boilerplate 2025-08-16 16:14:00 -04:00
pedrocarlo
82b75330bc adjust types.rs util.rs view.rs and mvcc to bubble io 2025-08-13 10:24:55 +03:00
Glauber Costa
770f86e490 move our dbsp-based views to materialized views
We will implement normal SQLite-style view-as-an-alias for
compatibility, and will call our incremental views materialized views.
2025-08-12 14:19:17 -05:00
Pekka Enberg
db54c953bd Merge 'Implement Aggregations for DBSP views' from Glauber Costa
```
turso> create table t(a, b);
turso> insert into t(a,b) values (2,2), (3,3);
turso> insert into t(a,b) values (6,6), (7,7);
turso> insert into t(a,b) values (6,6), (7,7);
turso> create view tt as select b, sum(a) from t where b > 2 group by b;
turso> select * from tt;
┌───┬─────────┐
│ b │ sum (a) │
├───┼─────────┤
│ 3 │       3 │
├───┼─────────┤
│ 6 │      12 │
├───┼─────────┤
│ 7 │      14 │
└───┴─────────┘
turso> insert into t(a,b) values (1,3);
turso> select * from tt;
┌───┬─────────┐
│ b │ sum (a) │
├───┼─────────┤
│ 3 │       4 │
├───┼─────────┤
│ 6 │      12 │
├───┼─────────┤
│ 7 │      14 │
└───┴─────────┘
turso>
```

Closes #2547
2025-08-12 09:52:22 +03:00
Glauber Costa
333c5c435b unify populate
populate now has its own code path to apply changes to the view. It was
okay until now because all we do is filter. But now that we are also
applying aggregations, we'll end up with two disjoint code paths.

A better approach is to just apply the results of our select to the
delta set, and apply it.
2025-08-11 15:06:57 -05:00
Glauber Costa
27c22a64b3 views: implement aggregations
Hook up the AggregateOperator. Also wires up the tracker, allowing us to
verify how much work was done.
2025-08-11 15:06:57 -05:00
Jussi Saurio
a50c799e05 stop silently ignoring unsupported features in incremental view WHERE clauses 2025-08-11 17:44:41 +03:00
Pekka Enberg
62f1fd2038 core/incremental: Make clippy happy 2025-08-11 08:36:53 +03:00
Pekka Enberg
87322ad1e4 core/incremental: Evaluate view expressions
...tests were failing because we are testing with expressions, but
didn't support them.
2025-08-11 08:27:10 +03:00
Glauber Costa
145d6eede7 Implement very basic views using DBSP
This is just the bare minimum that I needed to convince myself that this
approach will work. The only views that we support are slices of the
main table: no aggregations, no joins, no projections.

drop view is implemented.
view population is implemented.
deletes, inserts and updates are implemented.

much like indexes before, a flag must be passed to enable views.
2025-08-10 23:34:04 -05:00
Glauber Costa
d5b7533ff8 Implement a DBSP module
We are not using the DBSP crate because it is very heavy on Tokio and
other dependencies that won't make sense for us to consume.
2025-08-10 23:15:26 -05:00