Skip to content

Commit

Permalink
fixup! fixup! use after free debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Goblin80 committed May 6, 2024
1 parent a03c4c8 commit 6215742
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/engine/joinOrdering/CostIKKBZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace JoinOrdering {
template <typename N>
requires RelationAble<N> class CostIKKBZ : public ICostASI<N> {
public:
ad_utility::HashMap<N, float> rank_m;
// ad_utility::HashMap<N, float> rank_m;

auto rank(const QueryGraph<N>& g, const N& n) -> float;

Expand Down
14 changes: 1 addition & 13 deletions src/engine/joinOrdering/GOO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,7 @@ requires RelationAble<N>
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);

Expand Down
1 change: 1 addition & 0 deletions src/engine/joinOrdering/GOO.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include "QueryGraph.h"
#include "boost/range/join.hpp"

namespace JoinOrdering {

Expand Down
6 changes: 4 additions & 2 deletions src/engine/joinOrdering/IKKBZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ std::vector<N> IKKBZ_Normalized(QueryGraph<N>& g, ICostASI<N>& Ch,
normalized = false;
}
}
if (normalized) return subtree;
// if (normalized) return subtree;
if (normalized) return g.iter(subtree_root);
}
}

template <typename N>
requires RelationAble<N>
void IKKBZ_merge(QueryGraph<N>& g, ICostASI<N>& Ch, std::vector<N>& dv) {
void IKKBZ_merge(QueryGraph<N>& g, ICostASI<N>& Ch, std::vector<N>& 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
Expand Down
5 changes: 2 additions & 3 deletions src/engine/joinOrdering/QueryGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ auto QueryGraph<N>::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?");

Check warning on line 184 in src/engine/joinOrdering/QueryGraph.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/joinOrdering/QueryGraph.cpp#L184

Added line #L184 was not covered by tests
}

template <typename N>
Expand Down
1 change: 0 additions & 1 deletion test/engine/joinOrdering/IKKBZTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

0 comments on commit 6215742

Please sign in to comment.