Skip to content

Commit

Permalink
Merge pull request #1916 from kuzudb/update-rel-fix
Browse files Browse the repository at this point in the history
fix merge rel
  • Loading branch information
acquamarin committed Aug 10, 2023
2 parents c8708f6 + 7b76f61 commit 7dd607b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
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

0 comments on commit 7dd607b

Please sign in to comment.