Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow kleene star without a space #169

Merged
merged 12 commits into from
Nov 26, 2024
2 changes: 1 addition & 1 deletion .github/workflows/_extension_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
cd duckdb
git checkout ${{ inputs.duckdb_version }}

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.extension_name }}-${{ inputs.duckdb_version }}-extension-${{matrix.duckdb_arch}}${{inputs.artifact_postfix}}${{startsWith(matrix.duckdb, 'wasm') && '.wasm' || ''}}
path: |
Expand Down
116 changes: 116 additions & 0 deletions test/sql/path_finding/kleene_star.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
require duckpgq

statement ok
CREATE TABLE nodes (id INTEGER);

statement ok
CREATE TABLE edges (src INTEGER, dst INTEGER);

statement ok
INSERT INTO nodes VALUES (1), (2), (3);

statement ok
-CREATE PROPERTY GRAPH testgraph
VERTEX TABLES (
nodes LABEL N
)
EDGE TABLES (
edges SOURCE KEY (src) REFERENCES nodes (id)
DESTINATION KEY (dst) REFERENCES nodes (id)
LABEL E
);

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->*(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
1 1 [0] [] 0
2 2 [1] [] 0
3 3 [2] [] 0

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->+(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{1,3}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{0,3}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
1 1 [0] [] 0
2 2 [1] [] 0
3 3 [2] [] 0

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{,3}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
1 1 [0] [] 0
2 2 [1] [] 0
3 3 [2] [] 0


statement error
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)*<-[e:E]->(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
Parser Error: PGQ expected an arrow instead of *< operator. at or near "*<"

statement error
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)*-[e:E]->(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
Parser Error: syntax error at or near "*"

statement error
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{3,1}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
Constraint Error: Lower bound greater than upper bound

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{,}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
1 1 [0] [] 0
2 2 [1] [] 0
3 3 [2] [] 0

query IIIII
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->{1,1}(n2:N)
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----

statement error
-FROM GRAPH_TABLE(testgraph
MATCH p = ANY SHORTEST (n1:N)-[e:E]->*(n2:N
COLUMNS (n1.id, n2.id, element_id(p), edges(p) AS path_edges, path_length(p))
);
----
Parser Error: syntax error at or near "COLUMNS"

Loading