From 2abd9045a8bab880f0461b7ab402f1237440e9d5 Mon Sep 17 00:00:00 2001 From: Ilnaz Nizametdinov Date: Thu, 28 Nov 2024 17:54:42 +0300 Subject: [PATCH] Allow to describe index table through ydb cli --- ydb/core/grpc_services/rpc_describe_path.cpp | 12 ++++++++---- ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ydb/core/grpc_services/rpc_describe_path.cpp b/ydb/core/grpc_services/rpc_describe_path.cpp index 304b07e384f9..736369167e2f 100644 --- a/ydb/core/grpc_services/rpc_describe_path.cpp +++ b/ydb/core/grpc_services/rpc_describe_path.cpp @@ -65,8 +65,12 @@ class TBaseDescribe : public TRpcSchemeRequestActor { return SendProposeRequest(ctx, this->GetProtoRequest()->path()); } - if (entry.Kind != TSchemeCacheNavigate::EKind::KindCdcStream) { - return SendProposeRequest(ctx, this->GetProtoRequest()->path()); + switch (entry.Kind) { + case TSchemeCacheNavigate::EKind::KindCdcStream: + case TSchemeCacheNavigate::EKind::KindIndex: + break; + default: + return SendProposeRequest(ctx, this->GetProtoRequest()->path()); } if (!entry.Self || !entry.ListNodeEntry) { @@ -79,10 +83,10 @@ class TBaseDescribe : public TRpcSchemeRequestActor { } OverrideName = entry.Self->Info.GetName(); - const auto& topicName = entry.ListNodeEntry->Children.at(0).Name; + const auto& childName = entry.ListNodeEntry->Children.at(0).Name; return SendProposeRequest(ctx, - NKikimr::JoinPath(NKikimr::ChildPath(NKikimr::SplitPath(this->GetProtoRequest()->path()), topicName))); + NKikimr::JoinPath(NKikimr::ChildPath(NKikimr::SplitPath(this->GetProtoRequest()->path()), childName))); } void SendProposeRequest(const TActorContext& ctx, const TString& path) { diff --git a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp index 490d1a1c5d17..87d1e7f0020a 100644 --- a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp +++ b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp @@ -4908,6 +4908,7 @@ Y_UNIT_TEST_SUITE(KqpScheme) { Y_UNIT_TEST(DescribeIndexTable) { TKikimrRunner kikimr; auto db = kikimr.GetTableClient(); + auto scheme = NYdb::NScheme::TSchemeClient(kikimr.GetDriver(), TCommonClientSettings().Database("/Root")); auto session = db.CreateSession().GetValueSync().GetSession(); { @@ -4924,6 +4925,11 @@ Y_UNIT_TEST_SUITE(KqpScheme) { auto result = session.ExecuteSchemeQuery(query).GetValueSync(); UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); } + { + auto desc = scheme.DescribePath("/Root/table/SyncIndex").ExtractValueSync(); + UNIT_ASSERT_C(desc.IsSuccess(), desc.GetIssues().ToString()); + UNIT_ASSERT_VALUES_EQUAL(desc.GetEntry().Name, "SyncIndex"); + } { auto desc = session.DescribeTable("/Root/table/SyncIndex").ExtractValueSync(); UNIT_ASSERT_C(desc.IsSuccess(), desc.GetIssues().ToString());