Skip to content

Commit 2ea3ab3

Browse files
authored
support basic stats for column tables (#1014)
1 parent 7c304f6 commit 2ea3ab3

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

ydb/core/tx/schemeshard/schemeshard_impl.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -7052,7 +7052,18 @@ void TSchemeShard::SendBaseStatsToSA() {
70527052
entry->SetBytesSize(aggregated.DataSize);
70537053
++count;
70547054
}
7055-
// TODO: add column tables
7055+
auto columnTablesPathIds = ColumnTables.GetAllPathIds();
7056+
for (const auto& pathId : columnTablesPathIds) {
7057+
const auto& tableInfo = ColumnTables.GetVerified(pathId);
7058+
const auto& aggregated = tableInfo->Stats.Aggregated;
7059+
auto* entry = record.AddEntries();
7060+
auto* entryPathId = entry->MutablePathId();
7061+
entryPathId->SetOwnerId(pathId.OwnerId);
7062+
entryPathId->SetLocalId(pathId.LocalPathId);
7063+
entry->SetRowCount(aggregated.RowCount);
7064+
entry->SetBytesSize(aggregated.DataSize);
7065+
++count;
7066+
}
70567067

70577068
TString stats;
70587069
stats.clear();

ydb/core/tx/schemeshard/schemeshard_tables_storage.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,12 @@ bool TTablesStorage::TTableCreateOperator::InitShardingTablets(const TColumnTabl
148148
return true;
149149
}
150150

151+
std::unordered_set<TPathId> TTablesStorage::GetAllPathIds() const {
152+
std::unordered_set<TPathId> result;
153+
for (const auto& [pathId, _] : Tables) {
154+
result.emplace(pathId);
155+
}
156+
return result;
157+
}
158+
151159
}

ydb/core/tx/schemeshard/schemeshard_tables_storage.h

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class TTablesStorage {
159159
void OnRemoveObject(const TPathId& pathId, TColumnTableInfo::TPtr object);
160160
TColumnTableInfo::TPtr ExtractPtr(const TPathId& id);
161161
public:
162+
std::unordered_set<TPathId> GetAllPathIds() const;
162163

163164
TColumnTablesLayout GetTablesLayout(const std::vector<ui64>& tabletIds) const;
164165

0 commit comments

Comments
 (0)