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 merge rel #1916

Merged
merged 1 commit into from
Aug 10, 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
5 changes: 5 additions & 0 deletions src/include/common/null_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ class NullBuffer {
(1 << (valueIdx % NUM_NULL_MASKS_PER_BYTE));
}

static inline void setNoNull(uint8_t* nullBytes, uint64_t valueIdx) {
nullBytes[valueIdx / NUM_NULL_MASKS_PER_BYTE] &=
~(1 << (valueIdx % NUM_NULL_MASKS_PER_BYTE));
}

static inline uint64_t getNumBytesForNullValues(uint64_t numValues) {
return (numValues + NUM_NULL_MASKS_PER_BYTE - 1) / NUM_NULL_MASKS_PER_BYTE;
}
Expand Down
4 changes: 3 additions & 1 deletion src/processor/result/factorized_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,13 @@ uint8_t* FactorizedTable::getTuple(ft_tuple_idx_t tupleIdx) const {

void FactorizedTable::updateFlatCell(
uint8_t* tuplePtr, ft_col_idx_t colIdx, ValueVector* valueVector, uint32_t pos) {
auto nullBuffer = tuplePtr + tableSchema->getNullMapOffset();
if (valueVector->isNull(pos)) {
setNonOverflowColNull(tuplePtr + tableSchema->getNullMapOffset(), colIdx);
setNonOverflowColNull(nullBuffer, colIdx);
} else {
valueVector->copyToRowData(
pos, tuplePtr + tableSchema->getColOffset(colIdx), inMemOverflowBuffer.get());
NullBuffer::setNoNull(nullBuffer, colIdx);
}
}

Expand Down
6 changes: 3 additions & 3 deletions test/test_files/tinysnb/update_rel/merge.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
3:14|2011-11-11
3:2|2021-06-30

# TODO(Xiyang): ON CREATE SET is not working as expected.
-CASE Merge2
-SKIP
-STATEMENT MATCH (a:person), (b:person) WHERE a.ID = 0 AND b.ID = 7 MERGE (a)-[r:knows]->(b) ON CREATE SET a.age = 0, r.date = date('2011-12-12')
---- ok
-STATEMENT MATCH (a:person), (b:person) WHERE a.ID = 0 AND b.ID = 7 MATCH (a)-[r:knows]->(b) RETURN id(r), r.date, a.age
-STATEMENT MATCH (a:person), (b:person) WHERE a.ID = 0 AND b.ID = 7 MATCH (a)-[r:knows]->(b) RETURN id(r), r.date, a.age
---- 1
3:14|2011-12-12|0
Loading