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 factorizedTable #1871

Merged
merged 1 commit into from
Jul 30, 2023
Merged
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
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
Loading