Skip to content

Commit bc277d9

Browse files
Merge c8b77a8 into 34b6297
2 parents 34b6297 + c8b77a8 commit bc277d9

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

ydb/core/tx/columnshard/engines/changes/compaction/merger.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ std::vector<NKikimr::NOlap::TWritePortionInfoWithBlobsResult> TMerger::Execute(c
2020
arrow::FieldVector indexFields;
2121
indexFields.emplace_back(IColumnMerger::PortionIdField);
2222
indexFields.emplace_back(IColumnMerger::PortionRecordIndexField);
23-
IIndexInfo::AddSpecialFields(indexFields);
23+
if (resultFiltered->HasColumnId((ui32)IIndexInfo::ESpecialColumn::DELETE_FLAG)) {
24+
IIndexInfo::AddDeleteFields(indexFields);
25+
}
26+
IIndexInfo::AddSnapshotFields(indexFields);
2427
auto dataSchema = std::make_shared<arrow::Schema>(indexFields);
2528
NArrow::NMerger::TMergePartialStream mergeStream(
2629
resultFiltered->GetIndexInfo().GetReplaceKey(), dataSchema, false, IIndexInfo::GetSnapshotColumnNames());
@@ -137,7 +140,7 @@ std::vector<NKikimr::NOlap::TWritePortionInfoWithBlobsResult> TMerger::Execute(c
137140
TGeneralSerializedSlice slice(dataWithSecondary.GetExternalData(), schemaDetails, Context.Counters.SplitterCounters);
138141

139142
auto b = batchResult->Slice(recordIdx, slice.GetRecordsCount());
140-
const ui32 deletionsCount = IIndexInfo::CalcDeletions(b, true);
143+
const ui32 deletionsCount = IIndexInfo::CalcDeletions(b, false);
141144
auto constructor = TWritePortionInfoWithBlobsConstructor::BuildByBlobs(slice.GroupChunksByBlobs(groups),
142145
dataWithSecondary.GetSecondaryInplaceData(), pathId, resultFiltered->GetVersion(), resultFiltered->GetSnapshot(),
143146
SaverContext.GetStoragesManager());

ydb/core/tx/columnshard/engines/changes/indexation.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ TConclusionStatus TInsertColumnEngineChanges::DoConstructBlobs(TConstructionCont
160160
auto blobSchema = context.SchemaVersions.GetSchemaVerified(inserted.GetSchemaVersion());
161161
std::vector<ui32> filteredIds = inserted.GetMeta().GetSchemaSubset().Apply(blobSchema->GetIndexInfo().GetColumnIds(true));
162162
usageColumnIds.insert(filteredIds.begin(), filteredIds.end());
163+
if (inserted.GetMeta().GetModificationType() == NEvWrite::EModificationType::Delete) {
164+
usageColumnIds.emplace((ui32)IIndexInfo::ESpecialColumn::DELETE_FLAG);
165+
}
163166
if (usageColumnIds.size() == resultSchema->GetIndexInfo().GetColumnIds(true).size()) {
164167
break;
165168
}
@@ -179,8 +182,10 @@ TConclusionStatus TInsertColumnEngineChanges::DoConstructBlobs(TConstructionCont
179182
}
180183

181184
IIndexInfo::AddSnapshotColumns(*batch, inserted.GetSnapshot());
182-
IIndexInfo::AddDeleteFlagsColumn(*batch, inserted.GetMeta().GetModificationType() == NEvWrite::EModificationType::Delete);
183-
usageColumnIds.insert(IIndexInfo::GetSystemColumnIds().begin(), IIndexInfo::GetSystemColumnIds().end());
185+
if (usageColumnIds.contains((ui32)IIndexInfo::ESpecialColumn::DELETE_FLAG)) {
186+
IIndexInfo::AddDeleteFlagsColumn(*batch, inserted.GetMeta().GetModificationType() == NEvWrite::EModificationType::Delete);
187+
}
188+
usageColumnIds.insert(IIndexInfo::GetSnapshotColumnIds().begin(), IIndexInfo::GetSnapshotColumnIds().end());
184189

185190
batch = resultSchema->NormalizeBatch(*blobSchema, batch, usageColumnIds).DetachResult();
186191
pathBatches.Add(inserted, shardingFilterCommit, batch);

ydb/core/tx/columnshard/engines/scheme/abstract/index_info.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class IIndexInfo {
7777
fields.push_back(arrow::field(SPEC_COL_TX_ID, arrow::uint64()));
7878
}
7979

80+
static void AddDeleteFields(std::vector<std::shared_ptr<arrow::Field>>& fields) {
81+
fields.push_back(arrow::field(SPEC_COL_DELETE_FLAG, arrow::boolean()));
82+
}
83+
8084
static const std::set<ui32>& GetSnapshotColumnIdsSet() {
8185
static const std::set<ui32> result = { (ui32)ESpecialColumn::PLAN_STEP, (ui32)ESpecialColumn::TX_ID };
8286
return result;

0 commit comments

Comments
 (0)