gqlite 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/Cargo.toml +8 -8
- data/ext/gqlitedb/Cargo.toml +0 -2
- data/ext/gqlitedb/src/compiler/variables_manager.rs +109 -10
- data/ext/gqlitedb/src/compiler.rs +481 -47
- data/ext/gqlitedb/src/connection.rs +12 -0
- data/ext/gqlitedb/src/consts.rs +1 -1
- data/ext/gqlitedb/src/error.rs +24 -0
- data/ext/gqlitedb/src/interpreter/evaluators.rs +91 -325
- data/ext/gqlitedb/src/interpreter/instructions.rs +72 -0
- data/ext/gqlitedb/src/interpreter/mod.rs +1 -0
- data/ext/gqlitedb/src/interpreter/path/bfs.rs +494 -0
- data/ext/gqlitedb/src/interpreter/path/dfs.rs +267 -0
- data/ext/gqlitedb/src/interpreter/path/group.rs +418 -0
- data/ext/gqlitedb/src/interpreter/path.rs +542 -0
- data/ext/gqlitedb/src/planner.rs +218 -6
- data/ext/gqlitedb/src/query_result.rs +19 -4
- data/ext/gqlitedb/src/tests/compiler.rs +2453 -1
- data/ext/gqlitedb/src/tests/connection/redb.rs +8 -0
- data/ext/gqlitedb/src/tests/connection.rs +37 -0
- data/ext/gqlitedb/src/tests/evaluators.rs +2206 -1
- data/ext/gqlitedb/src/tests/parser.rs +1225 -0
- data/ext/gqlitedb/src/tests/planner.rs +432 -2
- data/ext/gqlitedb/src/tests/store/vector_index/postgres.rs +5 -5
- data/ext/gqlitedb/src/tests/store/vector_index/sqlite.rs +3 -1
- data/ext/gqlitedb/src/tests/templates/ast.rs +284 -1
- data/ext/gqlitedb/src/tests/templates/programs.rs +306 -0
- data/ext/gqliterb/Cargo.toml +0 -1
- data/ext/gqlparser/src/oc/ast.rs +52 -3
- data/ext/gqlparser/src/oc/error.rs +18 -0
- data/ext/gqlparser/src/oc/lexer.rs +146 -0
- data/ext/gqlparser/src/oc/parser/tests.rs +365 -20
- data/ext/gqlparser/src/oc/parser.rs +1196 -143
- data/ext/graphcore/src/value.rs +12 -1
- metadata +5 -2
- data/ext/gqlitedb/src/parser/gql.pest +0 -198
|
@@ -37,3 +37,11 @@ fn test_count_distinct_end_to_end()
|
|
|
37
37
|
let connection = builder.create().unwrap();
|
|
38
38
|
super::test_count_distinct_end_to_end(connection);
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
#[test]
|
|
42
|
+
fn test_shortest_with_explicit_minimum_hop_count()
|
|
43
|
+
{
|
|
44
|
+
let builder = crate::Connection::builder().backend(crate::Backend::Redb);
|
|
45
|
+
let connection = builder.create().unwrap();
|
|
46
|
+
super::test_shortest_with_explicit_minimum_hop_count(connection);
|
|
47
|
+
}
|
|
@@ -141,3 +141,40 @@ fn test_count_distinct_end_to_end(connection: crate::Connection)
|
|
|
141
141
|
let count: i64 = table.value(0, 0).unwrap().try_into().unwrap();
|
|
142
142
|
assert_eq!(count, 3, "should count distinct friends");
|
|
143
143
|
}
|
|
144
|
+
|
|
145
|
+
fn test_shortest_with_explicit_minimum_hop_count(connection: crate::Connection)
|
|
146
|
+
{
|
|
147
|
+
connection
|
|
148
|
+
.execute_oc_query(
|
|
149
|
+
r#"
|
|
150
|
+
CREATE (a:Station {name: 'A'}),
|
|
151
|
+
(x:Station {name: 'X'}),
|
|
152
|
+
(d:Station {name: 'D'}),
|
|
153
|
+
(a)-[:LINK]->(d),
|
|
154
|
+
(a)-[:LINK]->(x),
|
|
155
|
+
(x)-[:LINK]->(d)
|
|
156
|
+
"#,
|
|
157
|
+
Default::default(),
|
|
158
|
+
)
|
|
159
|
+
.unwrap();
|
|
160
|
+
|
|
161
|
+
let result = connection
|
|
162
|
+
.execute_oc_query(
|
|
163
|
+
r#"MATCH p = SHORTEST 1 (a:Station {name: 'A'})-[:LINK*2..4]->(d:Station {name: 'D'}) RETURN length(p) AS len"#,
|
|
164
|
+
Default::default(),
|
|
165
|
+
)
|
|
166
|
+
.unwrap();
|
|
167
|
+
|
|
168
|
+
let table = result.try_into_table().unwrap();
|
|
169
|
+
assert_eq!(
|
|
170
|
+
table.rows(),
|
|
171
|
+
1,
|
|
172
|
+
"should find exactly one path with min_hops=2, got {} rows",
|
|
173
|
+
table.rows()
|
|
174
|
+
);
|
|
175
|
+
let len: i64 = table.value(0, 0).unwrap().try_into().unwrap();
|
|
176
|
+
assert_eq!(
|
|
177
|
+
len, 2,
|
|
178
|
+
"should return path of length 2 (A->X->D), not the direct 1-hop edge (A->D)"
|
|
179
|
+
);
|
|
180
|
+
}
|