Skip to content

Commit

Permalink
Delete csr when exception is thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Sep 3, 2024
1 parent b150079 commit f6e663b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/functions/scalar/csr_creation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ static void CreateCsrEdgeFunction(DataChunk &args, ExpressionState &state,
int64_t edge_size = args.data[2].GetValue(0).GetValue<int64_t>();
int64_t edge_size_count = args.data[3].GetValue(0).GetValue<int64_t>();
if (edge_size != edge_size_count) {
throw ConstraintException("Non-unique vertices detected. Make sure all vertices are unique for path-finding queries.");
duckpgq_state->csr_to_delete.insert(info.id);
throw ConstraintException("Non-unique vertices detected. Make sure all vertices are unique for path-finding queries.");
}

auto csr_entry = duckpgq_state->csr_list.find(info.id);
Expand Down
28 changes: 27 additions & 1 deletion test/sql/path_finding/non-unique-vertices.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ statement ok
COLUMNS (path_length(p), vertices(p), v2.x)
);

# ANY SHORTEST v-[e]-> +(v) fails with "INTERNAL Error: Attempted to access index 1 within vector of size 1"
## ANY SHORTEST v-[e]-> +(v) fails with "INTERNAL Error: Attempted to access index 1 within vector of size 1"
statement error
-FROM GRAPH_TABLE(g
MATCH p = ANY SHORTEST (v1:v)-[e:e]-> +(v2:v)
Expand All @@ -52,3 +52,29 @@ statement error
);
----
Constraint Error: Non-unique vertices detected. Make sure all vertices are unique for path-finding queries.

statement ok
CREATE TABLE v2 (x VARCHAR);INSERT INTO v2 VALUES ('a'), ('b'), ('c'), ('c'), ('b');

statement ok
CREATE TABLE e2 (x1 VARCHAR, x2 VARCHAR);INSERT INTO e2 VALUES ('a', 'b'), ('b', 'c');

statement ok
-CREATE PROPERTY GRAPH g2
VERTEX TABLES (
v2
)
EDGE TABLES (
e2
SOURCE KEY (x1) REFERENCES v2 (x)
DESTINATION KEY (x2) REFERENCES v2 (x)
);

# ANY SHORTEST v-[e]->{1,2}(v) also fails with "INTERNAL Error: Attempted to access index 1 within vector of size 1"
statement error
-FROM GRAPH_TABLE(g2
MATCH p = ANY SHORTEST (v1:v2)-[e:e2]->{1,2}(v2:v2)
COLUMNS (path_length(p), vertices(p), v2.x)
);
----
Constraint Error: Non-unique vertices detected. Make sure all vertices are unique for path-finding queries.

0 comments on commit f6e663b

Please sign in to comment.