Skip to content

Commit

Permalink
Fixed Wrong resultTypes in columns. (#434)
Browse files Browse the repository at this point in the history
1. Fixed wrong result type in second part of union (for a column that does not appear in the first part)
2. Temporary fix for wrong result type in join with empty subresult (due to early stopping, which is now temporarily disabled).
  • Loading branch information
joka921 committed Jul 22, 2021
1 parent 08533d9 commit b2922e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/engine/Join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void Join::computeResult(ResultTable* result) {
size_t leftWidth = _left->getResultWidth();
size_t rightWidth = _right->getResultWidth();

// TODO<joka921> Currently the _resultTypes are set incorrectly in case
// of early stopping. For now, early stopping is thus disabled.
// TODO: Implement getting the result types without calculating the result;
/*
// Checking this before calling getResult on the subtrees can
// avoid the computation of an non-empty subtree.
if (_left->knownEmptyResult() || _right->knownEmptyResult()) {
Expand All @@ -82,6 +86,7 @@ void Join::computeResult(ResultTable* result) {
result->_sortedBy = {_leftJoinCol};
return;
}
*/

// Check for joins with dummy
if (isFullScanDummy(_left) || isFullScanDummy(_right)) {
Expand All @@ -94,7 +99,11 @@ void Join::computeResult(ResultTable* result) {
shared_ptr<const ResultTable> leftRes = _left->getResult();
runtimeInfo.addChild(_left->getRootOperation()->getRuntimeInfo());

// TODO<joka921> Currently the _resultTypes are set incorrectly in case
// of early stopping. For now, early stopping is thus disabled.
// TODO: Implement getting the result types without calculating the result;
// Check if we can stop early.
/*
if (leftRes->size() == 0) {
LOG(TRACE) << "Left side empty thus join result is empty" << endl;
runtimeInfo.addDetail("The left side was empty", "");
Expand All @@ -104,6 +113,7 @@ void Join::computeResult(ResultTable* result) {
result->_sortedBy = {_leftJoinCol};
return;
}
*/

LOG(TRACE) << "Computing right side..." << endl;
shared_ptr<const ResultTable> rightRes = _right->getResult();
Expand Down
2 changes: 1 addition & 1 deletion src/engine/Union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void Union::computeResult(ResultTable* result) {
if (o[0] != NO_COLUMN) {
result->_resultTypes.push_back(subRes1->getResultType(o[0]));
} else if (o[1] != NO_COLUMN) {
result->_resultTypes.push_back(subRes1->getResultType(o[1]));
result->_resultTypes.push_back(subRes2->getResultType(o[1]));
} else {
result->_resultTypes.push_back(ResultTable::ResultType::KB);
}
Expand Down

0 comments on commit b2922e4

Please sign in to comment.