Skip to content

Commit

Permalink
X
Browse files Browse the repository at this point in the history
  • Loading branch information
andyfengHKU committed Sep 11, 2023
1 parent 134ced4 commit 8858097
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
17 changes: 17 additions & 0 deletions src/binder/bind/bind_graph_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ std::vector<table_id_t> Binder::bindRelTableIDs(const std::vector<std::string>&
if (catalog.getReadOnlyVersion()->getRelTableIDs().empty()) {
throw BinderException("No rel table exists in database.");
}
// Rewrite empty rel pattern "-[]-" as all rel tables
std::unordered_set<table_id_t> tableIDs;
if (tableNames.empty()) {
for (auto tableID : catalog.getReadOnlyVersion()->getRelTableIDs()) {
Expand All @@ -474,5 +475,21 @@ std::vector<table_id_t> Binder::bindRelTableIDs(const std::vector<std::string>&
return result;
}

table_id_t Binder::bindRelTableID(const std::string& tableName) const {
auto catalogContent = catalog.getReadOnlyVersion();
auto errorMsg;
if (!catalogContent->containTable(tableName)) {
throw BinderException()
}
auto tableID = catalogContent->getTableID(tableName);
auto tableSchema = catalogContent.getT
if (!catalog.getReadOnlyVersion()->containRelTable(tableName)) {
throw BinderException("Rel table " + tableName + " does not exist.");
}
return catalog.getReadOnlyVersion()->getTableID(tableName);
}



} // namespace binder
} // namespace kuzu
6 changes: 0 additions & 6 deletions src/binder/binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ std::shared_ptr<Expression> Binder::bindWhereExpression(const ParsedExpression&
return whereExpression;
}

table_id_t Binder::bindRelTableID(const std::string& tableName) const {
if (!catalog.getReadOnlyVersion()->containRelTable(tableName)) {
throw BinderException("Rel table " + tableName + " does not exist.");
}
return catalog.getReadOnlyVersion()->getTableID(tableName);
}

table_id_t Binder::bindNodeTableID(const std::string& tableName) const {
if (!catalog.getReadOnlyVersion()->containNodeTable(tableName)) {
Expand Down
13 changes: 13 additions & 0 deletions test/test_files/tinysnb/rel_group/basic.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-GROUP RelGroupTest
-DATASET CSV tinysnb

--

-CASE RelGroupTest1
-STATEMENT CREATE REL TABLE GROUP likes (FROM person TO person, FROM person TO like)
---- ok
-STATEMENT MATCH (a:person) WHERE a.ID > 8 RETURN a.ID, a.gender,a.isStudent, a.isWorker, a.age, a.eyeSight
---- 3
10|2|False|True|83|4.900000
80|||True|22|1.100000
9|2|False|False|40|4.900000

0 comments on commit 8858097

Please sign in to comment.