diff options
| author | Andrey Zaspa <[email protected]> | 2025-06-24 16:28:57 +0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-24 15:28:57 +0300 |
| commit | 31c56cf173512c6146fc2dca55a0625f970d530c (patch) | |
| tree | a8d2aa1fae17ffb10c53a5880ba3da2569b2f048 | |
| parent | ceb07eeb035975336c364b5ed589fb516d6e8083 (diff) | |
Get SysView available types for each SourceObject type (#20076)
| -rw-r--r-- | ydb/core/sys_view/common/schema.cpp | 28 | ||||
| -rw-r--r-- | ydb/core/sys_view/common/schema.h | 2 |
2 files changed, 30 insertions, 0 deletions
diff --git a/ydb/core/sys_view/common/schema.cpp b/ydb/core/sys_view/common/schema.cpp index cfb3140edb8..a315f1fdbae 100644 --- a/ydb/core/sys_view/common/schema.cpp +++ b/ydb/core/sys_view/common/schema.cpp @@ -210,6 +210,19 @@ public: 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) || @@ -221,7 +234,9 @@ private: 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( @@ -255,13 +270,16 @@ private: 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]); } @@ -332,9 +350,13 @@ private: 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; }; @@ -375,12 +397,18 @@ public: 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() { diff --git a/ydb/core/sys_view/common/schema.h b/ydb/core/sys_view/common/schema.h index d76aeffd6f3..64ced80a5ac 100644 --- a/ydb/core/sys_view/common/schema.h +++ b/ydb/core/sys_view/common/schema.h @@ -839,6 +839,8 @@ public: 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(); |
