aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.com>2023-10-31 09:05:49 +0300
committerivanmorozov <ivanmorozov@yandex-team.com>2023-10-31 09:35:47 +0300
commit6abc4a33e4a6d705f718946517829a7357b777ef (patch)
tree1ce7dafd977b44ff24a035f4fa655024a7d382f5
parent4e7b97189e647c18d0e0ad17b9347f2b3613e8a9 (diff)
downloadydb-6abc4a33e4a6d705f718946517829a7357b777ef.tar.gz
use stats as pointer
-rw-r--r--ydb/core/tx/columnshard/engines/changes/general_compaction.cpp8
-rw-r--r--ydb/core/tx/columnshard/engines/changes/with_appended.cpp4
-rw-r--r--ydb/core/tx/columnshard/engines/storage/granule.h6
-rw-r--r--ydb/core/tx/columnshard/splitter/batch_slice.h12
4 files changed, 15 insertions, 15 deletions
diff --git a/ydb/core/tx/columnshard/engines/changes/general_compaction.cpp b/ydb/core/tx/columnshard/engines/changes/general_compaction.cpp
index 9790dfba78..e165bb59e8 100644
--- a/ydb/core/tx/columnshard/engines/changes/general_compaction.cpp
+++ b/ydb/core/tx/columnshard/engines/changes/general_compaction.cpp
@@ -83,16 +83,16 @@ TConclusionStatus TGeneralCompactColumnEngineChanges::DoConstructBlobs(TConstruc
}
Y_ABORT_UNLESS(batchResults.size());
- TSerializationStats stats;
+ std::shared_ptr<TSerializationStats> stats = std::make_shared<TSerializationStats>();
for (auto&& i : SwitchedPortions) {
- stats.Merge(i.GetSerializationStat(*resultSchema));
+ stats->Merge(i.GetSerializationStat(*resultSchema));
}
std::vector<std::map<std::string, std::vector<TColumnPortionResult>>> chunkGroups;
chunkGroups.resize(batchResults.size());
for (auto&& f : resultSchema->GetSchema()->fields()) {
const ui32 columnId = resultSchema->GetColumnId(f->name());
- auto columnInfo = stats.GetColumnInfo(columnId);
+ auto columnInfo = stats->GetColumnInfo(columnId);
Y_ABORT_UNLESS(columnInfo);
std::vector<TPortionColumnCursor> cursors;
@@ -164,7 +164,7 @@ TConclusionStatus TGeneralCompactColumnEngineChanges::DoConstructBlobs(TConstruc
}
std::vector<TGeneralSerializedSlice> batchSlices;
- std::shared_ptr<TDefaultSchemaDetails> schemaDetails(new TDefaultSchemaDetails(resultSchema, SaverContext, std::move(stats)));
+ std::shared_ptr<TDefaultSchemaDetails> schemaDetails(new TDefaultSchemaDetails(resultSchema, SaverContext, stats));
for (ui32 i = 0; i < columnChunks.begin()->second.size(); ++i) {
std::map<ui32, std::vector<IPortionColumnChunk::TPtr>> portionColumns;
diff --git a/ydb/core/tx/columnshard/engines/changes/with_appended.cpp b/ydb/core/tx/columnshard/engines/changes/with_appended.cpp
index 5d28cc9b8a..bdda3b38c6 100644
--- a/ydb/core/tx/columnshard/engines/changes/with_appended.cpp
+++ b/ydb/core/tx/columnshard/engines/changes/with_appended.cpp
@@ -107,11 +107,11 @@ std::vector<TPortionInfoWithBlobs> TChangesWithAppend::MakeAppendedPortions(cons
auto resultSchema = context.SchemaVersions.GetSchema(snapshot);
std::vector<TPortionInfoWithBlobs> out;
- NOlap::TSerializationStats stats;
+ std::shared_ptr<NOlap::TSerializationStats> stats = std::make_shared<NOlap::TSerializationStats>();
if (granuleMeta) {
stats = granuleMeta->BuildSerializationStats(resultSchema);
}
- auto schema = std::make_shared<TDefaultSchemaDetails>(resultSchema, SaverContext, std::move(stats));
+ auto schema = std::make_shared<TDefaultSchemaDetails>(resultSchema, SaverContext, stats);
TRBSplitLimiter limiter(context.Counters.SplitterCounters, schema, batch, SplitSettings);
std::vector<std::vector<IPortionColumnChunk::TPtr>> chunkByBlobs;
diff --git a/ydb/core/tx/columnshard/engines/storage/granule.h b/ydb/core/tx/columnshard/engines/storage/granule.h
index 3d17a0a6dd..1e72a2e7ea 100644
--- a/ydb/core/tx/columnshard/engines/storage/granule.h
+++ b/ydb/core/tx/columnshard/engines/storage/granule.h
@@ -203,14 +203,14 @@ public:
}
}
- NOlap::TSerializationStats BuildSerializationStats(ISnapshotSchema::TPtr schema) const {
- NOlap::TSerializationStats result;
+ std::shared_ptr<NOlap::TSerializationStats> BuildSerializationStats(ISnapshotSchema::TPtr schema) const {
+ auto result = std::make_shared<NOlap::TSerializationStats>();
for (auto&& i : GetAdditiveSummary().GetCompacted().GetColumnStats()) {
auto field = schema->GetFieldByColumnId(i.first);
AFL_VERIFY(field)("column_id", i.first)("schema", schema->DebugString());
NOlap::TColumnSerializationStat columnInfo(i.first, field->name());
columnInfo.Merge(i.second);
- result.AddStat(columnInfo);
+ result->AddStat(columnInfo);
}
return result;
}
diff --git a/ydb/core/tx/columnshard/splitter/batch_slice.h b/ydb/core/tx/columnshard/splitter/batch_slice.h
index 206561373f..5edc9c18d1 100644
--- a/ydb/core/tx/columnshard/splitter/batch_slice.h
+++ b/ydb/core/tx/columnshard/splitter/batch_slice.h
@@ -53,14 +53,14 @@ class TDefaultSchemaDetails: public ISchemaDetailInfo {
private:
ISnapshotSchema::TPtr Schema;
const TSaverContext Context;
- TSerializationStats Stats;
+ std::shared_ptr<TSerializationStats> Stats;
public:
- TDefaultSchemaDetails(ISnapshotSchema::TPtr schema, const TSaverContext& context, TSerializationStats&& stats)
+ TDefaultSchemaDetails(ISnapshotSchema::TPtr schema, const TSaverContext& context, const std::shared_ptr<TSerializationStats>& stats)
: Schema(schema)
, Context(context)
- , Stats(std::move(stats))
+ , Stats(stats)
{
-
+ AFL_VERIFY(Stats);
}
virtual std::shared_ptr<arrow::Field> GetField(const ui32 columnId) const override {
return Schema->GetFieldByColumnId(columnId);
@@ -73,10 +73,10 @@ public:
}
virtual std::optional<TColumnSerializationStat> GetColumnSerializationStats(const ui32 columnId) const override {
- return Stats.GetColumnInfo(columnId);
+ return Stats->GetColumnInfo(columnId);
}
virtual std::optional<TBatchSerializationStat> GetBatchSerializationStats(const std::shared_ptr<arrow::RecordBatch>& rb) const override {
- return Stats.GetStatsForRecordBatch(rb);
+ return Stats->GetStatsForRecordBatch(rb);
}
virtual ui32 GetColumnId(const std::string& fieldName) const override {
return Schema->GetColumnId(fieldName);