Skip to content

Commit

Permalink
Fix result width bug in SpatialJoin (ad-freiburg#1670)
Browse files Browse the repository at this point in the history
This regression bug broke some spatial join operations. Due to refactoring into `PayloadVariables` class, a lambda was removed, but the lambda's `return` was not properly replaced by a variable assignment. This led to `Assertion "_joinVar == findJoinVar(*_right, _rightJoinCol)" failed` errors. Also there was another detail bug with result width that will now also be fixed.
  • Loading branch information
ullingerc authored Dec 10, 2024
1 parent 5b27eeb commit 01d8306
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/engine/SpatialJoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ size_t SpatialJoin::getResultWidth() const {
absl::flat_hash_set<Variable> pvSet{pv.begin(), pv.end()};

// The payloadVariables_ may contain the right join variable
return pvSet.size() + (pvSet.contains(config_.right_) ? 0 : 1);
sizeRight = pvSet.size() + (pvSet.contains(config_.right_) ? 0 : 1);
}
auto widthChildren = childLeft_->getResultWidth() + sizeRight;

Expand Down Expand Up @@ -283,7 +283,13 @@ float SpatialJoin::getMultiplicity(size_t col) {
child = childLeft_;
} else {
child = childRight_;
column -= childLeft_->getResultWidth();
// Since we only select the payload variables into the result and
// potentially omit some columns from the right child, we need to
// translate the column index on the spatial join to a column index in the
// right child.
auto filteredColumns = copySortedByColumnIndex(getVarColMapPayloadVars());
column = filteredColumns.at(column - childLeft_->getResultWidth())
.second.columnIndex_;
}
auto distinctnessChild = getDistinctness(child, column);
return static_cast<float>(childLeft_->getSizeEstimate() *
Expand Down

0 comments on commit 01d8306

Please sign in to comment.