diff --git a/src/engine/joinOrdering/CostIKKBZ.h b/src/engine/joinOrdering/CostIKKBZ.h index d9b2dba071..2053c54972 100644 --- a/src/engine/joinOrdering/CostIKKBZ.h +++ b/src/engine/joinOrdering/CostIKKBZ.h @@ -15,7 +15,7 @@ namespace JoinOrdering { template requires RelationAble class CostIKKBZ : public ICostASI { public: - ad_utility::HashMap rank_m; + // ad_utility::HashMap rank_m; auto rank(const QueryGraph& g, const N& n) -> float; diff --git a/src/engine/joinOrdering/GOO.cpp b/src/engine/joinOrdering/GOO.cpp index 1dff9978c7..5f662d8f65 100644 --- a/src/engine/joinOrdering/GOO.cpp +++ b/src/engine/joinOrdering/GOO.cpp @@ -45,19 +45,7 @@ requires RelationAble g.hist[n].push_back(b); // TODO: STL chain iterators - // boost::join(g.edges_[a], g.edges_[b]) - for (auto const& [x, e] : g.edges_[a]) { - if (e.hidden || x == a || x == b) continue; - g.add_rjoin(n, x, e.weight, Direction::UNDIRECTED); - - if (!g.is_common_neighbour(a, b, x)) continue; - // when the 2 relations to be combined have common neighbours - // multiply edge weights of newly combined relation - g.edges_[x][n].weight = g.edges_[a][x].weight * g.edges_[b][x].weight; - g.edges_[n][x].weight = g.edges_[a][x].weight * g.edges_[b][x].weight; - } - - for (auto const& [x, e] : g.edges_[b]) { + for (auto const& [x, e] : boost::join(g.edges_[a], g.edges_[b])) { if (e.hidden || x == a || x == b) continue; g.add_rjoin(n, x, e.weight, Direction::UNDIRECTED); diff --git a/src/engine/joinOrdering/GOO.h b/src/engine/joinOrdering/GOO.h index 24678c8c4d..bb55cd1b38 100644 --- a/src/engine/joinOrdering/GOO.h +++ b/src/engine/joinOrdering/GOO.h @@ -6,6 +6,7 @@ #pragma once #include "QueryGraph.h" +#include "boost/range/join.hpp" namespace JoinOrdering { diff --git a/src/engine/joinOrdering/IKKBZ.cpp b/src/engine/joinOrdering/IKKBZ.cpp index 39037a72a7..1e05f6aa01 100644 --- a/src/engine/joinOrdering/IKKBZ.cpp +++ b/src/engine/joinOrdering/IKKBZ.cpp @@ -117,14 +117,16 @@ std::vector IKKBZ_Normalized(QueryGraph& g, ICostASI& Ch, normalized = false; } } - if (normalized) return subtree; + // if (normalized) return subtree; + if (normalized) return g.iter(subtree_root); } } template requires RelationAble -void IKKBZ_merge(QueryGraph& g, ICostASI& Ch, std::vector& dv) { +void IKKBZ_merge(QueryGraph& g, ICostASI& Ch, std::vector& xx) { // we get here after we are already sure that descendents are in a chain + auto dv = std::vector(xx.begin(), xx.end()); // exclude n from sorting. subchain root not considered during sorting. // n is always at the beginning of dv diff --git a/src/engine/joinOrdering/QueryGraph.cpp b/src/engine/joinOrdering/QueryGraph.cpp index 20c59f4654..6917310c16 100644 --- a/src/engine/joinOrdering/QueryGraph.cpp +++ b/src/engine/joinOrdering/QueryGraph.cpp @@ -178,11 +178,10 @@ auto QueryGraph::get_chained_subtree(const N& n) -> N { // since this is called from IKKBZ_Normalize // we have already checked the existence of a subtree - // if (it != dxs.end()) - return *it; + if (it != dxs.end()) return *it; // AD_CONTRACT_CHECK(false); - // throw std::runtime_error("how did we get here?"); + throw std::runtime_error("how did we get here?"); } template diff --git a/test/engine/joinOrdering/IKKBZTest.cpp b/test/engine/joinOrdering/IKKBZTest.cpp index ca6b613d13..9161b13305 100644 --- a/test/engine/joinOrdering/IKKBZTest.cpp +++ b/test/engine/joinOrdering/IKKBZTest.cpp @@ -578,7 +578,6 @@ TEST(GOO_SANITY, SESSION04_EX) { // TODO: undeterministic // EXPECT_NO_THROW(JoinOrdering::GOO(g)); - JoinOrdering::GOO(g); // auto erg = JoinOrdering::GOO(g); // for (auto const& x : g.hist[erg]) std::cout << x.getLabel() << "\n"; }