Skip to content

Commit de7ba85

Browse files
authored
Merge pull request mariadb-corporation#2840 from tntnatbry/MCOL-5491
MCOL-5491 Enable StringStore for long strings in JSON_ARRAYAGG processing.
2 parents d3778e3 + 87eb875 commit de7ba85

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

dbcon/joblist/jsonarrayagg.cpp

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ void JsonArrayInfo::mapColumns(const RowGroup& projRG)
260260

261261
(*k)->fRowGroup = RowGroup(oids.size(), pos, oids, keys, types, csNums, scale, precision,
262262
projRG.getStringTableThreshold(), false);
263+
264+
// MCOL-5491/MCOL-5429 Use stringstore if the datatype of the
265+
// json_arrayagg/group_concat field is a long string.
266+
if ((*k)->fRowGroup.hasLongString())
267+
{
268+
(*k)->fRowGroup.setUseStringTable(true);
269+
}
270+
263271
(*k)->fMapping = makeMapping(projRG, (*k)->fRowGroup);
264272
}
265273
}
@@ -311,9 +319,24 @@ void JsonArrayAggregatAgUM::initialize()
311319

312320
fConcator->initialize(fGroupConcat);
313321

314-
fGroupConcat->fRowGroup.initRow(&fRow, true);
315-
fData.reset(new uint8_t[fRow.getSize()]);
316-
fRow.setData(rowgroup::Row::Pointer(fData.get()));
322+
// MCOL-5491/MCOL-5429 Use stringstore if the datatype of the
323+
// json_arrayagg/group_concat field is a long string.
324+
if (fGroupConcat->fRowGroup.hasLongString())
325+
{
326+
fRowGroup = fGroupConcat->fRowGroup;
327+
fRowGroup.setUseStringTable(true);
328+
fRowRGData.reinit(fRowGroup, 1);
329+
fRowGroup.setData(&fRowRGData);
330+
fRowGroup.resetRowGroup(0);
331+
fRowGroup.initRow(&fRow);
332+
fRowGroup.getRow(0, &fRow);
333+
}
334+
else
335+
{
336+
fGroupConcat->fRowGroup.initRow(&fRow, true);
337+
fData.reset(new uint8_t[fRow.getSize()]);
338+
fRow.setData(rowgroup::Row::Pointer(fData.get()));
339+
}
317340
}
318341

319342
void JsonArrayAggregatAgUM::processRow(const rowgroup::Row& inRow)

0 commit comments

Comments
 (0)