Skip to content

Commit 7982408

Browse files
correct tests
1 parent f7affa2 commit 7982408

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

ydb/core/formats/arrow/common/sparsed_accessor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ std::shared_ptr<arrow::Scalar> TSparsedArrayChunk::GetScalar(const ui32 index) c
204204
void TSparsedArray::TBuilder::AddChunk(const ui32 recordsCount, const std::shared_ptr<arrow::RecordBatch>& data) {
205205
AFL_VERIFY(data);
206206
AFL_VERIFY(recordsCount);
207-
AFL_VERIFY(data->num_rows() <= recordsCount);
208-
AFL_VERIFY(data->num_columns() == 2);
209-
AFL_VERIFY(data->column(0)->type_id() == arrow::uint32()->id());
210-
AFL_VERIFY_DEBUG(data->schema()->field(0)->name() == "index");
207+
AFL_VERIFY(data->num_rows() <= recordsCount)("rows", data->num_rows())("count", recordsCount);
208+
AFL_VERIFY(data->num_columns() == 2)("count", data->num_columns());
209+
AFL_VERIFY(data->column(0)->type_id() == arrow::uint32()->id())("type", data->column(0)->type()->ToString());
210+
AFL_VERIFY_DEBUG(data->schema()->field(0)->name() == "index")("name", data->schema()->field(0)->name());
211211
if (data->num_rows()) {
212212
auto* arr = static_cast<const arrow::UInt32Array*>(data->column(0).get());
213213
AFL_VERIFY(arr->Value(arr->length() - 1) < recordsCount)("val", arr->Value(arr->length() - 1))("count", recordsCount);

ydb/core/tx/columnshard/engines/changes/compaction/sparsed/logic.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,31 @@ TSparsedMerger::TWriter::TWriter(const TColumnMergeContext& context)
6767
bool TSparsedMerger::TCursor::AddIndexTo(const ui32 index, TWriter& writer) {
6868
if (index < NextGlobalPosition) {
6969
return false;
70+
} else if (index == NextGlobalPosition) {
71+
if (index == Chunk->GetFinishPosition()) {
72+
InitArrays(index);
73+
if (index != NextGlobalPosition) {
74+
return false;
75+
}
76+
}
77+
writer.AddRealData(Chunk->GetColValue(), NextLocalPosition);
78+
if (++NextLocalPosition < Chunk->GetNotDefaultRecordsCount()) {
79+
NextGlobalPosition = CommonShift + Chunk->GetIndexUnsafeFast(NextLocalPosition);
80+
return true;
81+
} else {
82+
NextGlobalPosition = CommonShift + Chunk->GetRecordsCount();
83+
return false;
84+
}
7085
}
7186
AFL_VERIFY(Chunk->GetStartPosition() <= index);
7287
if (Chunk->GetFinishPosition() <= index) {
7388
InitArrays(index);
7489
}
7590
bool found = false;
76-
for (ui32 i = NextLocalPosition; i < Chunk->GetNotDefaultRecordsCount(); ++i) {
77-
NextLocalPosition = i;
78-
NextGlobalPosition = CommonShift + Chunk->GetIndexUnsafeFast(i);
91+
for (; NextLocalPosition < Chunk->GetNotDefaultRecordsCount(); ++NextLocalPosition) {
92+
NextGlobalPosition = CommonShift + Chunk->GetIndexUnsafeFast(NextLocalPosition);
7993
if (NextGlobalPosition == index) {
80-
writer.AddRealData(Chunk->GetColValue(), i);
94+
writer.AddRealData(Chunk->GetColValue(), NextLocalPosition);
8195
found = true;
8296
} else if (index < NextGlobalPosition) {
8397
return found;

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);

0 commit comments

Comments
 (0)