Skip to content

Commit

Permalink
Find table by table name now, updated error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Nov 27, 2024
1 parent a7cb003 commit 1a5621f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/core/utils/duckpgq_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ CreatePropertyGraphInfo* GetPropertyGraphInfo(const shared_ptr<DuckPGQState> &du

// Function to validate the source node and edge table
shared_ptr<PropertyGraphTable> ValidateSourceNodeAndEdgeTable(CreatePropertyGraphInfo *pg_info, const std::string &node_label, const std::string &edge_label) {
auto source_node_pg_entry = pg_info->GetTable(node_label, true, true);
auto source_node_pg_entry = pg_info->GetTableByLabel(node_label, true, true);
if (!source_node_pg_entry->is_vertex_table) {
throw Exception(ExceptionType::INVALID, node_label + " is an edge table, expected a vertex table");
}
auto edge_pg_entry = pg_info->GetTable(edge_label, true, false);
auto edge_pg_entry = pg_info->GetTableByLabel(edge_label, true, false);
if (edge_pg_entry->is_vertex_table) {
throw Exception(ExceptionType::INVALID, edge_label + " is a vertex table, expected an edge table");
}
Expand Down
2 changes: 1 addition & 1 deletion test/sql/create_pg/create_pg_with_pk_fk.test
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ statement error
vertex tables (v)
edge tables (e2 source v destination w);
----
Invalid Error: Referenced vertex table w is not registered in the vertex tables
Invalid Error: Table 'w' not found in the property graph g.

statement ok
-create property graph g
Expand Down
7 changes: 3 additions & 4 deletions test/sql/create_pg/create_property_graph.test
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ EDGE TABLES (
PROPERTIES ( createDate ) LABEL Knows
)
----
Invalid Error: Referenced vertex table Student is not registered in the vertex tables.

Invalid Error: Table 'Student' not found in the property graph pg3.

# Should fail since the edge table references vertex tables that do not exist
statement error
Expand All @@ -157,12 +156,12 @@ VERTEX TABLES (
School LABEL School IN School_kind (Hogeschool, University)
)
EDGE TABLES (
know SOURCE KEY ( src ) REFERENCES Student ( id )
know SOURCE KEY ( src ) REFERENCES School ( school_id )
DESTINATION KEY ( dst ) REFERENCES Student__ ( id )
PROPERTIES ( createDate ) LABEL Knows
);
----
Invalid Error: Referenced vertex table Student is not registered in the vertex tables.
Invalid Error: Table 'Student__' not found in the property graph pg3.


# Check duplicate labels
Expand Down
20 changes: 10 additions & 10 deletions test/sql/path_finding/subpath_match.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ FROM GRAPH_TABLE (pg
----
0 Daniel

#query II
#-SELECT study.a_id, study.b_id
#FROM GRAPH_TABLE (pg
# MATCH
# (a:Person)-[k:Knows WHERE k.id = 10]->(b:Person)
# COLUMNS (a.id as a_id, b.id as b_id)
# ) study
#----
#0 1
#
query II
-SELECT study.a_id, study.b_id
FROM GRAPH_TABLE (pg
MATCH
(a:Person)-[k:Knows WHERE k.id = 10]->(b:Person)
COLUMNS (a.id as a_id, b.id as b_id)
) study
----
0 1

#query II
#WITH cte1 AS (
# SELECT CREATE_CSR_EDGE(
Expand Down

0 comments on commit 1a5621f

Please sign in to comment.