system.events and system.metrics tables add column name as an alias to event and metric

This commit is contained in:
xiedeyantu 2023-07-19 17:39:00 +08:00
parent 4bb95305a4
commit d0e886070c
4 changed files with 16 additions and 0 deletions

View File

@ -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 void StorageSystemEvents::fillData(MutableColumns & res_columns, ContextPtr context, const SelectQueryInfo &) const
{ {
for (ProfileEvents::Event i = ProfileEvents::Event(0), end = ProfileEvents::end(); i < end; ++i) for (ProfileEvents::Event i = ProfileEvents::Event(0), end = ProfileEvents::end(); i < end; ++i)

View File

@ -17,6 +17,7 @@ public:
static NamesAndTypesList getNamesAndTypes(); static NamesAndTypesList getNamesAndTypes();
static NamesAndAliases getNamesAndAliases();
protected: protected:
using IStorageSystemOneBlock::IStorageSystemOneBlock; using IStorageSystemOneBlock::IStorageSystemOneBlock;

View File

@ -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 void StorageSystemMetrics::fillData(MutableColumns & res_columns, ContextPtr, const SelectQueryInfo &) const
{ {
for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i) for (size_t i = 0, end = CurrentMetrics::end(); i < end; ++i)

View File

@ -18,6 +18,7 @@ public:
static NamesAndTypesList getNamesAndTypes(); static NamesAndTypesList getNamesAndTypes();
static NamesAndAliases getNamesAndAliases();
protected: protected:
using IStorageSystemOneBlock::IStorageSystemOneBlock; using IStorageSystemOneBlock::IStorageSystemOneBlock;