Skip to content

Commit

Permalink
system.events and system.metrics tables add column name as an alias t…
Browse files Browse the repository at this point in the history
…o event and metric
  • Loading branch information
xiedeyantu committed Jul 19, 2023
1 parent 4bb9530 commit d0e8860
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Storages/System/StorageSystemEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ NamesAndTypesList StorageSystemEvents::getNamesAndTypes()
};
}

NamesAndAliases StorageSystemEvents::getNamesAndAliases()
{
return {
{"name", std::make_shared<DataTypeString>(), "event"}
};
}

void StorageSystemEvents::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
{
for (ProfileEvents::Event i = ProfileEvents::Event(0), end = ProfileEvents::end(); i < end; ++i)
Expand Down
1 change: 1 addition & 0 deletions src/Storages/System/StorageSystemEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class StorageSystemEvents final : public IStorageSystemOneBlock<StorageSystemEve

static NamesAndTypesList getNamesAndTypes();

static NamesAndAliases getNamesAndAliases();
protected:
using IStorageSystemOneBlock::IStorageSystemOneBlock;

Expand Down
7 changes: 7 additions & 0 deletions src/Storages/System/StorageSystemMetrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ NamesAndTypesList StorageSystemMetrics::getNamesAndTypes()
};
}

NamesAndAliases StorageSystemMetrics::getNamesAndAliases()
{
return {
{"name", std::make_shared<DataTypeString>(), "metric"}
};
}

void StorageSystemMetrics::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
{
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)
Expand Down
1 change: 1 addition & 0 deletions src/Storages/System/StorageSystemMetrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class StorageSystemMetrics final : public IStorageSystemOneBlock<StorageSystemMe

static NamesAndTypesList getNamesAndTypes();

static NamesAndAliases getNamesAndAliases();
protected:
using IStorageSystemOneBlock::IStorageSystemOneBlock;

Expand Down

0 comments on commit d0e8860

Please sign in to comment.