Skip to content

Commit a1c57b1

Browse files
committed
process chunks in order
1 parent a9f62d1 commit a1c57b1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Processors/Formats/Impl/ParquetBlockOutputFormat.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,17 @@ void ParquetBlockOutputFormat::writeRowGroup(std::vector<Chunk> chunks)
306306
else
307307
{
308308
Chunk concatenated;
309-
while (!chunks.empty())
309+
for (auto & chunk : chunks)
310310
{
311311
if (concatenated.empty())
312-
concatenated.swap(chunks.back());
312+
{
313+
concatenated.swap(chunk);
314+
}
313315
else
314-
concatenated.append(chunks.back());
315-
chunks.pop_back();
316+
{
317+
concatenated.append(chunk);
318+
chunk.clear(); // free chunk's buffers so memory is release earlier
319+
}
316320
}
317321
writeRowGroupInOneThread(std::move(concatenated));
318322
}

0 commit comments

Comments
 (0)