Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
9fa01f4
Finally a _helpful_ justfile with comments, test filtering and aliases
lstwn Aug 10, 2026
6139484
[coln-flir-rs] Pretty-format Graph.json and Prim.json
lstwn Aug 10, 2026
7e5606f
[wip] map flirs to queries
lstwn Aug 10, 2026
0dcbdd0
[coln-flir-rs] Add doc comments and turn indices into unsigned types …
lstwn Aug 13, 2026
f3c9fde
[coln-flir-rs] Add equality struct (because Rust doesn't allow enum v…
lstwn Aug 13, 2026
c7f6df6
[coln-flir-rs] Add schema views for storage, query, and compiler
lstwn Aug 18, 2026
65e1ad5
[coln-query] Add multi way equi join to RelExprs
lstwn Aug 18, 2026
ecb3678
[chore] lint fixes
lstwn Aug 18, 2026
8f040fc
Backup
lstwn Aug 20, 2026
c8ca3e3
Initial support for mapping coln-flir to a query program
lstwn Aug 20, 2026
aff0a5f
Backup
lstwn Aug 20, 2026
1b54a47
[coln-query] Add pretty printer for query programs and create new typ…
lstwn Aug 20, 2026
13d0f89
[coln-query] Small improvements after the AI
lstwn Aug 21, 2026
abda746
[coln-flir-rs] Use shared workspace version of serde and serde-json
lstwn Aug 21, 2026
1a126cc
[coln-flir-rs & coln-query] Make FLIR JSON loading available for othe…
lstwn Aug 21, 2026
bad033d
[coln-store] Small lint fix after changes in coln-flir-rs
lstwn Aug 21, 2026
47a7990
[coln-query] Add lowering pass per backend and implement for incremen…
lstwn Aug 21, 2026
1e81893
[coln-query] Avoid boxing and reboxing for owned visitors
lstwn Aug 21, 2026
048a9d0
[coln-query] Post AI cleanups
lstwn Aug 24, 2026
37d55d8
[coln-query] Add TransformationRule and RewriteDriver to allow for co…
lstwn Aug 24, 2026
2fbb2f8
[coln-query] Add test asserting that the IR translation combines N co…
lstwn Aug 24, 2026
3a9f050
[coln-query] Introduce QueryProgram trait for any frontend of coln-qu…
lstwn Aug 25, 2026
fe6762d
[coln-query] Allow for frontend-specific schemas, a backend neutral s…
lstwn Aug 25, 2026
5c5e2f0
[coln-query] Rename Code to QueryIr on the top-level; thanks Owen for…
lstwn Aug 27, 2026
31b5d59
[coln-query] Transactional API for coln-store
lstwn Aug 31, 2026
78a25e0
[coln-query] A clear distinction between reporting back deltas and se…
lstwn Sep 1, 2026
700d851
[coln-query] Fix build with test utils and make TxStore uncallable fr…
lstwn Sep 1, 2026
b792620
[coln-query] Fix doc links
lstwn Sep 1, 2026
2bd6f3a
[coln-query] Align test helpers naming with coln-flir-rs to be test-u…
lstwn Sep 1, 2026
4e0559d
[coln-query] State machine diagram for tx and cleanups
lstwn Sep 1, 2026
41b3931
[coln-query] cleanups
lstwn Sep 1, 2026
056543d
Merge remote-tracking branch 'origin/main' into coln-query/flir-query…
lstwn Sep 1, 2026
3475a05
[coln-query] chore: fix license missing
lstwn Sep 1, 2026
bb9051b
[coln-query] fix: use ColnQueryError instead of lower QueryEngineErro…
lstwn Sep 3, 2026
4397028
[coln-query] feat: simplify reporting of tx outcomes especially with …
lstwn Sep 3, 2026
8fb8882
[coln-query] chore: make QueryEngineError public by reexporting it fr…
lstwn Sep 3, 2026
10a17c6
Merge pull request #137 from coln-project/coln-query/flir-query-progr…
lstwn Sep 3, 2026
be0d727
Add the logical-to-physical lowering with a guided test ladder
szlangini Aug 13, 2026
6bbdeb9
Merge pull request #135 from coln-project/jan/batch-backend
szlangini Sep 3, 2026
5391de4
Wire up the batch backend: Pipeline::batch() runs plans end to end
szlangini Sep 2, 2026
3a535d8
value unification and concept-based rename
olynch Sep 2, 2026
e46831a
formatting
olynch Sep 2, 2026
28d1a79
fixed clippy
olynch Sep 2, 2026
6dd2a1c
license header
olynch Sep 2, 2026
2782ac5
really fixed clippy
olynch Sep 2, 2026
b9d790d
fix runtime
olynch Sep 3, 2026
dbf2101
fixed coln-js-runtime tests
olynch Sep 3, 2026
dad69a2
allow deprecated
olynch Sep 3, 2026
6c7be02
temporarily disable coln-js-runtime
olynch Sep 3, 2026
e3a1d9d
remove unnecessary liven_all
olynch Sep 3, 2026
bda95f5
format
olynch Sep 3, 2026
ddc7d88
feat(coln-store): Change txn.add() interface
incipit0 Sep 3, 2026
171e187
ci(coln-js-runtime): bring back CI
incipit0 Sep 3, 2026
c433986
fix(coln-js-runtime): Fix into_wasm_abi
incipit0 Sep 3, 2026
575e0ae
fixup! feat(coln-store): Change txn.add() interface
incipit0 Sep 3, 2026
ceccc82
fix(coln-query): change to i32
incipit0 Sep 3, 2026
985da6d
Merge pull request #145 from coln-project/jan/batch-backend-wiring
szlangini Sep 4, 2026
31196e9
Merge pull request #140 from coln-project/value-unification
incipit0 Sep 6, 2026
5fad573
rpc using WireValue
olynch Sep 3, 2026
0a59694
store hashes as hex strings
olynch Sep 4, 2026
eeddd2b
sketch out the interface
olynch Sep 4, 2026
a535eaa
formatting and clippy fixup
olynch Sep 7, 2026
470c4a8
fix licenses
olynch Sep 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
965 changes: 480 additions & 485 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ members = [
"packages/coln-store",
"packages/coln-query",
"packages/coln-integrator",
"packages/coln-batch"
"packages/coln-batch",
"packages/coln-batch",
"packages/coln-rpc"
]
resolver = "3"

Expand All @@ -22,6 +24,7 @@ anyhow = "1.0.102"
criterion = "0.8.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.149"
specta = { version = "2.0.0-rc.25", features = ["derive"] }
thiserror = "2.0.18"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
1 change: 0 additions & 1 deletion packages/coln-batch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ readme = "README.md"
[dependencies]
anyhow = { workspace = true }
arrow = { version = "56", default-features = false, features = ["ipc"] }
coln-integrator = { path = "../coln-integrator" }
11 changes: 9 additions & 2 deletions packages/coln-flir-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@ exclude = ["/.gitignore"]

[lib]

[features]
test-utils = []

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde.workspace = true
serde_json.workspace = true
specta.workspace = true

[dev-dependencies]
serde_json = "1.0"
# This is a self-referential dev-dependency to have the feature-gated
# test-utils be available in this crate's integration tests, too.
coln-flir-rs = { path = ".", features = ["test-utils"] }
89 changes: 77 additions & 12 deletions packages/coln-flir-rs/src/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,28 @@ pub mod path;

use serde::de::Error as DeError;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use specta::Type;

// A QName is a vec of string, potentially separated by a forward slash /
pub type QName = Vec<String>;

// For example a G.V would become [["G"], ["V"]], this is at a higher level than
// QName because V would be a query inside a theory G
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, Type)]
#[serde(transparent)]
pub struct Path(pub Vec<QName>);

type ColName = Path;
pub type FId = i64;
/// A column name is given by a [`Path`].
pub type ColName = Path;

/// An index into the [`varNames`](Rule::var_names) and
/// [`varTypes`](Rule::var_types) arrays of a [`Rule`].
///
/// Note: An `FId` in `coln-compiler`.
pub type VarIdx = u64;

/// An index into a relation's physical [`columns`](Schema::columns).
pub type ColumnIdx = u64;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BuiltinTy {
Expand Down Expand Up @@ -62,9 +72,10 @@ impl<'de> Deserialize<'de> for BuiltinTy {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "tag", rename_all = "camelCase")]
pub enum ColType {
RowId {
path: Path,
},
/// A foreign key into another table by referencing its _row id_ through
/// the provided path.
RowId { path: Path },
/// A data column with the scalar type [`BuiltinTy`].
#[serde(rename = "builtin")]
BuiltinTy {
#[serde(rename = "type")]
Expand All @@ -89,8 +100,11 @@ pub enum IndexMethod {
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "tag", rename_all = "camelCase")]
pub enum EntityVariant {
/// A base table of the extensional database (EDB).
Table,
/// A derived view of the intensional database (IDB).
View(Materialization),
/// Tell `coln-store` to create an index and possibly hint to `coln-query`.
Index {
method: IndexMethod,
columns: Vec<ColName>,
Expand All @@ -105,20 +119,30 @@ pub struct ColumnEntry {
pub col_type: ColType,
}

// This is really Entity on the Haskell IR side, but I feel schema matches it better
/// Describes a schema of a relation.
///
/// Note: An `Entity` in `coln-compiler`.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Schema {
pub entity_variant: EntityVariant,
/// The columns of the table in their physical order.
pub columns: Vec<ColumnEntry>,
/// A `None` indicates that there is no primary key. `Some(vec![])` means
/// that there is at most one row in the table. `Some(vec![ColA, ColB])`
/// encodes a compound primary key consisting of the columns `ColA` and
/// `ColB`.
///
/// At the moment there is only support for a single (compound) primary key.
pub primary_key: Option<Vec<ColName>>,
}

/// A literal expression.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag = "tag", rename_all = "lowercase")]
pub enum Lit {
#[serde(rename = "int")]
Int { value: i64 },
Int { value: i32 },
#[serde(rename = "string")]
String { value: String },
}
Expand All @@ -127,65 +151,106 @@ pub enum Lit {
#[serde(tag = "tag", rename_all = "lowercase")]
pub enum Term {
Lit { lit: Lit },
Var { index: FId },
Var { index: VarIdx },
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ValueEntry {
pub column: i64,
pub column: ColumnIdx,
pub term: Term,
}

/// An [`Atom`] references an entity (a relation or a table) to bring some of
/// its fields into the scope of a [`Rule`].
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Atom {
/// The "name" of the entity being referenced by this [`Atom`].
pub entity: Path,
/// To bring the `row_id` of the [`Entity`](Self::entity) into scope.
///
/// Note: A [`Some(Term::Lit)`](Term::Lit) does not make sense in this
/// context, as we do not support a row id literal at the moment, I suppose.
pub row_id: Option<Term>,
/// To bring some columns of the [`Entity`](Self::entity) into scope.
pub values: Vec<ValueEntry>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "tag", rename_all = "lowercase")]
pub enum Prop {
Atom { atom: Atom },
Eq { left: Term, right: Term },
Atom {
atom: Atom,
},
Eq {
#[serde(flatten)]
equality: Equality,
},
}

/// An equality condition between the left and the right term, that is,
/// we assert `left == right`.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Equality {
pub left: Term,
pub right: Term,
}

#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RuleVariant {
/// _Chased_ rules are not yet fully alive but become relevant once initial
/// models land.
Chased,
/// Violations of _enforced_ rules cause a transaction to abort.
Enforced,
/// Violations of _monitored_ rules are just reported back to the user but
/// still allow a transaction to commit.
Monitored,
}

/// A `Rule` is an implication and must be true in all valid states of
/// `coln-store` and `coln-query`.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Rule {
pub rule_variant: RuleVariant,
/// Assigns some names to the variables the rule binds.
///
/// Note: Must be of the same arity as [`Self::var_types`].
pub var_names: Vec<ColName>,
/// Tells the types of the variables the rule binds.
///
/// Note: Must be of the same arity as [`Self::var_names`].
pub var_types: Vec<ColType>,
/// The left-hand side of the implication.
pub antecedents: Vec<Prop>,
/// The right-hand side of the implication.
pub consequents: Vec<Prop>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TableEntry {
/// The "name" of the table.
pub path: Path,
#[serde(rename = "value")]
pub table: Schema,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RuleEntry {
/// The "name" of the rule.
pub path: Path,
#[serde(rename = "value")]
pub rule: Rule,
}

/// The top-level type of a flattened realm and the starting point of the FLIR.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FlatRealm {
/// The tables of the flattened realm.
#[serde(rename = "entities")]
pub tables: Vec<TableEntry>,
/// The rules (laws) of the flattened realm.
pub rules: Vec<RuleEntry>,
}
19 changes: 19 additions & 0 deletions packages/coln-flir-rs/src/ir/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@ impl Deref for Path {
}
}

impl Path {
pub fn append(mut self, name: &str) -> Self {
self.0.push(vec![name.to_string()]);
self
}
}

impl From<Path> for String {
fn from(value: Path) -> Self {
value.to_string()
}
}

impl From<&Path> for String {
fn from(value: &Path) -> Self {
value.to_string()
}
}

impl Display for Path {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for (i, qname) in self.0.iter().enumerate() {
Expand Down
3 changes: 3 additions & 0 deletions packages/coln-flir-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

pub mod ir;
pub mod schema;
#[cfg(feature = "test-utils")]
pub mod test_utils;
Loading
Loading