Skip to content

Commit 358f624

Browse files
use only long string storage for the group_concat data to reduce memory usage
1 parent 31dba90 commit 358f624

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

dbcon/joblist/groupconcat.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ void GroupConcatAgUM::initialize()
332332
{
333333
fRowGroup = fGroupConcat->fRowGroup;
334334
fRowGroup.setUseStringTable(true);
335+
fRowGroup.setUseOnlyLongString(true);
335336
fRowRGData.reinit(fRowGroup, 1);
336337
fRowGroup.setData(&fRowRGData);
337338
fRowGroup.resetRowGroup(0);
@@ -992,6 +993,7 @@ void GroupConcatNoOrder::initialize(const rowgroup::SP_GroupConcat& gcc)
992993
GroupConcator::initialize(gcc);
993994

994995
fRowGroup = gcc->fRowGroup;
996+
fRowGroup.setUseOnlyLongString(true);
995997
fRowsPerRG = 128;
996998
fErrorCode = ERR_AGGREGATION_TOO_BIG;
997999
fRm = gcc->fRm;
@@ -1004,7 +1006,7 @@ void GroupConcatNoOrder::initialize(const rowgroup::SP_GroupConcat& gcc)
10041006

10051007
uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize();
10061008

1007-
if (!fRm->getMemory(newSize, fSessionMemLimit))
1009+
if (fRm && !fRm->getMemory(newSize, fSessionMemLimit))
10081010
{
10091011
cerr << IDBErrorInfo::instance()->errorMsg(fErrorCode) << " @" << __FILE__ << ":" << __LINE__;
10101012
throw IDBExcept(fErrorCode);
@@ -1014,6 +1016,7 @@ void GroupConcatNoOrder::initialize(const rowgroup::SP_GroupConcat& gcc)
10141016

10151017
fData.reinit(fRowGroup, fRowsPerRG);
10161018
fRowGroup.setData(&fData);
1019+
fRowGroup.setUseOnlyLongString(true);
10171020
fRowGroup.resetRowGroup(0);
10181021
fRowGroup.initRow(&fRow);
10191022
fRowGroup.getRow(0, &fRow);

utils/common/nullstring.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
namespace utils
3232
{
33-
// A class for striings that can hold NULL values - a value that is separate from all possible string.
33+
// A class for strings that can hold NULL values - a value that is separate from all possible string.
3434
class NullString
3535
{
3636
protected:
@@ -59,6 +59,9 @@ class NullString
5959
{
6060
assign((const uint8_t*)str.str(), str.length());
6161
}
62+
size_t getDataSize() const {
63+
return mStrPtr ? mStrPtr->capacity() : 0;
64+
}
6265
ConstString toConstString() const
6366
{
6467
if (isNull())

0 commit comments

Comments
 (0)