Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions ydb/core/kqp/provider/yql_kikimr_gateway.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ bool SetColumnType(const TTypeAnnotationNode* typeNode, bool notNull, Ydb::Type&
const TStringBuf typeName = dataTypeNode->GetName();
NUdf::EDataSlot dataSlot = NUdf::GetDataSlot(typeName);
if (dataSlot == NUdf::EDataSlot::Decimal) {
auto dataExprTypeNode = typeNode->Cast<TDataExprParamsType>();
auto dataExprTypeNode = typeNode->Cast<TDataExprParamsType>();
ui32 precision = FromString(dataExprTypeNode->GetParamOne());
ui32 scale = FromString(dataExprTypeNode->GetParamTwo());
if (!NKikimr::NScheme::TDecimalType::Validate(precision, scale, error)) {
Expand Down Expand Up @@ -348,8 +348,20 @@ static std::shared_ptr<THashMap<TString, Ydb::Topic::Codec>> GetCodecsMapping()

static std::shared_ptr<THashMap<TString, Ydb::Topic::AutoPartitioningStrategy>> GetAutoPartitioningStrategiesMapping() {
static std::shared_ptr<THashMap<TString, Ydb::Topic::AutoPartitioningStrategy>> strategiesMapping;
if (strategiesMapping == nullptr) {
strategiesMapping = MakeEnumMapping<Ydb::Topic::AutoPartitioningStrategy>(Ydb::Topic::AutoPartitioningStrategy_descriptor(), "auto_partitioning_strategy_");
if (!strategiesMapping) {
strategiesMapping = MakeEnumMapping<Ydb::Topic::AutoPartitioningStrategy>(
Ydb::Topic::AutoPartitioningStrategy_descriptor(), "auto_partitioning_strategy_");

const TString prefix = "scale_";
for (const auto& [key, value] : *strategiesMapping) {
if (key.StartsWith(prefix)) {
TString newKey = key;
newKey.erase(0, prefix.length());

Y_ABORT_UNLESS(strategiesMapping->find(newKey) == strategiesMapping->end());
(*strategiesMapping)[newKey] = value;
}
}
}
return strategiesMapping;
}
Expand Down
37 changes: 20 additions & 17 deletions ydb/services/persqueue_v1/topic_yql_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,34 @@ Y_UNIT_TEST_SUITE(TTopicYqlTest) {
UNIT_ASSERT_VALUES_EQUAL(after + 1, before);
}

Y_UNIT_TEST(CreateAndAlterTopicYqlBackCompatibility) {
Y_UNIT_TEST(CreateTopicYqlBackCompatibility) {
NKikimrConfig::TFeatureFlags ff;
ff.SetEnableTopicSplitMerge(true);
auto settings = NKikimr::NPersQueueTests::PQSettings();
settings.SetFeatureFlags(ff);

NPersQueue::TTestServer server(settings);
{
const char *query = R"__(
CREATE TOPIC `/Root/PQ/rt3.dc1--legacy--topic1` (
CONSUMER c1
) WITH (min_active_partitions = 2,
partition_count_limit = 5,
auto_partitioning_strategy = 'scale_up'
);
)__";

const char *query = R"__(
CREATE TOPIC `/Root/PQ/rt3.dc1--legacy--topic1` (
CONSUMER c1
) WITH (min_active_partitions = 2,
partition_count_limit = 5,
auto_partitioning_strategy = 'scale_up'
);
)__";
server.AnnoyingClient->RunYqlSchemeQuery(query);
auto pqGroup = server.AnnoyingClient->Ls("/Root/PQ/rt3.dc1--legacy--topic1")->Record.GetPathDescription()
.GetPersQueueGroup();
const auto& describeAfterCreate = pqGroup.GetPQTabletConfig();
Cerr <<"=== PATH DESCRIPTION: \n" << pqGroup.DebugString();

server.AnnoyingClient->RunYqlSchemeQuery(query);
auto pqGroup = server.AnnoyingClient->Ls("/Root/PQ/rt3.dc1--legacy--topic1")->Record.GetPathDescription()
.GetPersQueueGroup();
const auto& describeAfterCreate = pqGroup.GetPQTabletConfig();
Cerr <<"=== PATH DESCRIPTION: \n" << pqGroup.DebugString();
UNIT_ASSERT_VALUES_EQUAL(describeAfterCreate.GetPartitionStrategy().GetMinPartitionCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(describeAfterCreate.GetPartitionStrategy().GetMaxPartitionCount(), 5);
UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(describeAfterCreate.GetPartitionStrategy().GetPartitionStrategyType()), static_cast<int>(::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_CAN_SPLIT));
}

UNIT_ASSERT_VALUES_EQUAL(describeAfterCreate.GetPartitionStrategy().GetMinPartitionCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(describeAfterCreate.GetPartitionStrategy().GetMaxPartitionCount(), 5);
}

Y_UNIT_TEST(CreateAndAlterTopicYql) {
Expand Down Expand Up @@ -77,7 +80,7 @@ Y_UNIT_TEST_SUITE(TTopicYqlTest) {
supported_codecs = 'RAW, GZIP',
partition_write_speed_bytes_per_second = 9000,
partition_write_burst_bytes = 100500,
auto_partitioning_strategy = 'scale_up'
auto_partitioning_strategy = 'up'
);
)__";

Expand Down
Loading