Skip to content

Commit c9f32e7

Browse files
authored
Merge 72e36e8 into 0a189e0
2 parents 0a189e0 + 72e36e8 commit c9f32e7

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
@@ -6279,6 +6279,20 @@ Y_UNIT_TEST_SUITE(TopicsDDL) {
62796279
ALTER CONSUMER consumer3 SET (read_from = 2);
62806280
)", false);
62816281
}
6282+
6283+
Y_UNIT_TEST(TopicWithPrefix) {
6284+
NYql::TAstParseResult res = SqlToYql(R"(
6285+
USE plato;
6286+
PRAGMA TablePathPrefix = '/database/path/to/tables';
6287+
ALTER TOPIC `my_table/my_feed` ADD CONSUMER `my_consumer`;
6288+
)");
6289+
UNIT_ASSERT(res.Root);
6290+
6291+
TWordCountHive elementStat = {{TString("/database/path/to/tables/my_table/my_feed"), 0}, {"topic", 0}};
6292+
VerifyProgram(res, elementStat);
6293+
UNIT_ASSERT_VALUES_EQUAL(1, elementStat["topic"]);
6294+
UNIT_ASSERT_VALUES_EQUAL(1, elementStat["/database/path/to/tables/my_table/my_feed"]);
6295+
}
62826296
}
62836297

62846298
Y_UNIT_TEST_SUITE(BlockEnginePragma) {

0 commit comments

Comments
 (0)