Skip to content

Get SysView available types for each SourceObject type #20076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions ydb/core/sys_view/common/schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ class TSystemViewResolver : public ISystemViewResolver {
return result;
}

const THashMap<TString, ESysViewType>& GetSystemViewsTypes(ETarget target) const override {
switch (target) {
case ETarget::Domain:
return DomainSystemViewTypes;
case ETarget::SubDomain:
return SubDomainSystemViewTypes;
case ETarget::OlapStore:
return OlapStoreSystemViewTypes;
case ETarget::ColumnTable:
return ColumnTableSystemViewTypes;
}
}

bool IsSystemView(const TStringBuf viewName) const override final {
return DomainSystemViews.contains(viewName) ||
SubDomainSystemViews.contains(viewName) ||
Expand All @@ -221,7 +234,9 @@ class TSystemViewResolver : public ISystemViewResolver {
void RegisterPgTablesSystemViews() {
auto registerView = [&](TStringBuf tableName, ESysViewType type, const TVector<Schema::PgColumn>& columns) {
auto& dsv = DomainSystemViews[tableName];
DomainSystemViewTypes[tableName] = type;
auto& sdsv = SubDomainSystemViews[tableName];
SubDomainSystemViewTypes[tableName] = type;
auto& sv = SystemViews[type];
for (const auto& column : columns) {
dsv.Columns[column._ColumnId + 1] = TSysTables::TTableColumnInfo(
Expand Down Expand Up @@ -255,13 +270,16 @@ class TSystemViewResolver : public ISystemViewResolver {
template <typename Table>
void RegisterSystemView(const TStringBuf& name, ESysViewType type) {
TSchemaFiller<Table>::Fill(DomainSystemViews[name]);
DomainSystemViewTypes[name] = type;
TSchemaFiller<Table>::Fill(SubDomainSystemViews[name]);
SubDomainSystemViewTypes[name] = type;
TSchemaFiller<Table>::Fill(SystemViews[type]);
}

template <typename Table>
void RegisterDomainSystemView(const TStringBuf& name, ESysViewType type) {
TSchemaFiller<Table>::Fill(DomainSystemViews[name]);
DomainSystemViewTypes[name] = type;
TSchemaFiller<Table>::Fill(SystemViews[type]);
}

Expand Down Expand Up @@ -332,9 +350,13 @@ class TSystemViewResolver : public ISystemViewResolver {

private:
THashMap<TString, TSchema> DomainSystemViews;
THashMap<TString, ESysViewType> DomainSystemViewTypes;
THashMap<TString, TSchema> SubDomainSystemViews;
THashMap<TString, ESysViewType> SubDomainSystemViewTypes;
THashMap<TString, TSchema> OlapStoreSystemViews;
THashMap<TString, ESysViewType> OlapStoreSystemViewTypes;
THashMap<TString, TSchema> ColumnTableSystemViews;
THashMap<TString, ESysViewType> ColumnTableSystemViewTypes;
THashMap<ESysViewType, TSchema> SystemViews;
};

Expand Down Expand Up @@ -375,12 +397,18 @@ class TSystemViewRewrittenResolver : public ISystemViewResolver {
return {};
}

const THashMap<TString, ESysViewType>& GetSystemViewsTypes(ETarget target) const override {
Y_UNUSED(target);
return SystemViewTypes;
}

bool IsSystemView(const TStringBuf viewName) const override final {
return SystemViews.contains(viewName);
}

private:
THashMap<TString, TSchema> SystemViews;
THashMap<TString, ESysViewType> SystemViewTypes;
};

ISystemViewResolver* CreateSystemViewResolver() {
Expand Down
2 changes: 2 additions & 0 deletions ydb/core/sys_view/common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,8 @@ class ISystemViewResolver {
virtual bool IsSystemView(const TStringBuf viewName) const = 0;

virtual TVector<TString> GetSystemViewNames(ETarget target) const = 0;

virtual const THashMap<TString, NKikimrSysView::ESysViewType>& GetSystemViewsTypes(ETarget target) const = 0;
};

ISystemViewResolver* CreateSystemViewResolver();
Expand Down
Loading