diff options
author | zverevgeny <zverevgeny@ydb.tech> | 2024-12-12 18:27:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-12 18:27:22 +0300 |
commit | 46a0f523ca7c5fde35cd4757f0862de17897cceb (patch) | |
tree | 88168be5422fe991caec9c74529850d9868fe053 | |
parent | 42701242eaf5be980cb935631586d0e90b82641c (diff) | |
download | ydb-46a0f523ca7c5fde35cd4757f0862de17897cceb.tar.gz |
check supported store types (#12568)
-rw-r--r-- | ydb/core/kqp/provider/yql_kikimr_type_ann.cpp | 14 | ||||
-rw-r--r-- | ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp | 24 |
2 files changed, 35 insertions, 3 deletions
diff --git a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp index b0424f82c2..4d499c2fb5 100644 --- a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp +++ b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp @@ -1256,9 +1256,17 @@ virtual TStatus HandleCreateTable(TKiCreateTable create, TExprContext& ctx) over "Can't reset TTL settings")); return TStatus::Error; } else if (name == "storeType") { - TMaybe<TString> storeType = TString(setting.Value().Cast<TCoAtom>().Value()); - if (storeType && to_lower(storeType.GetRef()) == "column") { - meta->StoreType = EStoreType::Column; + if (const TMaybe<TString> storeType = TString(setting.Value().Cast<TCoAtom>().Value())) { + const auto& val = to_lower(storeType.GetRef()); + if (val == "column") { + meta->StoreType = EStoreType::Column; + } else if (val == "row") { + //pass + } else { + ctx.AddError(TIssue(ctx.GetPosition(setting.Name().Pos()), + TStringBuilder() << "Unsupported table store type: " << storeType.GetRef())); + return TStatus::Error; + } } } else if (name == "partitionByHashFunction") { meta->TableSettings.PartitionByHashFunction = TString( diff --git a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp index 0d44d16759..cb8b9ca106 100644 --- a/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp +++ b/ydb/core/kqp/ut/scheme/kqp_scheme_ut.cpp @@ -4993,6 +4993,30 @@ Y_UNIT_TEST_SUITE(KqpScheme) { } } + Y_UNIT_TEST(NEG_CreateTableWithUnsupportedStoreType) { + TKikimrSettings runnerSettings; + runnerSettings.WithSampleTables = false; + TKikimrRunner kikimr(runnerSettings); + auto db = kikimr.GetTableClient(); + auto session = db.CreateSession().GetValueSync().GetSession(); + TString tableStoreName = "/Root/TableStoreTest"; + auto query = TStringBuilder() << R"( + --!syntax_v1 + CREATE TABLE SomeTable ( + Key Timestamp NOT NULL, + Value1 String, + Value2 Int64 NOT NULL, + PRIMARY KEY (Key) + ) + WITH ( + STORE = UNSUPPORTED + ); + )"; + auto result = session.ExecuteSchemeQuery(query).GetValueSync(); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetIssues().ToString()); + } + + Y_UNIT_TEST(CreateAlterDropTableStore) { TKikimrSettings runnerSettings; runnerSettings.WithSampleTables = false; |