@@ -170,6 +170,11 @@ class TSystemViewResolver : public ISystemViewResolver {
170
170
return view ? TMaybe<TSchema>(*view) : Nothing ();
171
171
}
172
172
173
+ TMaybe<TSchema> GetSystemViewSchema (ESysViewType viewType) const override final {
174
+ const TSchema* view = SystemViews.FindPtr (viewType);
175
+ return view ? TMaybe<TSchema>(*view) : Nothing ();
176
+ }
177
+
173
178
TVector<TString> GetSystemViewNames (ETarget target) const override {
174
179
TVector<TString> result;
175
180
switch (target) {
@@ -210,41 +215,50 @@ class TSystemViewResolver : public ISystemViewResolver {
210
215
211
216
private:
212
217
void RegisterPgTablesSystemViews () {
213
- auto registerView = [&](TStringBuf tableName, const TVector<Schema::PgColumn>& columns) {
218
+ auto registerView = [&](TStringBuf tableName, ESysViewType type, const TVector<Schema::PgColumn>& columns) {
214
219
auto & dsv = DomainSystemViews[tableName];
215
220
auto & sdsv = SubDomainSystemViews[tableName];
221
+ auto & sv = SystemViews[type];
216
222
for (const auto & column : columns) {
217
223
dsv.Columns [column._ColumnId + 1 ] = TSysTables::TTableColumnInfo (
218
224
column._ColumnName , column._ColumnId + 1 , column._ColumnTypeInfo , " " , -1
219
225
);
220
226
sdsv.Columns [column._ColumnId + 1 ] = TSysTables::TTableColumnInfo (
221
227
column._ColumnName , column._ColumnId + 1 , column._ColumnTypeInfo , " " , -1
222
228
);
229
+ sv.Columns [column._ColumnId + 1 ] = TSysTables::TTableColumnInfo (
230
+ column._ColumnName , column._ColumnId + 1 , column._ColumnTypeInfo , " " , -1
231
+ );
223
232
}
224
233
};
225
234
registerView (
226
235
PgTablesName,
236
+ ESysViewType::EPgTables,
227
237
Singleton<Schema::PgTablesSchemaProvider>()->GetColumns (PgTablesName)
228
238
);
229
239
registerView (
230
240
InformationSchemaTablesName,
241
+ ESysViewType::EInformationSchemaTables,
231
242
Singleton<Schema::PgTablesSchemaProvider>()->GetColumns (InformationSchemaTablesName)
232
243
);
233
244
registerView (
234
245
PgClassName,
246
+ ESysViewType::EPgClass,
235
247
Singleton<Schema::PgTablesSchemaProvider>()->GetColumns (PgClassName)
236
248
);
237
249
}
238
250
239
251
template <typename Table>
240
- void RegisterSystemView (const TStringBuf& name) {
252
+ void RegisterSystemView (const TStringBuf& name, ESysViewType type ) {
241
253
TSchemaFiller<Table>::Fill (DomainSystemViews[name]);
242
254
TSchemaFiller<Table>::Fill (SubDomainSystemViews[name]);
255
+ TSchemaFiller<Table>::Fill (SystemViews[type]);
243
256
}
244
257
245
258
template <typename Table>
246
- void RegisterDomainSystemView (const TStringBuf& name) {
259
+ void RegisterDomainSystemView (const TStringBuf& name, ESysViewType type ) {
247
260
TSchemaFiller<Table>::Fill (DomainSystemViews[name]);
261
+ TSchemaFiller<Table>::Fill (SystemViews[type]);
248
262
}
249
263
250
264
template <typename Table>
@@ -258,29 +272,29 @@ class TSystemViewResolver : public ISystemViewResolver {
258
272
}
259
273
260
274
void RegisterSystemViews () {
261
- RegisterSystemView<Schema::PartitionStats>(PartitionStatsName);
275
+ RegisterSystemView<Schema::PartitionStats>(PartitionStatsName, ESysViewType::EPartitionStats );
262
276
263
- RegisterSystemView<Schema::Nodes>(NodesName);
277
+ RegisterSystemView<Schema::Nodes>(NodesName, ESysViewType::ENodes );
264
278
265
- RegisterSystemView<Schema::QueryStats>(TopQueriesByDuration1MinuteName);
266
- RegisterSystemView<Schema::QueryStats>(TopQueriesByDuration1HourName);
267
- RegisterSystemView<Schema::QueryStats>(TopQueriesByReadBytes1MinuteName);
268
- RegisterSystemView<Schema::QueryStats>(TopQueriesByReadBytes1HourName);
269
- RegisterSystemView<Schema::QueryStats>(TopQueriesByCpuTime1MinuteName);
270
- RegisterSystemView<Schema::QueryStats>(TopQueriesByCpuTime1HourName);
271
- RegisterSystemView<Schema::QueryStats>(TopQueriesByRequestUnits1MinuteName);
272
- RegisterSystemView<Schema::QueryStats>(TopQueriesByRequestUnits1HourName);
273
- RegisterSystemView<Schema::QuerySessions>(QuerySessions);
279
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByDuration1MinuteName, ESysViewType::ETopQueriesByDurationOneMinute );
280
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByDuration1HourName, ESysViewType::ETopQueriesByDurationOneHour );
281
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByReadBytes1MinuteName, ESysViewType::ETopQueriesByReadBytesOneMinute );
282
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByReadBytes1HourName, ESysViewType::ETopQueriesByReadBytesOneHour );
283
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByCpuTime1MinuteName, ESysViewType::ETopQueriesByCpuTimeOneMinute );
284
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByCpuTime1HourName, ESysViewType::ETopQueriesByCpuTimeOneHour );
285
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByRequestUnits1MinuteName, ESysViewType::ETopQueriesByRequestUnitsOneMinute );
286
+ RegisterSystemView<Schema::QueryStats>(TopQueriesByRequestUnits1HourName, ESysViewType::ETopQueriesByRequestUnitsOneHour );
287
+ RegisterSystemView<Schema::QuerySessions>(QuerySessions, ESysViewType::EQuerySessions );
274
288
275
- RegisterDomainSystemView<Schema::PDisks>(PDisksName);
276
- RegisterDomainSystemView<Schema::VSlots>(VSlotsName);
277
- RegisterDomainSystemView<Schema::Groups>(GroupsName);
278
- RegisterDomainSystemView<Schema::StoragePools>(StoragePoolsName);
279
- RegisterDomainSystemView<Schema::StorageStats>(StorageStatsName);
289
+ RegisterDomainSystemView<Schema::PDisks>(PDisksName, ESysViewType::EPDisks );
290
+ RegisterDomainSystemView<Schema::VSlots>(VSlotsName, ESysViewType::EVSlots );
291
+ RegisterDomainSystemView<Schema::Groups>(GroupsName, ESysViewType::EGroups );
292
+ RegisterDomainSystemView<Schema::StoragePools>(StoragePoolsName, ESysViewType::EStoragePools );
293
+ RegisterDomainSystemView<Schema::StorageStats>(StorageStatsName, ESysViewType::EStorageStats );
280
294
281
- RegisterDomainSystemView<Schema::Tablets>(TabletsName);
295
+ RegisterDomainSystemView<Schema::Tablets>(TabletsName, ESysViewType::ETablets );
282
296
283
- RegisterSystemView<Schema::QueryMetrics>(QueryMetricsName);
297
+ RegisterSystemView<Schema::QueryMetrics>(QueryMetricsName, ESysViewType::EQueryMetricsOneMinute );
284
298
285
299
RegisterOlapStoreSystemView<Schema::PrimaryIndexStats>(StorePrimaryIndexStatsName);
286
300
RegisterOlapStoreSystemView<Schema::PrimaryIndexPortionStats>(StorePrimaryIndexPortionStatsName);
@@ -291,24 +305,24 @@ class TSystemViewResolver : public ISystemViewResolver {
291
305
RegisterColumnTableSystemView<Schema::PrimaryIndexGranuleStats>(TablePrimaryIndexGranuleStatsName);
292
306
RegisterColumnTableSystemView<Schema::PrimaryIndexOptimizerStats>(TablePrimaryIndexOptimizerStatsName);
293
307
294
- RegisterSystemView<Schema::TopPartitions>(TopPartitionsByCpu1MinuteName);
295
- RegisterSystemView<Schema::TopPartitions>(TopPartitionsByCpu1HourName);
296
- RegisterSystemView<Schema::TopPartitionsTli>(TopPartitionsByTli1MinuteName);
297
- RegisterSystemView<Schema::TopPartitionsTli>(TopPartitionsByTli1HourName);
308
+ RegisterSystemView<Schema::TopPartitions>(TopPartitionsByCpu1MinuteName, ESysViewType::ETopPartitionsByCpuOneMinute );
309
+ RegisterSystemView<Schema::TopPartitions>(TopPartitionsByCpu1HourName, ESysViewType::ETopPartitionsByCpuOneHour );
310
+ RegisterSystemView<Schema::TopPartitionsTli>(TopPartitionsByTli1MinuteName, ESysViewType::ETopPartitionsByTliOneMinute );
311
+ RegisterSystemView<Schema::TopPartitionsTli>(TopPartitionsByTli1HourName, ESysViewType::ETopPartitionsByTliOneHour );
298
312
299
313
RegisterPgTablesSystemViews ();
300
314
301
- RegisterSystemView<Schema::ResourcePoolClassifiers>(ResourcePoolClassifiersName);
302
- RegisterSystemView<Schema::ResourcePools>(ResourcePoolsName);
315
+ RegisterSystemView<Schema::ResourcePoolClassifiers>(ResourcePoolClassifiersName, ESysViewType::EResourcePoolClassifiers );
316
+ RegisterSystemView<Schema::ResourcePools>(ResourcePoolsName, ESysViewType::EResourcePools );
303
317
304
318
{
305
319
using namespace NAuth ;
306
- RegisterSystemView<Schema::AuthUsers>(UsersName);
307
- RegisterSystemView<Schema::AuthGroups>(NAuth::GroupsName);
308
- RegisterSystemView<Schema::AuthGroupMembers>(GroupMembersName);
309
- RegisterSystemView<Schema::AuthOwners>(OwnersName);
310
- RegisterSystemView<Schema::AuthPermissions>(PermissionsName);
311
- RegisterSystemView<Schema::AuthPermissions>(EffectivePermissionsName);
320
+ RegisterSystemView<Schema::AuthUsers>(UsersName, ESysViewType::EAuthUsers );
321
+ RegisterSystemView<Schema::AuthGroups>(NAuth::GroupsName, ESysViewType::EAuthGroups );
322
+ RegisterSystemView<Schema::AuthGroupMembers>(GroupMembersName, ESysViewType::EAuthGroupMembers );
323
+ RegisterSystemView<Schema::AuthOwners>(OwnersName, ESysViewType::EAuthOwners );
324
+ RegisterSystemView<Schema::AuthPermissions>(PermissionsName, ESysViewType::EAuthPermissions );
325
+ RegisterSystemView<Schema::AuthPermissions>(EffectivePermissionsName, ESysViewType::EAuthEffectivePermissions );
312
326
}
313
327
}
314
328
@@ -317,6 +331,7 @@ class TSystemViewResolver : public ISystemViewResolver {
317
331
THashMap<TString, TSchema> SubDomainSystemViews;
318
332
THashMap<TString, TSchema> OlapStoreSystemViews;
319
333
THashMap<TString, TSchema> ColumnTableSystemViews;
334
+ THashMap<ESysViewType, TSchema> SystemViews;
320
335
};
321
336
322
337
class TSystemViewRewrittenResolver : public ISystemViewResolver {
@@ -346,6 +361,11 @@ class TSystemViewRewrittenResolver : public ISystemViewResolver {
346
361
return view ? TMaybe<TSchema>(*view) : Nothing ();
347
362
}
348
363
364
+ TMaybe<TSchema> GetSystemViewSchema (NKikimrSysView::ESysViewType sysViewType) const override final {
365
+ Y_UNUSED (sysViewType);
366
+ return Nothing ();
367
+ }
368
+
349
369
TVector<TString> GetSystemViewNames (ETarget target) const override {
350
370
Y_UNUSED (target);
351
371
return {};
0 commit comments