diff --git a/dbcon/joblist/tupleannexstep.cpp b/dbcon/joblist/tupleannexstep.cpp index fb340e23b..d984e5322 100644 --- a/dbcon/joblist/tupleannexstep.cpp +++ b/dbcon/joblist/tupleannexstep.cpp @@ -83,11 +83,8 @@ struct TAEq bool operator()(const rowgroup::Row::Pointer&, const rowgroup::Row::Pointer&) const; }; // TODO: Generalize these and put them back in utils/common/hasher.h -// using TNSDistinctMap_t = std::unordered_set >; -using TNSDistinctMap_t = std::unordered_set; -// using TNSDistinctMap_t = -// std::unordered_set >; +using TNSDistinctMap_t = + std::unordered_set >; }; // namespace inline uint64_t TAHasher::operator()(const Row::Pointer& p) const @@ -460,13 +457,8 @@ void TupleAnnexStep::executeNoOrderByWithDistinct() Row rowSkip; bool more = false; - // auto alloc = fRm->getAllocator(); - // std::unique_ptr distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), - // alloc)); - // WIP - // std::unique_ptr distinctMap( - // new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator(fRm))); - std::unique_ptr distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this))); + std::unique_ptr distinctMap( + new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator(fRm))); rgDataOut.reinit(fRowGroupOut); fRowGroupOut.setData(&rgDataOut); @@ -723,13 +715,9 @@ void TupleAnnexStep::finalizeParallelOrderByDistinct() // Calculate offset here fRowGroupOut.getRow(0, &fRowOut); - // auto allocSorting = fRm->getAllocator(); ordering::SortingPQ finalPQ(rowgroup::rgCommonSize, fRm->getAllocator()); - // ordering::SortingPQ finalPQ(rowgroup::rgCommonSize); - // auto allocDistinct = fRm->getAllocator(); - // std::unique_ptr distinctMap( - // new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator(fRm))); - std::unique_ptr distinctMap(new TNSDistinctMap_t(10, TAHasher(this), TAEq(this))); + std::unique_ptr distinctMap( + new TNSDistinctMap_t(10, TAHasher(this), TAEq(this), STLPoolAllocator(fRm))); fRowGroupIn.initRow(&row1); fRowGroupIn.initRow(&row2); diff --git a/primitives/primproc/batchprimitiveprocessor.cpp b/primitives/primproc/batchprimitiveprocessor.cpp index b5a18bee4..fbe0f3799 100644 --- a/primitives/primproc/batchprimitiveprocessor.cpp +++ b/primitives/primproc/batchprimitiveprocessor.cpp @@ -364,18 +364,14 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs) if (!typelessJoin[i]) { - auto allocator = exemgr::globServiceExeMgr->getRm().getAllocator(); bs >> joinNullValues[i]; bs >> largeSideKeyColumns[i]; for (uint j = 0; j < processorThreads; ++j) - tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to(), allocator)); - // tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to(), - // utils::STLPoolAllocator(resourceManager))); + tJoiners[i][j].reset(new TJoiner(10, TupleJoiner::hasher(), std::equal_to(), + utils::STLPoolAllocator(resourceManager))); } else { - auto allocator = exemgr::globServiceExeMgr->getRm().getAllocator(); - deserializeVector(bs, tlLargeSideKeyColumns[i]); bs >> tlSmallSideKeyLengths[i]; bs >> tmp8; @@ -397,9 +393,8 @@ void BatchPrimitiveProcessor::initBPP(ByteStream& bs) mSmallSideKeyColumnsPtr, mSmallSideRGPtr); auto tlComparator = TupleJoiner::TypelessDataComparator(&outputRG, &tlLargeSideKeyColumns[i], mSmallSideKeyColumnsPtr, mSmallSideRGPtr); - tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, allocator)); - // tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, - // utils::STLPoolAllocator(resourceManager))); + tlJoiners[i][j].reset(new TLJoiner(10, tlHasher, tlComparator, + utils::STLPoolAllocator(resourceManager))); } } } diff --git a/primitives/primproc/batchprimitiveprocessor.h b/primitives/primproc/batchprimitiveprocessor.h index cc847d82b..0fa62f0ff 100644 --- a/primitives/primproc/batchprimitiveprocessor.h +++ b/primitives/primproc/batchprimitiveprocessor.h @@ -308,23 +308,14 @@ class BatchPrimitiveProcessor bool hasRowGroup; /* Rowgroups + join */ - using TJoiner = - std::unordered_multimap, - allocators::CountingAllocator>>; - - // using TJoiner = std::tr1::unordered_multimap, - // utils::STLPoolAllocator>>; + using TJoiner = std::unordered_multimap, + utils::STLPoolAllocator>>; - using TLJoiner = - std::unordered_multimap>>; - - // using TLJoiner = std::tr1::unordered_multimap< - // joiner::TypelessData, uint32_t, joiner::TupleJoiner::TypelessDataHasher, - // joiner::TupleJoiner::TypelessDataComparator, - // utils::STLPoolAllocator>>; + using TLJoiner = std::unordered_multimap< + joiner::TypelessData, uint32_t, joiner::TupleJoiner::TypelessDataHasher, + joiner::TupleJoiner::TypelessDataComparator, + utils::STLPoolAllocator>>; bool generateJoinedRowGroup(rowgroup::Row& baseRow, const uint32_t depth = 0); /* generateJoinedRowGroup helper fcns & vars */ diff --git a/utils/common/poolallocator.cpp b/utils/common/poolallocator.cpp index 0fee364c4..852eddb8a 100644 --- a/utils/common/poolallocator.cpp +++ b/utils/common/poolallocator.cpp @@ -25,8 +25,6 @@ #include #include -#include - #include "poolallocator.h" using namespace std; @@ -36,7 +34,6 @@ namespace utils { PoolAllocator& PoolAllocator::operator=(const PoolAllocator& v) { - std::cout << "PoolAllocator copy assignment" << std::endl; allocSize = v.allocSize; tmpSpace = v.tmpSpace; useLock = v.useLock; @@ -61,7 +58,6 @@ void PoolAllocator::newBlock() { if (alloc) { - mem.emplace_back(boost::allocate_shared(*alloc, allocSize)); } else diff --git a/utils/common/poolallocator.h b/utils/common/poolallocator.h index 186bc453f..3d6cfdca2 100644 --- a/utils/common/poolallocator.h +++ b/utils/common/poolallocator.h @@ -33,8 +33,6 @@ #include #include -#include - #include diff --git a/utils/joiner/tuplejoiner.cpp b/utils/joiner/tuplejoiner.cpp index 142cc915c..2736993aa 100644 --- a/utils/joiner/tuplejoiner.cpp +++ b/utils/joiner/tuplejoiner.cpp @@ -43,19 +43,13 @@ constexpr const size_t DEFAULT_BUCKET_COUNT = 10; template std::unique_ptr makeHashMap(size_t bucketCount, ResourceManager* resourceManager) { - // auto alloc = resourceManager->getAllocator(); - // return std::unique_ptr(new T(bucketCount, TupleJoiner::hasher(), typename T::key_equal(), alloc)); - // std::cout << " makeHashMap " << std::endl; return std::unique_ptr(new HashTable(bucketCount, TupleJoiner::hasher(), typename HashTable::key_equal(), - // resourceManager->getAllocator())); utils::STLPoolAllocator(resourceManager))); } void TupleJoiner::initRowsVector() { - // auto alloc = resourceManager_->getAllocator(); - // rows.reset(new RowPointersVec(alloc)); rows.reset(new RowPointersVec(resourceManager_->getAllocator())); } @@ -65,9 +59,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn) { for (size_t i = 0; i < bucketCount; i++) { - // auto alloc = resourceManager_->getAllocator>(); - // ht.emplace_back(std::unique_ptr( - // new typelesshash_t(DEFAULT_BUCKET_COUNT, hasher(), typelesshash_t::key_equal(), alloc))); ht.emplace_back(makeHashMap(DEFAULT_BUCKET_COUNT, resourceManager_)); } } @@ -75,9 +66,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn) { for (size_t i = 0; i < bucketCount; i++) { - // auto alloc = resourceManager_->getAllocator>(); - // ld.emplace_back(std::unique_ptr( - // new ldhash_t(DEFAULT_BUCKET_COUNT, hasher(), ldhash_t::key_equal(), alloc))); ld.emplace_back(makeHashMap(DEFAULT_BUCKET_COUNT, resourceManager_)); } } @@ -85,9 +73,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn) { for (size_t i = 0; i < bucketCount; i++) { - // auto alloc = resourceManager_->getAllocator>(); - // sth.emplace_back(std::unique_ptr( - // new sthash_t(DEFAULT_BUCKET_COUNT, hasher(), sthash_t::key_equal(), alloc))); sth.emplace_back(makeHashMap(DEFAULT_BUCKET_COUNT, resourceManager_)); } } @@ -95,9 +80,6 @@ void TupleJoiner::initHashMaps(uint32_t& smallJoinColumn) { for (size_t i = 0; i < bucketCount; i++) { - // auto alloc = resourceManager_->getAllocator>(); - // h.emplace_back( - // std::unique_ptr(new hash_t(DEFAULT_BUCKET_COUNT, hasher(), hash_t::key_equal(), alloc))); h.emplace_back(makeHashMap(DEFAULT_BUCKET_COUNT, resourceManager_)); } } diff --git a/utils/joiner/tuplejoiner.h b/utils/joiner/tuplejoiner.h index f29e7de86..52d2a579f 100644 --- a/utils/joiner/tuplejoiner.h +++ b/utils/joiner/tuplejoiner.h @@ -476,50 +476,13 @@ class TupleJoiner void initHashMaps(uint32_t& smallJoinColumn); void clearHashMaps(); private: - // typedef std::unordered_multimap, - // allocators::CountingAllocator>> - // hash_t; - // typedef std::unordered_multimap< - // int64_t, rowgroup::Row::Pointer, hasher, std::equal_to, - // allocators::CountingAllocator>> - // sthash_t; - // typedef std::unordered_multimap< - // TypelessData, rowgroup::Row::Pointer, hasher, std::equal_to, - // allocators::CountingAllocator>> - // 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>> - // ldhash_t; - - template using HashMapTemplate = std::unordered_multimap, utils::STLPoolAllocator>>; - // template - // using HashMapTemplate = std::unordered_multimap, - // allocators::CountingAllocator>>; using hash_t = HashMapTemplate; using sthash_t = HashMapTemplate; using typelesshash_t = HashMapTemplate; using ldhash_t = HashMapTemplate; - // typedef std::unordered_multimap, - // utils::STLPoolAllocator>> - // hash_t; - // typedef std::unordered_multimap< - // int64_t, rowgroup::Row::Pointer, hasher, std::equal_to, - // utils::STLPoolAllocator>> - // sthash_t; - // typedef std::unordered_multimap< - // TypelessData, rowgroup::Row::Pointer, hasher, std::equal_to, - // utils::STLPoolAllocator>> - // 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>> - // ldhash_t; typedef hash_t::iterator iterator; typedef typelesshash_t::iterator thIterator; diff --git a/utils/windowfunction/idborderby.cpp b/utils/windowfunction/idborderby.cpp index fd8713dbd..b1b9849a4 100644 --- a/utils/windowfunction/idborderby.cpp +++ b/utils/windowfunction/idborderby.cpp @@ -776,12 +776,11 @@ void IdbOrderBy::initialize(const RowGroup& rg) // These two blocks contain structs with memory accounting. fOrderByQueue.reset(new SortingPQ(rowgroup::rgCommonSize, fRm->getAllocator())); - // WIP - // if (fDistinct) - // { - // fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()), - // utils::STLPoolAllocator(fRm))); - // } + if (fDistinct) + { + fDistinctMap.reset(new DistinctMap_t(10, Hasher(this, getKeyLength()), Eq(this, getKeyLength()), + utils::STLPoolAllocator(fRm))); + } } bool IdbOrderBy::getData(RGData& data)