diff --git a/Cargo.lock b/Cargo.lock
index 59fcffbd454..a55ea8bc8f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3857,11 +3857,14 @@ name = "hashql-eval"
version = "0.0.0"
dependencies = [
"derive_more",
+ "hash-graph-postgres-store",
"hash-graph-store",
"hashql-compiletest",
"hashql-core",
"hashql-diagnostics",
"hashql-hir",
+ "hashql-mir",
+ "insta",
"simple-mermaid",
"type-system",
]
diff --git a/apps/hash-graph/docs/dependency-diagram.mmd b/apps/hash-graph/docs/dependency-diagram.mmd
index 7b648492b71..f9c26a72305 100644
--- a/apps/hash-graph/docs/dependency-diagram.mmd
+++ b/apps/hash-graph/docs/dependency-diagram.mmd
@@ -55,7 +55,6 @@ graph TD
1 -.-> 40
2 -.-> 3
2 --> 22
- 4 --> 8
4 --> 11
4 --> 12
4 --> 18
@@ -91,15 +90,14 @@ graph TD
22 --> 39
23 -.-> 24
24 --> 27
- 24 --> 30
24 --> 31
24 --> 39
25 --> 2
25 --> 26
25 --> 29
25 -.-> 36
- 27 --> 9
- 27 --> 28
+ 27 --> 8
+ 27 --> 30
28 -.-> 24
30 --> 28
31 --> 23
diff --git a/libs/@blockprotocol/type-system/rust/docs/dependency-diagram.mmd b/libs/@blockprotocol/type-system/rust/docs/dependency-diagram.mmd
index 3ed38b0d71c..cee946bdefb 100644
--- a/libs/@blockprotocol/type-system/rust/docs/dependency-diagram.mmd
+++ b/libs/@blockprotocol/type-system/rust/docs/dependency-diagram.mmd
@@ -40,7 +40,6 @@ graph TD
1 -.-> 25
2 -.-> 3
2 --> 14
- 4 --> 6
4 --> 9
4 --> 12
4 --> 17
@@ -61,11 +60,10 @@ graph TD
14 --> 22
15 -.-> 16
16 --> 17
- 16 --> 19
16 --> 20
16 --> 22
- 17 --> 7
- 17 --> 18
+ 17 --> 6
+ 17 --> 19
18 -.-> 16
19 --> 18
20 --> 15
diff --git a/libs/@local/codec/docs/dependency-diagram.mmd b/libs/@local/codec/docs/dependency-diagram.mmd
index a72ee71838c..b2c62ea4a08 100644
--- a/libs/@local/codec/docs/dependency-diagram.mmd
+++ b/libs/@local/codec/docs/dependency-diagram.mmd
@@ -45,7 +45,6 @@ graph TD
1 -.-> 30
2 -.-> 3
2 --> 18
- 4 --> 6
4 --> 9
4 --> 14
4 --> 22
@@ -71,12 +70,11 @@ graph TD
18 --> 27
19 -.-> 20
20 --> 22
- 20 --> 24
20 --> 25
20 --> 27
21 --> 2
- 22 --> 7
- 22 --> 23
+ 22 --> 6
+ 22 --> 24
23 -.-> 20
24 --> 23
25 --> 19
diff --git a/libs/@local/codegen/docs/dependency-diagram.mmd b/libs/@local/codegen/docs/dependency-diagram.mmd
index 2b981d206a5..601be9ff4ba 100644
--- a/libs/@local/codegen/docs/dependency-diagram.mmd
+++ b/libs/@local/codegen/docs/dependency-diagram.mmd
@@ -41,7 +41,6 @@ graph TD
1 --> 8
1 -.-> 27
2 -.-> 3
- 4 --> 6
4 --> 9
4 --> 14
4 --> 20
@@ -64,11 +63,10 @@ graph TD
16 --> 13
17 -.-> 18
18 --> 20
- 18 --> 22
18 --> 23
19 --> 2
- 20 --> 7
- 20 --> 21
+ 20 --> 6
+ 20 --> 22
21 -.-> 18
22 --> 21
23 --> 17
diff --git a/libs/@local/graph/api/docs/dependency-diagram.mmd b/libs/@local/graph/api/docs/dependency-diagram.mmd
index 8c732a72bd1..4eee95b4a8b 100644
--- a/libs/@local/graph/api/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/api/docs/dependency-diagram.mmd
@@ -56,7 +56,6 @@ graph TD
1 -.-> 41
2 -.-> 3
2 --> 22
- 4 --> 8
4 --> 11
4 --> 12
4 --> 18
@@ -92,15 +91,14 @@ graph TD
22 --> 39
23 -.-> 24
24 --> 27
- 24 --> 30
24 --> 31
24 --> 39
25 --> 2
25 --> 26
25 --> 29
25 -.-> 36
- 27 --> 9
- 27 --> 28
+ 27 --> 8
+ 27 --> 30
28 -.-> 24
30 --> 28
31 --> 23
diff --git a/libs/@local/graph/authorization/docs/dependency-diagram.mmd b/libs/@local/graph/authorization/docs/dependency-diagram.mmd
index 2e6aa888d26..a57506ba2cc 100644
--- a/libs/@local/graph/authorization/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/authorization/docs/dependency-diagram.mmd
@@ -40,7 +40,6 @@ graph TD
1 -.-> 25
2 -.-> 3
2 --> 14
- 4 --> 6
4 --> 9
4 --> 12
4 --> 17
@@ -61,11 +60,10 @@ graph TD
14 --> 22
15 -.-> 16
16 --> 17
- 16 --> 19
16 --> 20
16 --> 22
- 17 --> 7
- 17 --> 18
+ 17 --> 6
+ 17 --> 19
18 -.-> 16
19 --> 18
20 --> 15
diff --git a/libs/@local/graph/migrations-macros/docs/dependency-diagram.mmd b/libs/@local/graph/migrations-macros/docs/dependency-diagram.mmd
index 9612a35505c..427345a63b3 100644
--- a/libs/@local/graph/migrations-macros/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/migrations-macros/docs/dependency-diagram.mmd
@@ -14,11 +14,26 @@ graph TD
3[hash-graph-migrations-macros]
class 3 root
4[hash-graph-postgres-store]
- 5[hash-graph-benches]
- 6[hash-graph-integration]
+ 5[hashql-ast]
+ 6[hashql-compiletest]
+ 7[hashql-eval]
+ 8[hashql-hir]
+ 9[hashql-mir]
+ 10[hashql-syntax-jexpr]
+ 11[hash-graph-benches]
+ 12[hash-graph-integration]
0 --> 1
- 1 --> 4
+ 1 --> 7
+ 1 --> 10
2 --> 3
4 -.-> 2
- 5 -.-> 1
- 6 -.-> 4
+ 5 -.-> 6
+ 6 --> 7
+ 6 --> 10
+ 7 --> 4
+ 7 --> 9
+ 8 -.-> 6
+ 9 --> 8
+ 10 --> 5
+ 11 -.-> 1
+ 12 -.-> 4
diff --git a/libs/@local/graph/migrations/docs/dependency-diagram.mmd b/libs/@local/graph/migrations/docs/dependency-diagram.mmd
index 242c2ffd226..e4c8194c510 100644
--- a/libs/@local/graph/migrations/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/migrations/docs/dependency-diagram.mmd
@@ -14,15 +14,31 @@ graph TD
class 2 root
3[hash-graph-migrations-macros]
4[hash-graph-postgres-store]
- 5[hash-telemetry]
- 6[error-stack]
- 7[hash-graph-benches]
- 8[hash-graph-integration]
+ 5[hashql-ast]
+ 6[hashql-compiletest]
+ 7[hashql-eval]
+ 8[hashql-hir]
+ 9[hashql-mir]
+ 10[hashql-syntax-jexpr]
+ 11[hash-telemetry]
+ 12[error-stack]
+ 13[hash-graph-benches]
+ 14[hash-graph-integration]
0 --> 1
- 1 --> 4
+ 1 --> 7
+ 1 --> 10
2 --> 3
- 2 --> 5
+ 2 --> 11
4 -.-> 2
- 5 --> 6
- 7 -.-> 1
- 8 -.-> 4
+ 5 -.-> 6
+ 6 --> 7
+ 6 --> 10
+ 6 --> 12
+ 7 --> 4
+ 7 --> 9
+ 8 -.-> 6
+ 9 --> 8
+ 10 --> 5
+ 11 --> 12
+ 13 -.-> 1
+ 14 -.-> 4
diff --git a/libs/@local/graph/postgres-store/docs/dependency-diagram.mmd b/libs/@local/graph/postgres-store/docs/dependency-diagram.mmd
index d7c861b68cb..da7204a41bb 100644
--- a/libs/@local/graph/postgres-store/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/postgres-store/docs/dependency-diagram.mmd
@@ -24,36 +24,52 @@ graph TD
12[hash-graph-validation]
13[harpc-types]
14[harpc-wire-protocol]
- 15[hash-status]
- 16[hash-telemetry]
- 17[hash-temporal-client]
- 18[error-stack]
- 19[hash-graph-benches]
- 20[hash-graph-integration]
- 21[hash-graph-test-data]
+ 15[hashql-ast]
+ 16[hashql-compiletest]
+ 17[hashql-eval]
+ 18[hashql-hir]
+ 19[hashql-mir]
+ 20[hashql-syntax-jexpr]
+ 21[hash-status]
+ 22[hash-telemetry]
+ 23[hash-temporal-client]
+ 24[error-stack]
+ 25[hash-graph-benches]
+ 26[hash-graph-integration]
+ 27[hash-graph-test-data]
0 --> 4
1 --> 10
- 1 -.-> 21
+ 1 -.-> 27
2 -.-> 3
2 --> 14
- 4 --> 8
+ 4 --> 17
+ 4 --> 20
5 --> 1
6 --> 7
- 6 --> 16
+ 6 --> 22
8 -.-> 6
8 --> 12
- 8 --> 15
+ 8 --> 21
9 --> 5
9 --> 11
- 9 --> 17
+ 9 --> 23
10 --> 2
- 11 -.-> 21
- 12 -.-> 21
+ 11 -.-> 27
+ 12 -.-> 27
14 -.-> 13
14 --> 13
- 14 --> 18
- 16 --> 18
- 17 --> 1
- 19 -.-> 4
- 20 -.-> 8
- 21 --> 9
+ 14 --> 24
+ 15 -.-> 16
+ 16 --> 17
+ 16 --> 20
+ 16 --> 24
+ 17 --> 8
+ 17 --> 19
+ 18 -.-> 16
+ 19 --> 18
+ 20 --> 15
+ 22 --> 24
+ 23 --> 1
+ 25 -.-> 4
+ 26 -.-> 8
+ 27 --> 9
diff --git a/libs/@local/graph/postgres-store/src/store/postgres/query/expression/conditional.rs b/libs/@local/graph/postgres-store/src/store/postgres/query/expression/conditional.rs
index 38b7cdf10e4..5845722d49d 100644
--- a/libs/@local/graph/postgres-store/src/store/postgres/query/expression/conditional.rs
+++ b/libs/@local/graph/postgres-store/src/store/postgres/query/expression/conditional.rs
@@ -208,6 +208,7 @@ pub enum PostgresType {
Numeric,
Int,
BigInt,
+ Boolean,
}
impl Transpile for PostgresType {
@@ -225,6 +226,7 @@ impl Transpile for PostgresType {
Self::Numeric => fmt.write_str("numeric"),
Self::Int => fmt.write_str("int"),
Self::BigInt => fmt.write_str("bigint"),
+ Self::Boolean => fmt.write_str("boolean"),
}
}
}
diff --git a/libs/@local/graph/store/docs/dependency-diagram.mmd b/libs/@local/graph/store/docs/dependency-diagram.mmd
index 9b9535b348f..9befe6246fe 100644
--- a/libs/@local/graph/store/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/store/docs/dependency-diagram.mmd
@@ -40,7 +40,6 @@ graph TD
1 -.-> 25
2 -.-> 3
2 --> 14
- 4 --> 6
4 --> 9
4 --> 12
4 --> 17
@@ -61,11 +60,10 @@ graph TD
14 --> 22
15 -.-> 16
16 --> 17
- 16 --> 19
16 --> 20
16 --> 22
- 17 --> 7
- 17 --> 18
+ 17 --> 6
+ 17 --> 19
18 -.-> 16
19 --> 18
20 --> 15
diff --git a/libs/@local/graph/temporal-versioning/docs/dependency-diagram.mmd b/libs/@local/graph/temporal-versioning/docs/dependency-diagram.mmd
index 9876628820a..4a62d2f471c 100644
--- a/libs/@local/graph/temporal-versioning/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/temporal-versioning/docs/dependency-diagram.mmd
@@ -40,7 +40,6 @@ graph TD
1 -.-> 25
2 -.-> 3
2 --> 14
- 4 --> 6
4 --> 9
4 --> 12
4 --> 17
@@ -61,11 +60,10 @@ graph TD
14 --> 22
15 -.-> 16
16 --> 17
- 16 --> 19
16 --> 20
16 --> 22
- 17 --> 7
- 17 --> 18
+ 17 --> 6
+ 17 --> 19
18 -.-> 16
19 --> 18
20 --> 15
diff --git a/libs/@local/graph/test-server/docs/dependency-diagram.mmd b/libs/@local/graph/test-server/docs/dependency-diagram.mmd
index 87719d33cc2..713da84c791 100644
--- a/libs/@local/graph/test-server/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/test-server/docs/dependency-diagram.mmd
@@ -56,7 +56,6 @@ graph TD
1 -.-> 41
2 -.-> 3
2 --> 23
- 4 --> 8
4 --> 12
4 --> 13
4 --> 19
@@ -93,15 +92,14 @@ graph TD
23 --> 40
24 -.-> 25
25 --> 28
- 25 --> 31
25 --> 32
25 --> 40
26 --> 2
26 --> 27
26 --> 30
26 -.-> 37
- 28 --> 9
- 28 --> 29
+ 28 --> 8
+ 28 --> 31
29 -.-> 25
31 --> 29
32 --> 24
diff --git a/libs/@local/graph/types/docs/dependency-diagram.mmd b/libs/@local/graph/types/docs/dependency-diagram.mmd
index 9c9b23b28eb..1ad837b1d54 100644
--- a/libs/@local/graph/types/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/types/docs/dependency-diagram.mmd
@@ -40,7 +40,6 @@ graph TD
1 -.-> 25
2 -.-> 3
2 --> 14
- 4 --> 6
4 --> 9
4 --> 12
4 --> 17
@@ -61,11 +60,10 @@ graph TD
14 --> 22
15 -.-> 16
16 --> 17
- 16 --> 19
16 --> 20
16 --> 22
- 17 --> 7
- 17 --> 18
+ 17 --> 6
+ 17 --> 19
18 -.-> 16
19 --> 18
20 --> 15
diff --git a/libs/@local/graph/validation/docs/dependency-diagram.mmd b/libs/@local/graph/validation/docs/dependency-diagram.mmd
index e0c53cf7b83..a7ea48b3400 100644
--- a/libs/@local/graph/validation/docs/dependency-diagram.mmd
+++ b/libs/@local/graph/validation/docs/dependency-diagram.mmd
@@ -22,29 +22,45 @@ graph TD
class 10 root
11[harpc-types]
12[harpc-wire-protocol]
- 13[hash-temporal-client]
- 14[error-stack]
- 15[hash-graph-benches]
- 16[hash-graph-integration]
- 17[hash-graph-test-data]
+ 13[hashql-ast]
+ 14[hashql-compiletest]
+ 15[hashql-eval]
+ 16[hashql-hir]
+ 17[hashql-mir]
+ 18[hashql-syntax-jexpr]
+ 19[hash-temporal-client]
+ 20[error-stack]
+ 21[hash-graph-benches]
+ 22[hash-graph-integration]
+ 23[hash-graph-test-data]
0 --> 4
1 --> 8
- 1 -.-> 17
+ 1 -.-> 23
2 -.-> 3
2 --> 12
- 4 --> 6
+ 4 --> 15
+ 4 --> 18
5 --> 1
6 --> 10
7 --> 5
7 --> 9
- 7 --> 13
+ 7 --> 19
8 --> 2
- 9 -.-> 17
- 10 -.-> 17
+ 9 -.-> 23
+ 10 -.-> 23
12 -.-> 11
12 --> 11
- 12 --> 14
- 13 --> 1
- 15 -.-> 4
- 16 -.-> 6
- 17 --> 7
+ 12 --> 20
+ 13 -.-> 14
+ 14 --> 15
+ 14 --> 18
+ 14 --> 20
+ 15 --> 6
+ 15 --> 17
+ 16 -.-> 14
+ 17 --> 16
+ 18 --> 13
+ 19 --> 1
+ 21 -.-> 4
+ 22 -.-> 6
+ 23 --> 7
diff --git a/libs/@local/harpc/types/docs/dependency-diagram.mmd b/libs/@local/harpc/types/docs/dependency-diagram.mmd
index b576dfff075..a33077303be 100644
--- a/libs/@local/harpc/types/docs/dependency-diagram.mmd
+++ b/libs/@local/harpc/types/docs/dependency-diagram.mmd
@@ -43,7 +43,6 @@ graph TD
1 --> 7
1 -.-> 29
2 --> 18
- 3 --> 5
3 --> 8
3 --> 14
3 --> 22
@@ -71,11 +70,10 @@ graph TD
18 --> 17
19 -.-> 20
20 --> 22
- 20 --> 24
20 --> 25
21 --> 2
- 22 --> 6
- 22 --> 23
+ 22 --> 5
+ 22 --> 24
23 -.-> 20
24 --> 23
25 --> 19
diff --git a/libs/@local/harpc/wire-protocol/docs/dependency-diagram.mmd b/libs/@local/harpc/wire-protocol/docs/dependency-diagram.mmd
index 84f5eafd4fb..eb86da026a0 100644
--- a/libs/@local/harpc/wire-protocol/docs/dependency-diagram.mmd
+++ b/libs/@local/harpc/wire-protocol/docs/dependency-diagram.mmd
@@ -43,7 +43,6 @@ graph TD
1 --> 7
1 -.-> 29
2 --> 17
- 3 --> 5
3 --> 8
3 --> 13
3 --> 21
@@ -69,12 +68,11 @@ graph TD
17 --> 26
18 -.-> 19
19 --> 21
- 19 --> 23
19 --> 24
19 --> 26
20 --> 2
- 21 --> 6
- 21 --> 22
+ 21 --> 5
+ 21 --> 23
22 -.-> 19
23 --> 22
24 --> 18
diff --git a/libs/@local/hashql/ast/docs/dependency-diagram.mmd b/libs/@local/hashql/ast/docs/dependency-diagram.mmd
index 507aad89755..8ea54320abf 100644
--- a/libs/@local/hashql/ast/docs/dependency-diagram.mmd
+++ b/libs/@local/hashql/ast/docs/dependency-diagram.mmd
@@ -14,63 +14,75 @@ graph TD
3[hash-codegen]
4[hash-graph-api]
5[hash-graph-authorization]
- 6[hash-graph-store]
- 7[hash-graph-temporal-versioning]
- 8[hash-graph-types]
- 9[harpc-types]
- 10[harpc-wire-protocol]
- 11[hashql-ast]
- class 11 root
- 12[hashql-compiletest]
- 13[hashql-core]
- 14[hashql-diagnostics]
- 15[hashql-eval]
- 16[hashql-hir]
- 17[hashql-macros]
- 18[hashql-mir]
- 19[hashql-syntax-jexpr]
- 20[hash-temporal-client]
- 21[darwin-kperf]
- 22[darwin-kperf-criterion]
- 23[darwin-kperf-events]
- 24[darwin-kperf-sys]
- 25[error-stack]
- 26[hash-graph-benches]
- 27[hash-graph-test-data]
+ 6[hash-graph-migrations]
+ 7[hash-graph-migrations-macros]
+ 8[hash-graph-postgres-store]
+ 9[hash-graph-store]
+ 10[hash-graph-temporal-versioning]
+ 11[hash-graph-types]
+ 12[hash-graph-validation]
+ 13[harpc-types]
+ 14[harpc-wire-protocol]
+ 15[hashql-ast]
+ class 15 root
+ 16[hashql-compiletest]
+ 17[hashql-core]
+ 18[hashql-diagnostics]
+ 19[hashql-eval]
+ 20[hashql-hir]
+ 21[hashql-macros]
+ 22[hashql-mir]
+ 23[hashql-syntax-jexpr]
+ 24[hash-status]
+ 25[hash-telemetry]
+ 26[hash-temporal-client]
+ 27[darwin-kperf]
+ 28[darwin-kperf-criterion]
+ 29[darwin-kperf-events]
+ 30[darwin-kperf-sys]
+ 31[error-stack]
+ 32[hash-graph-benches]
+ 33[hash-graph-test-data]
0 --> 4
- 1 --> 7
- 1 -.-> 27
+ 1 --> 10
+ 1 -.-> 33
2 -.-> 3
- 2 --> 10
- 4 --> 15
+ 2 --> 14
4 --> 19
+ 4 --> 23
5 --> 1
- 6 --> 5
- 6 --> 8
- 6 --> 20
- 7 --> 2
- 8 -.-> 27
- 10 -.-> 9
- 10 --> 9
- 10 --> 25
- 11 -.-> 12
- 12 --> 15
- 12 --> 18
- 12 --> 19
- 12 --> 25
- 13 --> 2
- 13 --> 14
- 13 --> 17
- 13 -.-> 22
- 15 --> 6
- 15 --> 16
- 16 -.-> 12
- 18 --> 16
- 19 --> 11
- 19 --> 13
- 20 --> 1
- 21 --> 23
- 21 --> 24
- 22 --> 21
- 26 -.-> 4
- 27 --> 6
+ 6 --> 7
+ 6 --> 25
+ 8 -.-> 6
+ 8 --> 12
+ 8 --> 24
+ 9 --> 5
+ 9 --> 11
+ 9 --> 26
+ 10 --> 2
+ 11 -.-> 33
+ 12 -.-> 33
+ 14 -.-> 13
+ 14 --> 13
+ 14 --> 31
+ 15 -.-> 16
+ 16 --> 19
+ 16 --> 23
+ 16 --> 31
+ 17 --> 2
+ 17 --> 18
+ 17 --> 21
+ 17 -.-> 28
+ 19 --> 8
+ 19 --> 22
+ 20 -.-> 16
+ 22 --> 20
+ 23 --> 15
+ 23 --> 17
+ 25 --> 31
+ 26 --> 1
+ 27 --> 29
+ 27 --> 30
+ 28 --> 27
+ 32 -.-> 4
+ 33 --> 9
diff --git a/libs/@local/hashql/compiletest/docs/dependency-diagram.mmd b/libs/@local/hashql/compiletest/docs/dependency-diagram.mmd
index 4bb0c89cd24..f589b3979ef 100644
--- a/libs/@local/hashql/compiletest/docs/dependency-diagram.mmd
+++ b/libs/@local/hashql/compiletest/docs/dependency-diagram.mmd
@@ -14,63 +14,75 @@ graph TD
3[hash-codegen]
4[hash-graph-api]
5[hash-graph-authorization]
- 6[hash-graph-store]
- 7[hash-graph-temporal-versioning]
- 8[hash-graph-types]
- 9[harpc-types]
- 10[harpc-wire-protocol]
- 11[hashql-ast]
- 12[hashql-compiletest]
- class 12 root
- 13[hashql-core]
- 14[hashql-diagnostics]
- 15[hashql-eval]
- 16[hashql-hir]
- 17[hashql-macros]
- 18[hashql-mir]
- 19[hashql-syntax-jexpr]
- 20[hash-temporal-client]
- 21[darwin-kperf]
- 22[darwin-kperf-criterion]
- 23[darwin-kperf-events]
- 24[darwin-kperf-sys]
- 25[error-stack]
- 26[hash-graph-benches]
- 27[hash-graph-test-data]
+ 6[hash-graph-migrations]
+ 7[hash-graph-migrations-macros]
+ 8[hash-graph-postgres-store]
+ 9[hash-graph-store]
+ 10[hash-graph-temporal-versioning]
+ 11[hash-graph-types]
+ 12[hash-graph-validation]
+ 13[harpc-types]
+ 14[harpc-wire-protocol]
+ 15[hashql-ast]
+ 16[hashql-compiletest]
+ class 16 root
+ 17[hashql-core]
+ 18[hashql-diagnostics]
+ 19[hashql-eval]
+ 20[hashql-hir]
+ 21[hashql-macros]
+ 22[hashql-mir]
+ 23[hashql-syntax-jexpr]
+ 24[hash-status]
+ 25[hash-telemetry]
+ 26[hash-temporal-client]
+ 27[darwin-kperf]
+ 28[darwin-kperf-criterion]
+ 29[darwin-kperf-events]
+ 30[darwin-kperf-sys]
+ 31[error-stack]
+ 32[hash-graph-benches]
+ 33[hash-graph-test-data]
0 --> 4
- 1 --> 7
- 1 -.-> 27
+ 1 --> 10
+ 1 -.-> 33
2 -.-> 3
- 2 --> 10
- 4 --> 15
+ 2 --> 14
4 --> 19
+ 4 --> 23
5 --> 1
- 6 --> 5
- 6 --> 8
- 6 --> 20
- 7 --> 2
- 8 -.-> 27
- 10 -.-> 9
- 10 --> 9
- 10 --> 25
- 11 -.-> 12
- 12 --> 15
- 12 --> 18
- 12 --> 19
- 12 --> 25
- 13 --> 2
- 13 --> 14
- 13 --> 17
- 13 -.-> 22
- 15 --> 6
- 15 --> 16
- 16 -.-> 12
- 18 --> 16
- 19 --> 11
- 19 --> 13
- 20 --> 1
- 21 --> 23
- 21 --> 24
- 22 --> 21
- 26 -.-> 4
- 27 --> 6
+ 6 --> 7
+ 6 --> 25
+ 8 -.-> 6
+ 8 --> 12
+ 8 --> 24
+ 9 --> 5
+ 9 --> 11
+ 9 --> 26
+ 10 --> 2
+ 11 -.-> 33
+ 12 -.-> 33
+ 14 -.-> 13
+ 14 --> 13
+ 14 --> 31
+ 15 -.-> 16
+ 16 --> 19
+ 16 --> 23
+ 16 --> 31
+ 17 --> 2
+ 17 --> 18
+ 17 --> 21
+ 17 -.-> 28
+ 19 --> 8
+ 19 --> 22
+ 20 -.-> 16
+ 22 --> 20
+ 23 --> 15
+ 23 --> 17
+ 25 --> 31
+ 26 --> 1
+ 27 --> 29
+ 27 --> 30
+ 28 --> 27
+ 32 -.-> 4
+ 33 --> 9
diff --git a/libs/@local/hashql/compiletest/src/lib.rs b/libs/@local/hashql/compiletest/src/lib.rs
index 3aadcb739e6..d800d042cb8 100644
--- a/libs/@local/hashql/compiletest/src/lib.rs
+++ b/libs/@local/hashql/compiletest/src/lib.rs
@@ -7,6 +7,7 @@
if_let_guard,
// Library Features
+ allocator_api,
assert_matches,
duration_millis_float,
exitcode_exit_method,
diff --git a/libs/@local/hashql/compiletest/src/suite/eval_postgres.rs b/libs/@local/hashql/compiletest/src/suite/eval_postgres.rs
new file mode 100644
index 00000000000..496d237f8a0
--- /dev/null
+++ b/libs/@local/hashql/compiletest/src/suite/eval_postgres.rs
@@ -0,0 +1,206 @@
+use core::{alloc::Allocator, fmt::Write as _};
+
+use hashql_ast::node::expr::Expr;
+use hashql_core::{
+ heap::ResetAllocator as _,
+ pretty::Formatter,
+ r#type::{TypeFormatter, TypeFormatterOptions, environment::Environment},
+};
+use hashql_diagnostics::DiagnosticIssues;
+use hashql_eval::{context::EvalContext, postgres::PostgresCompiler};
+use hashql_mir::{
+ body::{Body, basic_block::BasicBlockId, terminator::TerminatorKind},
+ context::MirContext,
+ def::DefIdSlice,
+ intern::Interner,
+ pass::{
+ GlobalAnalysisPass as _,
+ analysis::SizeEstimationAnalysis,
+ execution::{ExecutionAnalysis, ExecutionAnalysisResidual, TargetId},
+ },
+ pretty::{TextFormatAnnotations, TextFormatOptions},
+};
+
+use super::{
+ RunContext, Suite, SuiteDiagnostic,
+ common::{Header, process_issues},
+ mir_pass_transform_post_inline::mir_pass_transform_post_inline,
+};
+
+/// Annotates each basic block with its execution target (Postgres / Interpreter / Embedding).
+struct PlacementAnnotation<'ctx, A: Allocator> {
+ /// The residual for the body currently being formatted, if it has one.
+ current: Option<&'ctx ExecutionAnalysisResidual>,
+}
+
+impl TextFormatAnnotations for PlacementAnnotation<'_, A> {
+ type BasicBlockAnnotation<'this, 'heap>
+ = &'static str
+ where
+ Self: 'this;
+
+ fn annotate_basic_block<'heap>(
+ &self,
+ id: BasicBlockId,
+ _block: &hashql_mir::body::basic_block::BasicBlock<'heap>,
+ ) -> Option> {
+ let residual = self.current?;
+ let target = residual.assignment.get(id)?;
+
+ Some(match *target {
+ TargetId::Interpreter => "interpreter",
+ TargetId::Postgres => "postgres",
+ TargetId::Embedding => "embedding",
+ })
+ }
+}
+
+pub(crate) struct EvalPostgres;
+
+impl Suite for EvalPostgres {
+ fn name(&self) -> &'static str {
+ "eval/postgres"
+ }
+
+ fn description(&self) -> &'static str {
+ "PostgreSQL query compilation from MIR"
+ }
+
+ fn secondary_file_extensions(&self) -> &[&str] {
+ &["mir"]
+ }
+
+ fn run<'heap>(
+ &self,
+ RunContext {
+ heap,
+ diagnostics,
+ secondary_outputs,
+ ..
+ }: RunContext<'_, 'heap>,
+ expr: Expr<'heap>,
+ ) -> Result {
+ let mut environment = Environment::new(heap);
+ let interner = Interner::new(heap);
+
+ let (_, mut bodies, mut scratch) = mir_pass_transform_post_inline(
+ heap,
+ expr,
+ &interner,
+ (),
+ &mut environment,
+ diagnostics,
+ )?;
+
+ let mut context = MirContext {
+ heap,
+ env: &environment,
+ interner: &interner,
+ diagnostics: DiagnosticIssues::new(),
+ };
+
+ let mut size_estimation_analysis = SizeEstimationAnalysis::new_in(&scratch);
+ size_estimation_analysis.run(&mut context, &bodies);
+ let footprints = size_estimation_analysis.finish();
+ scratch.reset();
+
+ let analysis = ExecutionAnalysis {
+ footprints: &footprints,
+ scratch: &mut scratch,
+ };
+ let analysis = analysis.run_all_in(&mut context, &mut bodies, heap);
+ scratch.reset();
+
+ process_issues(diagnostics, context.diagnostics)?;
+
+ // Capture MIR after execution analysis with block placement annotations.
+ let mir_buf = format_mir_with_placement(heap, &environment, &bodies, &analysis);
+ secondary_outputs.insert("mir", mir_buf);
+
+ let mut context =
+ EvalContext::new_in(&environment, &bodies, &analysis, context.heap, &mut scratch);
+ scratch.reset();
+
+ // Inside of **all** the bodies, find the `GraphRead` terminators to compile.
+ let mut prepared_queries = Vec::new();
+ let mut compiler = PostgresCompiler::new_in(&mut context, &mut scratch);
+
+ for body in &bodies {
+ for block in &*body.basic_blocks {
+ if let TerminatorKind::GraphRead(read) = &block.terminator.kind {
+ let prepared_query = compiler.compile(read);
+ prepared_queries.push(prepared_query);
+ }
+ }
+ }
+
+ scratch.reset();
+ process_issues(diagnostics, context.diagnostics)?;
+
+ let mut output = String::new();
+
+ for (index, query) in prepared_queries.iter().enumerate() {
+ if index > 0 {
+ let _ = writeln!(output);
+ }
+
+ let sql = query.transpile().to_string();
+
+ let _ = writeln!(output, "{}\n\n{sql}", Header::new("SQL"));
+
+ if !query.parameters.is_empty() {
+ let _ = writeln!(
+ output,
+ "\n{}\n\n{}",
+ Header::new("Parameters"),
+ query.parameters
+ );
+ }
+ }
+
+ Ok(output)
+ }
+}
+
+fn format_mir_with_placement<'heap, A: Allocator>(
+ heap: &'heap hashql_core::heap::Heap,
+ env: &Environment<'heap>,
+ bodies: &DefIdSlice>,
+ analysis: &DefIdSlice