Skip to content

Commit 3a59d95

Browse files
authored
Apply TablePathPrefix to topic. (#4741)
1 parent a26dfc6 commit 3a59d95

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ydb/library/yql/sql/v1/query.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class TTopicKey: public ITableKeys {
120120
return Name.GetLiteral() ? &Full : nullptr;
121121
}
122122

123-
TNodePtr BuildKeys(TContext&, ITableKeys::EBuildKeysMode) override {
124-
auto path = Name.Build(); // ToDo Need some prefix here?
123+
TNodePtr BuildKeys(TContext& ctx, ITableKeys::EBuildKeysMode) override {
124+
const auto path = ctx.GetPrefixedPath(Service, Cluster, Name);
125125
if (!path) {
126126
return nullptr;
127127
}

ydb/library/yql/sql/v1/sql_ut.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6515,6 +6515,20 @@ Y_UNIT_TEST_SUITE(TopicsDDL) {
65156515
ALTER CONSUMER consumer3 SET (read_from = 2);
65166516
)", false);
65176517
}
6518+
6519+
Y_UNIT_TEST(TopicWithPrefix) {
6520+
NYql::TAstParseResult res = SqlToYql(R"(
6521+
USE plato;
6522+
PRAGMA TablePathPrefix = '/database/path/to/tables';
6523+
ALTER TOPIC `my_table/my_feed` ADD CONSUMER `my_consumer`;
6524+
)");
6525+
UNIT_ASSERT(res.Root);
6526+
6527+
TWordCountHive elementStat = {{TString("/database/path/to/tables/my_table/my_feed"), 0}, {"topic", 0}};
6528+
VerifyProgram(res, elementStat);
6529+
UNIT_ASSERT_VALUES_EQUAL(1, elementStat["topic"]);
6530+
UNIT_ASSERT_VALUES_EQUAL(1, elementStat["/database/path/to/tables/my_table/my_feed"]);
6531+
}
65186532
}
65196533

65206534
Y_UNIT_TEST_SUITE(BlockEnginePragma) {

0 commit comments

Comments
 (0)