1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

fix(build): replace std::ranges usage for gcc9 and std::span with boost::span

This commit is contained in:
Leonid Fedorov
2025-04-15 12:10:18 +00:00
committed by Leonid Fedorov
parent 6a712dc0ad
commit 432d0cf7f8
3 changed files with 25 additions and 18 deletions

View File

@ -22,7 +22,7 @@
#include <iostream>
// #define NDEBUG
#include <cassert>
#include <ranges>
#include <string>
#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();

View File

@ -428,7 +428,7 @@ RGData::RGData(const RowGroup& rg, allocators::CountingAllocator<RGDataBufType>&
if (rg.usesStringTable())
{
allocators::CountingAllocator<StringStoreBufType> 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<StringStoreBufType> 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<boost::shared_ptr<GroupConcat>> group_concats)
void RowGroup::setUseAggregateDataStore(bool b, boost::span<boost::shared_ptr<GroupConcat>> group_concats)
{
idbassert(!b || !group_concats.empty());
if (useAggregateDataStore && !b)

View File

@ -27,12 +27,13 @@
#pragma once
#include <span>
#include <vector>
#include <string>
#include <stdexcept>
// #define NDEBUG
#include <cassert>
#include <boost/core/span.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
@ -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<boost::shared_ptr<GroupConcat>> group_concats = {});
void setUseAggregateDataStore(bool b, boost::span<boost::shared_ptr<GroupConcat>> 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()));