Skip to content

Commit

Permalink
Issue #520: core: replace RedBlackMap and RedBlackSet implementation
Browse files Browse the repository at this point in the history
Partial implementation: MangoPg is updated
  • Loading branch information
Alexander Stepaniuk authored and Alexander Stepaniuk committed Aug 3, 2022
1 parent 774ebd6 commit 2f63e37
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bingo/postgres/src/pg_core/mango_pg_build_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ void MangoPgBuildEngine::insertShadowInfo(BingoPgFpData& item_data)
shadow_rel_name, data.getSectionIdx(), data.getStructureIdx(), ItemPointerGetBlockNumber(tid_ptr),
ItemPointerGetOffsetNumber(tid_ptr), data.getMass(), data.getFragmentsCount(), data.getGrossStr());

const RedBlackMap<dword, int>& hashes = data.getHashes();
for (int h_idx = hashes.begin(); h_idx != hashes.end(); h_idx = hashes.next(h_idx))
const std::map<dword, int>& hashes = data.getHashes();
for (const auto& pair : hashes)
{
BingoPgCommon::executeQuery("INSERT INTO %s(b_id, ex_hash, f_count) VALUES ('(%d, %d)'::tid, %d, %d)", shadow_hash_name, data.getSectionIdx(),
data.getStructureIdx(), hashes.key(h_idx), hashes.value(h_idx));
data.getStructureIdx(), pair.first, pair.second);
}
}

Expand Down
8 changes: 4 additions & 4 deletions bingo/postgres/src/pg_core/mango_pg_search_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ using namespace indigo;

void MangoPgFpData::insertHash(dword hash, int c_cnt)
{
int* comp_count = _hashes.at2(hash);
if (comp_count)
const auto it = _hashes.find(hash);
if (it != _hashes.end())
{
(*comp_count) += c_cnt;
it->second += c_cnt;
}
else
{
_hashes.insert(hash, c_cnt);
_hashes.emplace(hash, c_cnt);
}
}

Expand Down
4 changes: 2 additions & 2 deletions bingo/postgres/src/pg_core/mango_pg_search_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MangoPgFpData : public BingoPgFpData
}

void insertHash(dword hash, int c_cnt);
const indigo::RedBlackMap<dword, int>& getHashes() const
const std::map<dword, int>& getHashes() const
{
return _hashes;
}
Expand Down Expand Up @@ -68,7 +68,7 @@ class MangoPgFpData : public BingoPgFpData
/*
* Map: hash - components count
*/
indigo::RedBlackMap<dword, int> _hashes;
std::map<dword, int> _hashes;
indigo::Array<char> _gross;
};

Expand Down

0 comments on commit 2f63e37

Please sign in to comment.