diff --git a/ydb/core/statistics/service/service_impl.cpp b/ydb/core/statistics/service/service_impl.cpp index f51ec8fd3e81..1555895ebee8 100644 --- a/ydb/core/statistics/service/service_impl.cpp +++ b/ydb/core/statistics/service/service_impl.cpp @@ -746,6 +746,7 @@ class TStatService : public TActorBootstrapped { entry.Operation = TNavigate::EOp::OpPath; entry.RequestType = TNavigate::TEntry::ERequestType::ByTableId; entry.RedirectRequired = redirectRequired; + entry.ShowPrivatePath = true; } void Handle(TEvStatistics::TEvGetStatistics::TPtr& ev) { diff --git a/ydb/core/statistics/service/ut/ut_basic_statistics.cpp b/ydb/core/statistics/service/ut/ut_basic_statistics.cpp index 834eff334546..51d7ef1aaf7c 100644 --- a/ydb/core/statistics/service/ut/ut_basic_statistics.cpp +++ b/ydb/core/statistics/service/ut/ut_basic_statistics.cpp @@ -16,15 +16,7 @@ using namespace NYdb::NScheme; namespace { -void CreateTable(TTestEnv& env, const TString& databaseName, const TString& tableName, size_t rowCount) { - ExecuteYqlScript(env, Sprintf(R"( - CREATE TABLE `Root/%s/%s` ( - Key Uint64, - Value Uint64, - PRIMARY KEY (Key) - ); - )", databaseName.c_str(), tableName.c_str())); - +void FillTable(TTestEnv& env, const TString& databaseName, const TString& tableName, size_t rowCount) { TStringBuilder replace; replace << Sprintf("REPLACE INTO `Root/%s/%s` (Key, Value) VALUES ", databaseName.c_str(), tableName.c_str()); @@ -38,6 +30,29 @@ void CreateTable(TTestEnv& env, const TString& databaseName, const TString& tabl ExecuteYqlScript(env, replace); } +void CreateTable(TTestEnv& env, const TString& databaseName, const TString& tableName, size_t rowCount) { + ExecuteYqlScript(env, Sprintf(R"( + CREATE TABLE `Root/%s/%s` ( + Key Uint64, + Value Uint64, + PRIMARY KEY (Key) + ); + )", databaseName.c_str(), tableName.c_str())); + FillTable(env, databaseName, tableName, rowCount); +} + +void CreateTableWithGlobalIndex(TTestEnv& env, const TString& databaseName, const TString& tableName, size_t rowCount) { + ExecuteYqlScript(env, Sprintf(R"( + CREATE TABLE `Root/%s/%s` ( + Key Uint64, + Value Uint64, + INDEX ValueIndex GLOBAL ON ( Value ), + PRIMARY KEY (Key) + ); + )", databaseName.c_str(), tableName.c_str())); + FillTable(env, databaseName, tableName, rowCount); +} + void ValidateRowCount(TTestActorRuntime& runtime, ui32 nodeIndex, TPathId pathId, size_t expectedRowCount) { auto statServiceId = NStat::MakeStatServiceID(runtime.GetNodeId(nodeIndex)); ui64 rowCount = 0; @@ -97,7 +112,6 @@ ui64 GetRowCount(TTestActorRuntime& runtime, ui32 nodeIndex, TPathId pathId) { } // namespace Y_UNIT_TEST_SUITE(BasicStatistics) { - Y_UNIT_TEST(Simple) { TTestEnv env(1, 1); @@ -254,6 +268,29 @@ Y_UNIT_TEST_SUITE(BasicStatistics) { TestNotFullStatistics(env, 1000); } + + Y_UNIT_TEST(SimpleGlobalIndex) { + TTestEnv env(1, 1); + + CreateDatabase(env, "Database"); + CreateTableWithGlobalIndex(env, "Database", "Table", 5); + + auto& runtime = *env.GetServer().GetRuntime(); + auto pathId = ResolvePathId(runtime, "/Root/Database/Table/ValueIndex/indexImplTable"); + ValidateRowCount(runtime, 1, pathId, 5); + } + + Y_UNIT_TEST(ServerlessGlobalIndex) { + TTestEnv env(1, 1); + + CreateDatabase(env, "Shared", 1, true); + CreateServerlessDatabase(env, "Serverless", "/Root/Shared"); + CreateTableWithGlobalIndex(env, "Serverless", "Table", 5); + + auto& runtime = *env.GetServer().GetRuntime(); + auto pathId = ResolvePathId(runtime, "/Root/Serverless/Table/ValueIndex/indexImplTable"); + ValidateRowCount(runtime, 1, pathId, 5); + } } } // NSysView