diff --git a/src/engine/joinOrdering/CostIKKBZ.cpp b/src/engine/joinOrdering/CostIKKBZ.cpp index 3eaa3df3fe..2d28dbb024 100644 --- a/src/engine/joinOrdering/CostIKKBZ.cpp +++ b/src/engine/joinOrdering/CostIKKBZ.cpp @@ -39,7 +39,7 @@ auto CostIKKBZ::T(const QueryGraph& g, const N& n) -> float { template requires RelationAble auto CostIKKBZ::rank(const QueryGraph& g, const N& n) -> float { - if (rank_m.contains(n)) return rank_m[n]; + // if (rank_m.contains(n)) return rank_m[n]; auto c = C(g, n); auto t = T(g, n); @@ -50,7 +50,7 @@ auto CostIKKBZ::rank(const QueryGraph& g, const N& n) -> float { // assert rank [0, 1] AD_CONTRACT_CHECK(r >= 0 && r <= 1); - rank_m[n] = r; + // rank_m[n] = r; return r; } } // namespace JoinOrdering diff --git a/src/engine/joinOrdering/GOO.cpp b/src/engine/joinOrdering/GOO.cpp index 5f662d8f65..1dff9978c7 100644 --- a/src/engine/joinOrdering/GOO.cpp +++ b/src/engine/joinOrdering/GOO.cpp @@ -45,7 +45,19 @@ requires RelationAble g.hist[n].push_back(b); // TODO: STL chain iterators - for (auto const& [x, e] : boost::join(g.edges_[a], g.edges_[b])) { + // 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]) { 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 176f03fac3..24678c8c4d 100644 --- a/src/engine/joinOrdering/GOO.h +++ b/src/engine/joinOrdering/GOO.h @@ -5,8 +5,6 @@ #pragma once -#include - #include "QueryGraph.h" namespace JoinOrdering { diff --git a/src/engine/joinOrdering/IKKBZ.cpp b/src/engine/joinOrdering/IKKBZ.cpp index 8196cd08dd..39037a72a7 100644 --- a/src/engine/joinOrdering/IKKBZ.cpp +++ b/src/engine/joinOrdering/IKKBZ.cpp @@ -111,7 +111,6 @@ std::vector IKKBZ_Normalized(QueryGraph& g, ICostASI& Ch, // "precedence graph demands A -> B but rank(A) > rank(B), // we speak of contradictory sequences." // 118/637 - // if (ASI::rank(g, p) > ASI::rank(g, c)) { if (Ch.rank(g, p) > Ch.rank(g, c)) { // a new node representing compound relation IKKBZ_combine(g, p, c);