diff --git a/dbcon/joblist/groupconcat.cpp b/dbcon/joblist/groupconcat.cpp index 9a508794f..c1d33aae2 100644 --- a/dbcon/joblist/groupconcat.cpp +++ b/dbcon/joblist/groupconcat.cpp @@ -22,7 +22,7 @@ #include // #define NDEBUG #include -#include + #include #include "windowfunction/idborderby.h" using namespace std; @@ -467,9 +467,9 @@ void GroupConcator::initialize(const rowgroup::SP_GroupConcat& gcc) fRm = gcc->fRm; fSessionMemLimit = gcc->fSessionMemLimit; - for (const auto& str : views::keys(gcc->fConstCols)) + for (const auto& str : gcc->fConstCols) { - fConstantLen += str.length(); + fConstantLen += str.first.length(); } } @@ -714,7 +714,8 @@ void GroupConcator::outputRow(std::ostringstream& oss, const rowgroup::Row& row) bool GroupConcator::concatColIsNull(const rowgroup::Row& row) { - return ranges::any_of(fConcatColumns, [&](uint32_t idx) { return row.isNullValue(idx); }); + return std::any_of(fConcatColumns.cbegin(), fConcatColumns.cend(), + [&row](uint32_t idx) { return row.isNullValue(idx); }); } int64_t GroupConcator::lengthEstimate(const rowgroup::Row& row) @@ -987,6 +988,7 @@ void GroupConcatOrderBy::initialize(const rowgroup::SP_GroupConcat& gcc) fOrderByCond.resize(0); + fOrderByCond.reserve(gcc->fOrderCond.size()); for (const auto& [idx, asc] : gcc->fOrderCond) { fOrderByCond.emplace_back(idx, asc); @@ -994,9 +996,10 @@ void GroupConcatOrderBy::initialize(const rowgroup::SP_GroupConcat& gcc) fDistinct = gcc->fDistinct; - for (uint32_t x : views::values(gcc->fGroupCols)) + fConcatColumns.reserve(fConcatColumns.size() + gcc->fGroupCols.size()); + for (auto& x : gcc->fGroupCols) { - fConcatColumns.emplace_back(x); + fConcatColumns.emplace_back(x.second); } auto size = fRowGroup.getSizeWithStrings(fRowsPerRG); @@ -1048,9 +1051,10 @@ void GroupConcatOrderBy::serialize(messageqcpp::ByteStream& bs) const { sz = fDistinctMap->size(); bs << sz; - for (const auto& idx : views::values(*fDistinctMap)) + + for (const auto& idx : *fDistinctMap) { - bs << idx; + bs << idx.second; } } sz = fOrderByQueue->size(); @@ -1435,9 +1439,11 @@ void GroupConcatNoOrder::initialize(const rowgroup::SP_GroupConcat& gcc) fRowGroup.setUseOnlyLongString(true); fRowsPerRG = 128; - for (uint32_t colIdx : views::values(gcc->fGroupCols)) + fConcatColumns.reserve(fConcatColumns.size() + gcc->fGroupCols.size()); + + for (auto& colIdx : gcc->fGroupCols) { - fConcatColumns.push_back(colIdx); + fConcatColumns.push_back(colIdx.second); } createNewRGData(); diff --git a/utils/rowgroup/rowgroup.cpp b/utils/rowgroup/rowgroup.cpp index dc5e5790b..0b620db45 100644 --- a/utils/rowgroup/rowgroup.cpp +++ b/utils/rowgroup/rowgroup.cpp @@ -428,7 +428,7 @@ RGData::RGData(const RowGroup& rg, allocators::CountingAllocator& if (rg.usesStringTable()) { allocators::CountingAllocator ssAlloc = _alloc; - strings.reset(new StringStore(ssAlloc)); + strings.reset(new StringStore(ssAlloc)); strings->useOnlyLongStrings(rg.usesOnlyLongString()); } @@ -455,12 +455,12 @@ void RGData::reinit(const RowGroup& rg, uint32_t rowCount) if (alloc) { allocators::CountingAllocator ssAlloc = alloc.value(); - strings.reset(new StringStore(ssAlloc)); + strings.reset(new StringStore(ssAlloc)); strings->useOnlyLongStrings(rg.usesOnlyLongString()); } else { - strings.reset(new StringStore()); + strings.reset(new StringStore()); } } else @@ -1368,7 +1368,7 @@ void RowGroup::deserialize(ByteStream& bs) charsets.insert(charsets.begin(), charsetNumbers.size(), nullptr); } -void RowGroup::setUseAggregateDataStore(bool b, std::span> group_concats) +void RowGroup::setUseAggregateDataStore(bool b, boost::span> group_concats) { idbassert(!b || !group_concats.empty()); if (useAggregateDataStore && !b) diff --git a/utils/rowgroup/rowgroup.h b/utils/rowgroup/rowgroup.h index b726c0550..8ee18060e 100644 --- a/utils/rowgroup/rowgroup.h +++ b/utils/rowgroup/rowgroup.h @@ -27,12 +27,13 @@ #pragma once -#include #include #include #include // #define NDEBUG #include + +#include #include #include @@ -1103,7 +1104,7 @@ inline void Row::setStringField(const utils::ConstString& str, uint32_t colIndex } else { - // std::cout << "setStringField memcpy " << std::endl; + // std::cout << "setStringField memcpy " << std::endl; uint8_t* buf = &data[offsets[colIndex]]; memset(buf + length, 0, offsets[colIndex + 1] - (offsets[colIndex] + length)); // needed for memcmp in equals(). @@ -1640,7 +1641,7 @@ class RowGroup : public messageqcpp::Serializeable { return useOnlyLongStrings; } - void setUseAggregateDataStore(bool b, std::span> group_concats = {}); + void setUseAggregateDataStore(bool b, boost::span> group_concats = {}); bool usesAggregateDataStore() const { return useAggregateDataStore; @@ -2314,7 +2315,7 @@ inline void RGData::getRow(uint32_t num, Row* row) { uint32_t incomingRowSize = row->getSize(); idbassert(columnCount == row->getColumnCount() && rowSize == incomingRowSize); - + row->setData( Row::Pointer(&rowData[RowGroup::getHeaderSize() + (num * incomingRowSize)], strings.get(), userDataStore.get(), aggregateDataStore.get()));