Skip to content

Commit

Permalink
fix case 2303
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 authored and andyfengHKU committed Nov 20, 2023
1 parent c35d346 commit 77cf243
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/storage/local_storage/local_rel_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool RegularRelNGInfo::delete_(offset_t srcNodeOffset, offset_t /*relOffset*/) {
void CSRRelNGInfo::insert(offset_t srcNodeOffset, offset_t relOffset, row_idx_t adjNodeRowIdx,
const std::vector<row_idx_t>& propertyNodesRowIdx) {
KU_ASSERT(propertyNodesRowIdx.size() == insertInfoPerChunk.size());
if (deleteInfo.contains(srcNodeOffset) && !contains(deleteInfo.at(srcNodeOffset), relOffset)) {
if (deleteInfo.contains(srcNodeOffset) && contains(deleteInfo.at(srcNodeOffset), relOffset)) {
// We choose to ignore the insert operation if the node is deleted.
return;
}
Expand All @@ -81,7 +81,7 @@ void CSRRelNGInfo::update(
offset_t srcNodeOffset, offset_t relOffset, column_id_t columnID, row_idx_t rowIdx) {
// REL_ID_COLUMN_ID is immutable.
KU_ASSERT(columnID != REL_ID_COLUMN_ID && columnID < updateInfoPerChunk.size());
if (deleteInfo.contains(srcNodeOffset) && !contains(deleteInfo.at(srcNodeOffset), relOffset)) {
if (deleteInfo.contains(srcNodeOffset) && contains(deleteInfo.at(srcNodeOffset), relOffset)) {
// We choose to ignore the update operation if the node is deleted.
return;
}
Expand Down
27 changes: 27 additions & 0 deletions test/test_files/issue/issue.test
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,30 @@ Runtime exception: Found duplicated primary key value rename 2x, which violates
-STATEMENT OPTIONAL MATCH (a)-[b:KNOWS]->(c) return a,b,c;
---- 1
||

-CASE 2303
-STATEMENT CREATE NODE TABLE T (id STRING, PRIMARY KEY(id));
---- ok
-STATEMENT CREATE REL TABLE AFTER (FROM T TO T, id STRING);
---- ok
-STATEMENT CREATE (t1:T {id: "t1"})-[e1:AFTER {id: "e1"}]->(t2:T {id: "t2"})-[e2:AFTER {id: "e2"}]->(t3:T {id: "t3"}),
(t4:T {id: "t4"})-[e3:AFTER {id: "e3"}]->(t5:T {id: "t5"})-[e4:AFTER {id: "e4"}]->(t6:T {id: "t6"})-[e5:AFTER {id: "e5"}]->(t7:T {id: "t7"})
---- ok
-STATEMENT MATCH p = (a:T {id:"t4"})-[e*]->(b:T {id:"t7"}) RETURN COUNT(*);
---- 1
1
-STATEMENT MATCH (s:T {id: "t2"}), (a:T {id: "t6"}),
(t1:T)-[e1:AFTER]->(s),
(s)-[e2:AFTER]->(t3:T),
(t5:T)-[e4:AFTER]->(a)
DELETE e1,e2,e4
CREATE (s)-[e7:AFTER]->(a)
CREATE (t1)-[e8:AFTER]->(t3)
CREATE (t5)-[e9:AFTER]->(s);
---- ok
-STATEMENT MATCH (a)-[e]->(b) RETURN COUNT(*);
---- 1
5
-STATEMENT MATCH p = (a:T {id:"t4"})-[e*]->(b:T {id:"t7"}) RETURN COUNT(*);
---- 1
1

0 comments on commit 77cf243

Please sign in to comment.