Skip to content

Commit

Permalink
Delete an unused function template (#1772)
Browse files Browse the repository at this point in the history
The function was never even instantiated.
  • Loading branch information
RobinTF authored Feb 7, 2025
1 parent a307781 commit 3e7df42
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 84 deletions.
1 change: 1 addition & 0 deletions src/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "engine/CallFixedSize.h"
#include "util/ChunkedForLoop.h"
#include "util/Exception.h"

// The actual implementation of sorting an `IdTable` according to the
// `sortCols`.
Expand Down
84 changes: 0 additions & 84 deletions src/engine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,99 +3,15 @@
// Author: Björn Buchhold (buchhold@informatik.uni-freiburg.de)
#pragma once

#include <iomanip>
#include <type_traits>
#include <vector>

#include "backports/algorithm.h"
#include "engine/IndexSequence.h"
#include "engine/idTable/IdTable.h"
#include "global/Constants.h"
#include "global/Id.h"
#include "util/Exception.h"
#include "util/Log.h"

class Engine {
public:
template <typename Comp, int WIDTH>
static void filter(const IdTableView<WIDTH>& v, const Comp& comp,
IdTableStatic<WIDTH>* result) {
AD_CONTRACT_CHECK(result);
AD_CONTRACT_CHECK(result->size() == 0);
LOG(DEBUG) << "Filtering " << v.size() << " elements.\n";
for (const auto& e : v) {
if (comp(e)) {
result->push_back(e);
}
}
LOG(DEBUG) << "Filter done, size now: " << result->size() << " elements.\n";
}

template <int IN_WIDTH, int FILTER_WIDTH>
static void filter(const IdTable& dynV, size_t fc1, size_t fc2,
const IdTable& dynFilter, IdTable* dynResult) {
AD_CONTRACT_CHECK(dynResult);
AD_CONTRACT_CHECK(dynResult->size() == 0);
LOG(DEBUG) << "Filtering " << dynV.size()
<< " elements with a filter relation with " << dynFilter.size()
<< "elements\n";

// Check trivial case.
if (dynV.size() == 0 || dynFilter.size() == 0) {
return;
}

const IdTableView<IN_WIDTH> v = dynV.asStaticView<IN_WIDTH>();
const IdTableView<FILTER_WIDTH> filter =
dynFilter.asStaticView<FILTER_WIDTH>();
IdTableStatic<IN_WIDTH> result = std::move(*dynResult).toStatic<IN_WIDTH>();

// Intersect both lists.
size_t i = 0;
size_t j = 0;

while (i < v.size() && j < filter.size()) {
while (v(i, fc1) < filter(j, 0)) {
++i;
if (i >= v.size()) {
goto finish;
}
}
while (filter(j, 0) < v(i, fc1)) {
++j;
if (j >= filter.size()) {
goto finish;
}
}
while (v(i, fc1) == filter(j, 0)) {
// fc1 match, create cross-product
// Check fc2
if (v(i, fc2) == filter(j, 1)) {
result.push_back(v, i);
++i;
if (i >= v.size()) {
break;
}
} else if (v(i, fc2) < filter(j, 1)) {
++i;
if (i >= v.size()) {
break;
}
} else {
++j;
if (j >= filter.size()) {
break;
}
}
}
}
finish:
*dynResult = std::move(result).toDynamic();

LOG(DEBUG) << "Filter done, size now: " << dynResult->size()
<< " elements.\n";
}

template <size_t WIDTH>
static void sort(IdTable* tab, const size_t keyColumn) {
LOG(DEBUG) << "Sorting " << tab->size() << " elements ..." << std::endl;
Expand Down

0 comments on commit 3e7df42

Please sign in to comment.