mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-21 16:05:17 +01:00
First implementation of Logical plan
This is a first pass on logical plans. The idea is that the DBSP compiler will have an easier time operating on a logical plan, that exposes linear algebra operators, than on SQL expr. To keep this simple, we only support filters, aggregates and projections for now, and will add more later as we agree on the core of the implementation. To make sure that the implementations is reasonable, I tried my best to generate a couple of logical plans using Datafusion and seeing if we were generating something similar. Our plans are not the same as Datafusion's, though. There are two important differences: * SQLite is weird, and it allows columns that are not part of the group by statement to appear in aggregated statements. For example: select a, count(b) from table group by c; <== that "a" is usually not permitted and datafusion will reject it. SQLite will be happy to accept it * Datafusion will not generate a projection on queries like this: select sum(hex(a)) from table, and just keep the complex expression hex(a) inside the aggregation. For DBSP to work well, we'll need an explicit aggregation there. Because there are no users yet, I am marking this as [cfg(test)], but I wanted to put this out there ASAP.
This commit is contained in:
3076
core/translate/logical.rs
Normal file
3076
core/translate/logical.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,8 @@ pub(crate) mod group_by;
|
||||
pub(crate) mod index;
|
||||
pub(crate) mod insert;
|
||||
pub(crate) mod integrity_check;
|
||||
#[cfg(test)]
|
||||
pub(crate) mod logical;
|
||||
pub(crate) mod main_loop;
|
||||
pub(crate) mod optimizer;
|
||||
pub(crate) mod order_by;
|
||||
|
||||
Reference in New Issue
Block a user