Skip to content

Commit

Permalink
Merge pull request #1871 from kuzudb/ft-fix
Browse files Browse the repository at this point in the history
Fix factorizedTable
  • Loading branch information
acquamarin committed Jul 30, 2023
2 parents ed09f19 + 965b2f1 commit 2955977
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/processor/result/factorized_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,30 +547,32 @@ overflow_value_t FactorizedTable::appendVectorToUnflatTupleBlocks(

void FactorizedTable::readUnflatCol(
uint8_t** tuplesToRead, ft_col_idx_t colIdx, ValueVector& vector) const {
auto vectorOverflowValue =
auto overflowColValue =
*(overflow_value_t*)(tuplesToRead[0] + tableSchema->getColOffset(colIdx));
assert(vector.state->selVector->isUnfiltered());
auto numBytesPerValue = LogicalTypeUtils::getRowLayoutSize(vector.dataType);
if (hasNoNullGuarantee(colIdx)) {
vector.setAllNonNull();
auto val = vectorOverflowValue.value;
for (auto i = 0u; i < vectorOverflowValue.numElements; i++) {
auto val = overflowColValue.value;
for (auto i = 0u; i < overflowColValue.numElements; i++) {
vector.copyFromRowData(i, val);
val += LogicalTypeUtils::getRowLayoutSize(vector.dataType);
val += numBytesPerValue;
}
} else {
for (auto i = 0u; i < vectorOverflowValue.numElements; i++) {
if (isOverflowColNull(vectorOverflowValue.value + vectorOverflowValue.numElements *
vector.getNumBytesPerValue(),
i, colIdx)) {
auto overflowColNullData =
overflowColValue.value + overflowColValue.numElements * numBytesPerValue;
auto overflowColData = overflowColValue.value;
for (auto i = 0u; i < overflowColValue.numElements; i++) {
if (isOverflowColNull(overflowColNullData, i, colIdx)) {
vector.setNull(i, true);
} else {
vector.setNull(i, false);
vector.copyFromRowData(
i, vectorOverflowValue.value + i * vector.getNumBytesPerValue());
vector.copyFromRowData(i, overflowColData);
}
overflowColData += numBytesPerValue;
}
}
vector.state->selVector->selectedSize = vectorOverflowValue.numElements;
vector.state->selVector->selectedSize = overflowColValue.numElements;
}

void FactorizedTable::readUnflatCol(const uint8_t* tupleToRead, const SelectionVector* selVector,
Expand Down

0 comments on commit 2955977

Please sign in to comment.