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
chore(): cleanup.
This commit is contained in:
@ -83,11 +83,8 @@ struct TAEq
|
|||||||
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
|
bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const;
|
||||||
};
|
};
|
||||||
// TODO: Generalize these and put them back in utils/common/hasher.h
|
// TODO: Generalize these and put them back in utils/common/hasher.h
|
||||||
// using TNSDistinctMap_t = std::unordered_set<rowgroup::Row::Pointer, TAHasher, TAEq,
|
using TNSDistinctMap_t =
|
||||||
// allocators::CountingAllocator<rowgroup::Row::Pointer> >;
|
std::unordered_set<rowgroup::Row::Pointer, TAHasher, TAEq, STLPoolAllocator<rowgroup::Row::Pointer> >;
|
||||||
using TNSDistinctMap_t = std::unordered_set<rowgroup::Row::Pointer, TAHasher, TAEq>;
|
|
||||||
// using TNSDistinctMap_t =
|
|
||||||
// std::unordered_set<rowgroup::Row::Pointer, TAHasher, TAEq, STLPoolAllocator<rowgroup::Row::Pointer> >;
|
|
||||||
}; // namespace
|
}; // namespace
|
||||||
|
|
||||||
inline uint64_t TAHasher::operator()(const Row::Pointer& p) const
|
inline uint64_t TAHasher::operator()(const Row::Pointer& p) const
|
||||||
@ -460,13 +457,8 @@ void TupleAnnexStep::executeNoOrderByWithDistinct()
|
|||||||
Row rowSkip;
|
Row rowSkip;
|
||||||
bool more = false;
|
bool more = false;
|
||||||
|
|
||||||
// auto alloc = fRm->getAllocator<rowgroup::Row::Pointer>();
|
std::unique_ptr<TNSDistinctMap_t> distinctMap(
|
||||||
// std::unique_ptr<TNSDistinctMap_t> distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this),
|
new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
||||||
// alloc));
|
|
||||||
// WIP
|
|
||||||
// std::unique_ptr<TNSDistinctMap_t> distinctMap(
|
|
||||||
// new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
|
||||||
std::unique_ptr<TNSDistinctMap_t> distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this)));
|
|
||||||
|
|
||||||
rgDataOut.reinit(fRowGroupOut);
|
rgDataOut.reinit(fRowGroupOut);
|
||||||
fRowGroupOut.setData(&rgDataOut);
|
fRowGroupOut.setData(&rgDataOut);
|
||||||
@ -723,13 +715,9 @@ void TupleAnnexStep::finalizeParallelOrderByDistinct()
|
|||||||
// Calculate offset here
|
// Calculate offset here
|
||||||
fRowGroupOut.getRow(0, &fRowOut);
|
fRowGroupOut.getRow(0, &fRowOut);
|
||||||
|
|
||||||
// auto allocSorting = fRm->getAllocator<ordering::OrderByRow>();
|
|
||||||
ordering::SortingPQ finalPQ(rowgroup::rgCommonSize, fRm->getAllocator<ordering::OrderByRow>());
|
ordering::SortingPQ finalPQ(rowgroup::rgCommonSize, fRm->getAllocator<ordering::OrderByRow>());
|
||||||
// ordering::SortingPQ finalPQ(rowgroup::rgCommonSize);
|
std::unique_ptr<TNSDistinctMap_t> distinctMap(
|
||||||
// auto allocDistinct = fRm->getAllocator<rowgroup::Row::Pointer>();
|
new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
||||||
// std::unique_ptr<TNSDistinctMap_t> distinctMap(
|
|
||||||
// new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
|
||||||
std::unique_ptr<TNSDistinctMap_t> distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this)));
|
|
||||||
fRowGroupIn.initRow(&row1);
|
fRowGroupIn.initRow(&row1);
|
||||||
fRowGroupIn.initRow(&row2);
|
fRowGroupIn.initRow(&row2);
|
||||||
|
|
||||||
|
@ -364,18 +364,14 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
|
|||||||
|
|
||||||
if (!typelessJoin[i])
|
if (!typelessJoin[i])
|
||||||
{
|
{
|
||||||
auto allocator = exemgr::globServiceExeMgr->getRm().getAllocator<TJoiner::value_type>();
|
|
||||||
bs >> joinNullValues[i];
|
bs >> joinNullValues[i];
|
||||||
bs >> largeSideKeyColumns[i];
|
bs >> largeSideKeyColumns[i];
|
||||||
for (uint j = 0; j < processorThreads; ++j)
|
for (uint j = 0; j < processorThreads; ++j)
|
||||||
tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to<uint64_t>(), allocator));
|
tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to<uint64_t>(),
|
||||||
// tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to<uint64_t>(),
|
utils::STLPoolAllocator<TJoiner::value_type>(resourceManager)));
|
||||||
// utils::STLPoolAllocator<TJoiner::value_type>(resourceManager)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto allocator = exemgr::globServiceExeMgr->getRm().getAllocator<TLJoiner::value_type>();
|
|
||||||
|
|
||||||
deserializeVector<uint32_t>(bs, tlLargeSideKeyColumns[i]);
|
deserializeVector<uint32_t>(bs, tlLargeSideKeyColumns[i]);
|
||||||
bs >> tlSmallSideKeyLengths[i];
|
bs >> tlSmallSideKeyLengths[i];
|
||||||
bs >> tmp8;
|
bs >> tmp8;
|
||||||
@ -397,9 +393,8 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs)
|
|||||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||||
auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i],
|
auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i],
|
||||||
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
mSmallSideKeyColumnsPtr, mSmallSideRGPtr);
|
||||||
tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, allocator));
|
tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator,
|
||||||
// tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator,
|
utils::STLPoolAllocator<TLJoiner::value_type>(resourceManager)));
|
||||||
// utils::STLPoolAllocator<TLJoiner::value_type>(resourceManager)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -308,23 +308,14 @@ class BatchPrimitiveProcessor
|
|||||||
bool hasRowGroup;
|
bool hasRowGroup;
|
||||||
|
|
||||||
/* Rowgroups + join */
|
/* Rowgroups + join */
|
||||||
using TJoiner =
|
using TJoiner = std::unordered_multimap<uint64_t, uint32_t, joiner::TupleJoiner::hasher,
|
||||||
std::unordered_multimap<uint64_t, uint32_t, joiner::TupleJoiner::hasher, std::equal_to<uint64_t>,
|
std::equal_to<uint64_t>,
|
||||||
allocators::CountingAllocator<std::pair<const uint64_t, uint32_t>>>;
|
utils::STLPoolAllocator<std::pair<const uint64_t, uint32_t>>>;
|
||||||
|
|
||||||
// using TJoiner = std::tr1::unordered_multimap<uint64_t, uint32_t, joiner::TupleJoiner::hasher,
|
|
||||||
// std::equal_to<uint64_t>,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const uint64_t, uint32_t>>>;
|
|
||||||
|
|
||||||
using TLJoiner =
|
using TLJoiner = std::unordered_multimap<
|
||||||
std::unordered_multimap<joiner::TypelessData, uint32_t, joiner::TupleJoiner::TypelessDataHasher,
|
joiner::TypelessData, uint32_t, joiner::TupleJoiner::TypelessDataHasher,
|
||||||
joiner::TupleJoiner::TypelessDataComparator,
|
joiner::TupleJoiner::TypelessDataComparator,
|
||||||
allocators::CountingAllocator<std::pair<const joiner::TypelessData, uint32_t>>>;
|
utils::STLPoolAllocator<std::pair<const joiner::TypelessData, uint32_t>>>;
|
||||||
|
|
||||||
// using TLJoiner = std::tr1::unordered_multimap<
|
|
||||||
// joiner::TypelessData, uint32_t, joiner::TupleJoiner::TypelessDataHasher,
|
|
||||||
// joiner::TupleJoiner::TypelessDataComparator,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const joiner::TypelessData, uint32_t>>>;
|
|
||||||
|
|
||||||
bool generateJoinedRowGroup(rowgroup::Row& baseRow, const uint32_t depth = 0);
|
bool generateJoinedRowGroup(rowgroup::Row& baseRow, const uint32_t depth = 0);
|
||||||
/* generateJoinedRowGroup helper fcns & vars */
|
/* generateJoinedRowGroup helper fcns & vars */
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||||
#include <boost/smart_ptr/make_shared_array.hpp>
|
#include <boost/smart_ptr/make_shared_array.hpp>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include "poolallocator.h"
|
#include "poolallocator.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -36,7 +34,6 @@ namespace utils
|
|||||||
{
|
{
|
||||||
PoolAllocator& PoolAllocator::operator=(const PoolAllocator& v)
|
PoolAllocator& PoolAllocator::operator=(const PoolAllocator& v)
|
||||||
{
|
{
|
||||||
std::cout << "PoolAllocator copy assignment" << std::endl;
|
|
||||||
allocSize = v.allocSize;
|
allocSize = v.allocSize;
|
||||||
tmpSpace = v.tmpSpace;
|
tmpSpace = v.tmpSpace;
|
||||||
useLock = v.useLock;
|
useLock = v.useLock;
|
||||||
@ -61,7 +58,6 @@ void PoolAllocator::newBlock()
|
|||||||
{
|
{
|
||||||
if (alloc)
|
if (alloc)
|
||||||
{
|
{
|
||||||
|
|
||||||
mem.emplace_back(boost::allocate_shared<PoolAllocatorBufType>(*alloc, allocSize));
|
mem.emplace_back(boost::allocate_shared<PoolAllocatorBufType>(*alloc, allocSize));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,19 +43,13 @@ constexpr const size_t DEFAULT_BUCKET_COUNT = 10;
|
|||||||
template <typename HashTable>
|
template <typename HashTable>
|
||||||
std::unique_ptr<HashTable> makeHashMap(size_t bucketCount, ResourceManager* resourceManager)
|
std::unique_ptr<HashTable> makeHashMap(size_t bucketCount, ResourceManager* resourceManager)
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager->getAllocator<T>();
|
|
||||||
// return std::unique_ptr<T>(new T(bucketCount, TupleJoiner::hasher(), typename T::key_equal(), alloc));
|
|
||||||
// std::cout << " makeHashMap " << std::endl;
|
|
||||||
return std::unique_ptr<HashTable>(new HashTable(bucketCount, TupleJoiner::hasher(),
|
return std::unique_ptr<HashTable>(new HashTable(bucketCount, TupleJoiner::hasher(),
|
||||||
typename HashTable::key_equal(),
|
typename HashTable::key_equal(),
|
||||||
// resourceManager->getAllocator<typename HashTable::value_type>()));
|
|
||||||
utils::STLPoolAllocator<typename HashTable::value_type>(resourceManager)));
|
utils::STLPoolAllocator<typename HashTable::value_type>(resourceManager)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TupleJoiner::initRowsVector()
|
void TupleJoiner::initRowsVector()
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager_->getAllocator<rowgroup::Row::Pointer>();
|
|
||||||
// rows.reset(new RowPointersVec(alloc));
|
|
||||||
rows.reset(new RowPointersVec(resourceManager_->getAllocator<rowgroup::Row::Pointer>()));
|
rows.reset(new RowPointersVec(resourceManager_->getAllocator<rowgroup::Row::Pointer>()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +59,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < bucketCount; i++)
|
for (size_t i = 0; i < bucketCount; i++)
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager_->getAllocator<pair<const TypelessData, Row::Pointer>>();
|
|
||||||
// ht.emplace_back(std::unique_ptr<typelesshash_t>(
|
|
||||||
// new typelesshash_t(DEFAULT_BUCKET_COUNT, hasher(), typelesshash_t::key_equal(), alloc)));
|
|
||||||
ht.emplace_back(makeHashMap<typelesshash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
ht.emplace_back(makeHashMap<typelesshash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,9 +66,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < bucketCount; i++)
|
for (size_t i = 0; i < bucketCount; i++)
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager_->getAllocator<pair<const long double, Row::Pointer>>();
|
|
||||||
// ld.emplace_back(std::unique_ptr<ldhash_t>(
|
|
||||||
// new ldhash_t(DEFAULT_BUCKET_COUNT, hasher(), ldhash_t::key_equal(), alloc)));
|
|
||||||
ld.emplace_back(makeHashMap<ldhash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
ld.emplace_back(makeHashMap<ldhash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,9 +73,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < bucketCount; i++)
|
for (size_t i = 0; i < bucketCount; i++)
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager_->getAllocator<pair<const int64_t, Row::Pointer>>();
|
|
||||||
// sth.emplace_back(std::unique_ptr<sthash_t>(
|
|
||||||
// new sthash_t(DEFAULT_BUCKET_COUNT, hasher(), sthash_t::key_equal(), alloc)));
|
|
||||||
sth.emplace_back(makeHashMap<sthash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
sth.emplace_back(makeHashMap<sthash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,9 +80,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < bucketCount; i++)
|
for (size_t i = 0; i < bucketCount; i++)
|
||||||
{
|
{
|
||||||
// auto alloc = resourceManager_->getAllocator<pair<const int64_t, uint8_t*>>();
|
|
||||||
// h.emplace_back(
|
|
||||||
// std::unique_ptr<hash_t>(new hash_t(DEFAULT_BUCKET_COUNT, hasher(), hash_t::key_equal(), alloc)));
|
|
||||||
h.emplace_back(makeHashMap<hash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
h.emplace_back(makeHashMap<hash_t>(DEFAULT_BUCKET_COUNT, resourceManager_));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,50 +476,13 @@ class TupleJoiner
|
|||||||
void initHashMaps(uint32_t& smallJoinColumn);
|
void initHashMaps(uint32_t& smallJoinColumn);
|
||||||
void clearHashMaps();
|
void clearHashMaps();
|
||||||
private:
|
private:
|
||||||
// typedef std::unordered_multimap<int64_t, uint8_t*, hasher, std::equal_to<int64_t>,
|
|
||||||
// allocators::CountingAllocator<std::pair<const int64_t, uint8_t*>>>
|
|
||||||
// hash_t;
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// int64_t, rowgroup::Row::Pointer, hasher, std::equal_to<int64_t>,
|
|
||||||
// allocators::CountingAllocator<std::pair<const int64_t, rowgroup::Row::Pointer>>>
|
|
||||||
// sthash_t;
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// TypelessData, rowgroup::Row::Pointer, hasher, std::equal_to<TypelessData>,
|
|
||||||
// allocators::CountingAllocator<std::pair<const TypelessData, rowgroup::Row::Pointer>>>
|
|
||||||
// typelesshash_t;
|
|
||||||
// // MCOL-1822 Add support for Long Double AVG/SUM small side
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// long double, rowgroup::Row::Pointer, hasher, LongDoubleEq,
|
|
||||||
// allocators::CountingAllocator<std::pair<const long double, rowgroup::Row::Pointer>>>
|
|
||||||
// ldhash_t;
|
|
||||||
|
|
||||||
|
|
||||||
template<typename K, typename V>
|
template<typename K, typename V>
|
||||||
using HashMapTemplate = std::unordered_multimap<K, V, hasher, std::equal_to<K>,
|
using HashMapTemplate = std::unordered_multimap<K, V, hasher, std::equal_to<K>,
|
||||||
utils::STLPoolAllocator<std::pair<const K, V>>>;
|
utils::STLPoolAllocator<std::pair<const K, V>>>;
|
||||||
// template<typename K, typename V>
|
|
||||||
// using HashMapTemplate = std::unordered_multimap<K, V, hasher, std::equal_to<K>,
|
|
||||||
// allocators::CountingAllocator<std::pair<const K, V>>>;
|
|
||||||
using hash_t = HashMapTemplate<int64_t, uint8_t*>;
|
using hash_t = HashMapTemplate<int64_t, uint8_t*>;
|
||||||
using sthash_t = HashMapTemplate<int64_t, rowgroup::Row::Pointer>;
|
using sthash_t = HashMapTemplate<int64_t, rowgroup::Row::Pointer>;
|
||||||
using typelesshash_t = HashMapTemplate<TypelessData, rowgroup::Row::Pointer>;
|
using typelesshash_t = HashMapTemplate<TypelessData, rowgroup::Row::Pointer>;
|
||||||
using ldhash_t = HashMapTemplate<long double, rowgroup::Row::Pointer>;
|
using ldhash_t = HashMapTemplate<long double, rowgroup::Row::Pointer>;
|
||||||
// typedef std::unordered_multimap<int64_t, uint8_t*, hasher,td::equal_to<int64_t>,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const int64_t, uint8_t*>>>
|
|
||||||
// hash_t;
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// int64_t, rowgroup::Row::Pointer, hasher, std::equal_to<int64_t>,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const int64_t, rowgroup::Row::Pointer>>>
|
|
||||||
// sthash_t;
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// TypelessData, rowgroup::Row::Pointer, hasher, std::equal_to<TypelessData>,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const TypelessData, rowgroup::Row::Pointer>>>
|
|
||||||
// typelesshash_t;
|
|
||||||
// MCOL-1822 Add support for Long Double AVG/SUM small side
|
|
||||||
// typedef std::unordered_multimap<
|
|
||||||
// long double, rowgroup::Row::Pointer, hasher, LongDoubleEq,
|
|
||||||
// utils::STLPoolAllocator<std::pair<const long double, rowgroup::Row::Pointer>>>
|
|
||||||
// ldhash_t;
|
|
||||||
|
|
||||||
typedef hash_t::iterator iterator;
|
typedef hash_t::iterator iterator;
|
||||||
typedef typelesshash_t::iterator thIterator;
|
typedef typelesshash_t::iterator thIterator;
|
||||||
|
@ -776,12 +776,11 @@ void IdbOrderBy::initialize(const RowGroup& rg)
|
|||||||
// These two blocks contain structs with memory accounting.
|
// These two blocks contain structs with memory accounting.
|
||||||
fOrderByQueue.reset(new SortingPQ(rowgroup::rgCommonSize, fRm->getAllocator<OrderByRow>()));
|
fOrderByQueue.reset(new SortingPQ(rowgroup::rgCommonSize, fRm->getAllocator<OrderByRow>()));
|
||||||
|
|
||||||
// WIP
|
if (fDistinct)
|
||||||
// if (fDistinct)
|
{
|
||||||
// {
|
fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()),
|
||||||
// fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()),
|
utils::STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
||||||
// utils::STLPoolAllocator<rowgroup::Row::Pointer>(fRm)));
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IdbOrderBy::getData(RGData& data)
|
bool IdbOrderBy::getData(RGData& data)
|
||||||
|
Reference in New Issue
Block a user