1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

feat(): use CountingAllocator for DISTINCT

This commit is contained in:
drrtuy
2025-02-21 17:02:42 +00:00
parent 7ad4022d96
commit 0bfe10a7d0
3 changed files with 14 additions and 6 deletions

View File

@ -747,13 +747,14 @@ IdbOrderBy::~IdbOrderBy()
delete *i++;
}
// INV fRm is not NULL here
void IdbOrderBy::initialize(const RowGroup& rg)
{
// initialize rows
IdbCompare::initialize(rg);
auto newSize = rg.getSizeWithStrings(fRowsPerRG);
if (fRm && !fRm->getMemory(newSize, fSessionMemLimit))
if (!fRm->getMemory(newSize, fSessionMemLimit))
{
cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__;
throw IDBExcept(fErrorCode);
@ -773,7 +774,8 @@ void IdbOrderBy::initialize(const RowGroup& rg)
if (fDistinct)
{
fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength())));
auto alloc = fRm->getAllocator<rowgroup::Row::Pointer>();
fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()), alloc));
}
}

View File

@ -29,8 +29,9 @@
#include <boost/scoped_ptr.hpp>
#include <tr1/unordered_set>
#include <unordered_set>
#include "countingallocator.h"
#include "rowgroup.h"
#include "hasher.h"
#include "stlpoolallocator.h"
@ -455,9 +456,8 @@ class IdbOrderBy : public IdbCompare
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
};
typedef std::tr1::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
utils::STLPoolAllocator<rowgroup::Row::Pointer> >
DistinctMap_t;
using DistinctMap_t = std::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
allocators::CountingAllocator<rowgroup::Row::Pointer>>;
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
rowgroup::Row row1, row2; // scratch space for Hasher & Eq