Skip to content

Commit

Permalink
support basic stats for column tables
Browse files Browse the repository at this point in the history
  • Loading branch information
alexd65536 committed Jan 15, 2024
1 parent 35977c7 commit b68f677
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ydb/core/tx/schemeshard/schemeshard_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7052,7 +7052,18 @@ void TSchemeShard::SendBaseStatsToSA() {
entry->SetBytesSize(aggregated.DataSize);
++count;
}
// TODO: add column tables
auto columnTablesPathIds = ColumnTables.GetAllPathIds();
for (const auto& pathId : columnTablesPathIds) {
const auto& tableInfo = ColumnTables.GetVerified(pathId);
const auto& aggregated = tableInfo->Stats.Aggregated;
auto* entry = record.AddEntries();
auto* entryPathId = entry->MutablePathId();
entryPathId->SetOwnerId(pathId.OwnerId);
entryPathId->SetLocalId(pathId.LocalPathId);
entry->SetRowCount(aggregated.RowCount);
entry->SetBytesSize(aggregated.DataSize);
++count;
}

TString stats;
stats.clear();
Expand Down
8 changes: 8 additions & 0 deletions ydb/core/tx/schemeshard/schemeshard_tables_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,12 @@ bool TTablesStorage::TTableCreateOperator::InitShardingTablets(const TColumnTabl
return true;
}

std::unordered_set<TPathId> TTablesStorage::GetAllPathIds() const {
std::unordered_set<TPathId> result;
for (const auto& [pathId, _] : Tables) {
result.emplace(pathId);
}
return result;
}

}
1 change: 1 addition & 0 deletions ydb/core/tx/schemeshard/schemeshard_tables_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ class TTablesStorage {
void OnRemoveObject(const TPathId& pathId, TColumnTableInfo::TPtr object);
TColumnTableInfo::TPtr ExtractPtr(const TPathId& id);
public:
std::unordered_set<TPathId> GetAllPathIds() const;

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

Expand Down

0 comments on commit b68f677

Please sign in to comment.