You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
feat(): use CountingAllocator for DISTINCT
This commit is contained in:
@ -217,6 +217,12 @@ void JobStep::handleException(std::exception_ptr e, const int errorCode, const u
|
|||||||
{
|
{
|
||||||
std::rethrow_exception(e);
|
std::rethrow_exception(e);
|
||||||
}
|
}
|
||||||
|
// Add it here for now to handle potential bad_alloc exceptions
|
||||||
|
catch (std::bad_alloc& exc)
|
||||||
|
{
|
||||||
|
std::cerr << methodName << " caught a bad_alloc exception. " << std::endl;
|
||||||
|
catchHandler(methodName + " caught " + exc.what(), errorCode, fErrorInfo, fSessionId);
|
||||||
|
}
|
||||||
catch (const IDBExcept& iex)
|
catch (const IDBExcept& iex)
|
||||||
{
|
{
|
||||||
std::cerr << methodName << " caught a internal exception. " << std::endl;
|
std::cerr << methodName << " caught a internal exception. " << std::endl;
|
||||||
|
@ -747,13 +747,14 @@ IdbOrderBy::~IdbOrderBy()
|
|||||||
delete *i++;
|
delete *i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// INV fRm is not NULL here
|
||||||
void IdbOrderBy::initialize(const RowGroup& rg)
|
void IdbOrderBy::initialize(const RowGroup& rg)
|
||||||
{
|
{
|
||||||
// initialize rows
|
// initialize rows
|
||||||
IdbCompare::initialize(rg);
|
IdbCompare::initialize(rg);
|
||||||
|
|
||||||
auto newSize = rg.getSizeWithStrings(fRowsPerRG);
|
auto newSize = rg.getSizeWithStrings(fRowsPerRG);
|
||||||
if (fRm && !fRm->getMemory(newSize, fSessionMemLimit))
|
if (!fRm->getMemory(newSize, fSessionMemLimit))
|
||||||
{
|
{
|
||||||
cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__;
|
cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__;
|
||||||
throw IDBExcept(fErrorCode);
|
throw IDBExcept(fErrorCode);
|
||||||
@ -773,7 +774,8 @@ void IdbOrderBy::initialize(const RowGroup& rg)
|
|||||||
|
|
||||||
if (fDistinct)
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,9 @@
|
|||||||
|
|
||||||
#include <boost/scoped_ptr.hpp>
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
#include <tr1/unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
#include "countingallocator.h"
|
||||||
#include "rowgroup.h"
|
#include "rowgroup.h"
|
||||||
#include "hasher.h"
|
#include "hasher.h"
|
||||||
#include "stlpoolallocator.h"
|
#include "stlpoolallocator.h"
|
||||||
@ -455,9 +456,8 @@ class IdbOrderBy : public IdbCompare
|
|||||||
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
|
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::tr1::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
|
using DistinctMap_t = std::unordered_set<rowgroup::Row::Pointer, Hasher, Eq,
|
||||||
utils::STLPoolAllocator<rowgroup::Row::Pointer> >
|
allocators::CountingAllocator<rowgroup::Row::Pointer>>;
|
||||||
DistinctMap_t;
|
|
||||||
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
|
boost::scoped_ptr<DistinctMap_t> fDistinctMap;
|
||||||
rowgroup::Row row1, row2; // scratch space for Hasher & Eq
|
rowgroup::Row row1, row2; // scratch space for Hasher & Eq
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user