diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto index 20992baad09e..3766b764d08b 100644 --- a/ydb/core/protos/config.proto +++ b/ydb/core/protos/config.proto @@ -1957,6 +1957,7 @@ message TColumnShardConfig { optional bool OnlyBulkUpsertWritingBuffer = 50 [default = true]; optional uint64 BadPortionSizeLimit = 51 [default = 524288]; optional uint64 BadPortionsLimit = 52; + optional bool CombineChunksInResult = 54 [default = true]; } message TSchemeShardConfig { diff --git a/ydb/core/tx/columnshard/engines/reader/actor/actor.cpp b/ydb/core/tx/columnshard/engines/reader/actor/actor.cpp index 909263a14d19..e256e6e75763 100644 --- a/ydb/core/tx/columnshard/engines/reader/actor/actor.cpp +++ b/ydb/core/tx/columnshard/engines/reader/actor/actor.cpp @@ -412,6 +412,15 @@ bool TColumnShardScan::SendResult(bool pageFault, bool lastBatch) { Result->WaitTime = WaitTime; Result->RawBytes = ScanCountersPool.GetRawBytes(); + if (AppDataVerified().ColumnShardConfig.GetCombineChunksInResult() && Result->ArrowBatch) { + for (const auto& column : Result->ArrowBatch->columns()) { + if (column->num_chunks() > 1) { + Result->ArrowBatch = Result->ArrowBatch->CombineChunks().ValueOr(Result->ArrowBatch); + break; + } + } + } + LWPROBE(SendResult, TabletId, ScanId, TxId, Result->GetRowsCount(), (Result->ArrowBatch ? NArrow::GetTableDataSize(Result->ArrowBatch) : 0), Result->CpuTime, Result->WaitTime, TInstant::Now() - LastSend, Result->Finished); Send(ScanComputeActorId, Result.Release(), IEventHandle::FlagTrackDelivery); // TODO: FlagSubscribeOnSession ? LastSend = TInstant::Now();