Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rel-update bug #1258

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ struct ListsUpdatesForNodeOffset {
struct ListsUpdateInfo {
public:
ListsUpdateInfo(const std::shared_ptr<common::ValueVector>& propertyVector,
common::property_id_t propertyID, int64_t relID, uint64_t fwdListOffset,
common::property_id_t propertyID, common::offset_t relOffset, uint64_t fwdListOffset,
uint64_t bwdListOffset)
: propertyVector{propertyVector}, propertyID{propertyID}, relID{relID},
: propertyVector{propertyVector}, propertyID{propertyID}, relOffset{relOffset},
fwdListOffset{fwdListOffset}, bwdListOffset{bwdListOffset} {}

bool isStoredInPersistentStore() const { return fwdListOffset != -1 || bwdListOffset != -1; }

public:
std::shared_ptr<common::ValueVector> propertyVector;
common::property_id_t propertyID;
int64_t relID;
common::offset_t relOffset;
list_offset_t fwdListOffset;
list_offset_t bwdListOffset;
};
Expand Down
2 changes: 1 addition & 1 deletion src/storage/storage_structure/lists/lists_update_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void ListsUpdatesStore::updateRelIfNecessary(const std::shared_ptr<ValueVector>&
// transaction), we should update the factorizedTable entry for that newly inserted
// rel.
auto ftTupleIdx = ftOfInsertedRels->findValueInFlatColumn(
INTERNAL_REL_ID_IDX_IN_FT, listsUpdateInfo.relID);
INTERNAL_REL_ID_IDX_IN_FT, listsUpdateInfo.relOffset);
ftOfInsertedRels->updateFlatCell(ftOfInsertedRels->getTuple(ftTupleIdx),
propertyIDToColIdxMap.at(listsUpdateInfo.propertyID),
listsUpdateInfo.propertyVector.get(),
Expand Down
8 changes: 4 additions & 4 deletions src/storage/store/rel_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ void RelTable::updateRel(const std::shared_ptr<ValueVector>& srcNodeIDVector,
fwdRelTableData->updateRel(srcNodeIDVector, propertyID, propertyVector);
bwdRelTableData->updateRel(dstNodeIDVector, propertyID, propertyVector);
auto relID =
relIDVector->getValue<int64_t>(relIDVector->state->selVector->selectedPositions[0]);
ListsUpdateInfo listsUpdateInfo = ListsUpdateInfo{propertyVector, propertyID, relID,
fwdRelTableData->getListOffset(srcNode, relID),
bwdRelTableData->getListOffset(dstNode, relID)};
relIDVector->getValue<relID_t>(relIDVector->state->selVector->selectedPositions[0]);
ListsUpdateInfo listsUpdateInfo = ListsUpdateInfo{propertyVector, propertyID, relID.offset,
fwdRelTableData->getListOffset(srcNode, relID.offset),
bwdRelTableData->getListOffset(dstNode, relID.offset)};
listsUpdatesStore->updateRelIfNecessary(srcNodeIDVector, dstNodeIDVector, listsUpdateInfo);
}

Expand Down
5 changes: 5 additions & 0 deletions test/copy/copy_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@ TEST_F(CopyLargeListTest, AddPropertyWithLargeListTest) {
*conn->query("match (:person)-[e:knows]->(:person) return e.length"));
std::vector<std::string> expectedResult{10001, "50"};
ASSERT_EQ(actualResult, expectedResult);
ASSERT_TRUE(conn->query("match (:person)-[e:knows]->(:person) set e.length = 37")->isSuccess());
actualResult = TestHelper::convertResultToString(
*conn->query("match (p:person)-[e:knows]->(:person) return e.length"), true);
expectedResult = std::vector<std::string>{10001, "37"};
ASSERT_EQ(actualResult, expectedResult);
}

TEST_F(CopySpecialCharTest, CopySpecialChars) {
Expand Down