Skip to content

Commit

Permalink
Merge pull request #169 from cwida/issue/146-syntax-error-at-or-near
Browse files Browse the repository at this point in the history
Allow kleene star without a space
  • Loading branch information
Dtenwolde authored Nov 26, 2024
2 parents 1500f5c + c163016 commit 37ff39c
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 3 deletions.
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"

0 comments on commit 37ff39c

Please sign in to comment.