Skip to content

Commit 72fc8a4

Browse files
authored
Support DDL operations (including IF EXISTS/IF NOT EXISTS) for objects with type secret (#838)
1 parent 1da3289 commit 72fc8a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+375
-123
lines changed

ydb/core/kqp/compile_service/kqp_compile_actor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class TKqpCompileActor : public TActorBootstrapped<TKqpCompileActor> {
184184
Config->FeatureFlags = AppData(ctx)->FeatureFlags;
185185

186186
KqpHost = CreateKqpHost(Gateway, QueryId.Cluster, QueryId.Database, Config, ModuleResolverState->ModuleResolver,
187-
FederatedQuerySetup, AppData(ctx)->FunctionRegistry, false, false, std::move(TempTablesState));
187+
FederatedQuerySetup, UserToken, AppData(ctx)->FunctionRegistry, false, false, std::move(TempTablesState));
188188

189189
IKqpHost::TPrepareSettings prepareSettings;
190190
prepareSettings.DocumentApiRestricted = QueryId.Settings.DocumentApiRestricted;

ydb/core/kqp/executer_actor/kqp_scheme_executer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
259259
context.SetUserToken(*UserToken);
260260
}
261261

262-
auto resultFuture = cBehaviour->GetOperationsManager()->ExecutePrepared(schemeOp, cBehaviour, context);
262+
auto resultFuture = cBehaviour->GetOperationsManager()->ExecutePrepared(schemeOp, SelfId().NodeId(), cBehaviour, context);
263263

264264
using TResultFuture = NThreading::TFuture<NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus>;
265265
resultFuture.Subscribe([actorSystem, selfId](const TResultFuture& f) {

ydb/core/kqp/executer_actor/ut/kqp_executer_ut.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ NKqpProto::TKqpPhyTx BuildTxPlan(const TString& sql, TIntrusivePtr<IKqpGateway>
2828
IModuleResolver::TPtr moduleResolver;
2929
UNIT_ASSERT(GetYqlDefaultModuleResolver(moduleCtx, moduleResolver));
3030

31-
auto qp = CreateKqpHost(gateway, cluster, "/Root", config, moduleResolver, NYql::IHTTPGateway::Make(), nullptr, false, false, nullptr, actorSystem);
31+
auto qp = CreateKqpHost(gateway, cluster, "/Root", config, moduleResolver, NYql::IHTTPGateway::Make(), nullptr, nullptr, false, false, nullptr, actorSystem);
3232
auto result = qp->SyncPrepareDataQuery(sql, IKqpHost::TPrepareSettings());
3333
result.Issues().PrintTo(Cerr);
3434
UNIT_ASSERT(result.Success());

ydb/core/kqp/gateway/behaviour/external_data_source/manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ void TExternalDataSourceManager::PrepareDropExternalDataSource(NKqpProto::TKqpSc
229229
}
230230

231231
NThreading::TFuture<NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus> TExternalDataSourceManager::ExecutePrepared(const NKqpProto::TKqpSchemeOperation& schemeOperation,
232-
const NMetadata::IClassBehaviour::TPtr& /*manager*/, const IOperationsManager::TExternalModificationContext& context) const {
232+
const ui32 /*nodeId*/, const NMetadata::IClassBehaviour::TPtr& /*manager*/, const IOperationsManager::TExternalModificationContext& context) const {
233233
using TRequest = TEvTxUserProxy::TEvProposeTransaction;
234234

235235
auto ev = MakeHolder<TRequest>();

ydb/core/kqp/gateway/behaviour/external_data_source/manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class TExternalDataSourceManager: public NMetadata::NModifications::IOperationsM
2727
const NMetadata::IClassBehaviour::TPtr& manager, IOperationsManager::TInternalModificationContext& context) const override;
2828

2929
NThreading::TFuture<IOperationsManager::TYqlConclusionStatus> ExecutePrepared(const NKqpProto::TKqpSchemeOperation& schemeOperation,
30-
const NMetadata::IClassBehaviour::TPtr& manager, const IOperationsManager::TExternalModificationContext& context) const override;
30+
const ui32 nodeId, const NMetadata::IClassBehaviour::TPtr& manager, const IOperationsManager::TExternalModificationContext& context) const override;
3131

3232
public:
3333
using NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus;

ydb/core/kqp/gateway/behaviour/tablestore/manager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus TTableStoreM
7777
}
7878

7979
NThreading::TFuture<NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus> TTableStoreManager::ExecutePrepared(const NKqpProto::TKqpSchemeOperation& /*schemeOperation*/,
80-
const NMetadata::IClassBehaviour::TPtr& /*manager*/, const IOperationsManager::TExternalModificationContext& /*context*/) const {
80+
const ui32 /*nodeId*/, const NMetadata::IClassBehaviour::TPtr& /*manager*/, const IOperationsManager::TExternalModificationContext& /*context*/) const {
8181
return NThreading::MakeFuture(NMetadata::NModifications::IOperationsManager::TYqlConclusionStatus::Fail(
8282
"Execution of prepare operations for TABLE objects is not supported"));
8383
}

ydb/core/kqp/gateway/behaviour/tablestore/manager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TTableStoreManager: public NMetadata::NModifications::IOperationsManager {
1717
const NMetadata::IClassBehaviour::TPtr& manager, IOperationsManager::TInternalModificationContext& context) const override;
1818

1919
NThreading::TFuture<IOperationsManager::TYqlConclusionStatus> ExecutePrepared(const NKqpProto::TKqpSchemeOperation& schemeOperation,
20-
const NMetadata::IClassBehaviour::TPtr& manager, const IOperationsManager::TExternalModificationContext& context) const override;
20+
const ui32 nodeId, const NMetadata::IClassBehaviour::TPtr& manager, const IOperationsManager::TExternalModificationContext& context) const override;
2121
public:
2222
TTableStoreManager(bool isStandalone)
2323
: IsStandalone(isStandalone)

ydb/core/kqp/gateway/behaviour/view/manager.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ TViewManager::TYqlConclusionStatus TViewManager::DoPrepare(NKqpProto::TKqpScheme
152152
const NMetadata::IClassBehaviour::TPtr& manager,
153153
TInternalModificationContext& context) const {
154154
Y_UNUSED(manager);
155-
155+
156156
try {
157157
CheckFeatureFlag(context);
158158
switch (context.GetActivityType()) {
@@ -176,9 +176,10 @@ TViewManager::TYqlConclusionStatus TViewManager::DoPrepare(NKqpProto::TKqpScheme
176176
}
177177

178178
NThreading::TFuture<TYqlConclusionStatus> TViewManager::ExecutePrepared(const NKqpProto::TKqpSchemeOperation& schemeOperation,
179+
const ui32 nodeId,
179180
const NMetadata::IClassBehaviour::TPtr& manager,
180181
const TExternalModificationContext& context) const {
181-
Y_UNUSED(manager);
182+
Y_UNUSED(manager, nodeId);
182183

183184
auto proposal = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
184185
proposal->Record.SetDatabaseName(context.GetDatabase());

ydb/core/kqp/gateway/behaviour/view/manager.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class TViewManager: public NMetadata::NModifications::IOperationsManager {
1717
TInternalModificationContext& context) const override;
1818

1919
NThreading::TFuture<TYqlConclusionStatus> ExecutePrepared(const NKqpProto::TKqpSchemeOperation& schemeOperation,
20+
const ui32 nodeId,
2021
const NMetadata::IClassBehaviour::TPtr& manager,
2122
const TExternalModificationContext& context) const override;
2223

ydb/core/kqp/host/kqp_gateway_proxy.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,9 @@ class TKqpGatewayProxy : public IKikimrGateway {
10221022
NMetadata::NModifications::IOperationsManager::TExternalModificationContext context;
10231023
context.SetDatabase(SessionCtx->GetDatabase());
10241024
context.SetActorSystem(ActorSystem);
1025+
if (SessionCtx->GetUserToken()) {
1026+
context.SetUserToken(*SessionCtx->GetUserToken());
1027+
}
10251028

10261029
auto& phyTx = phyTxRemover.Capture(SessionCtx->Query().PreparingQuery->MutablePhysicalQuery());
10271030
phyTx.SetType(NKqpProto::TKqpPhyTx::TYPE_SCHEME);

ydb/core/kqp/host/kqp_host.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ class TKqpHost : public IKqpHost {
921921
public:
922922
TKqpHost(TIntrusivePtr<IKqpGateway> gateway, const TString& cluster, const TString& database,
923923
TKikimrConfiguration::TPtr config, IModuleResolver::TPtr moduleResolver,
924-
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup,
924+
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup, const TIntrusiveConstPtr<NACLib::TUserToken>& userToken,
925925
const NKikimr::NMiniKQL::IFunctionRegistry* funcRegistry, bool keepConfigChanges,
926926
bool isInternalCall, TKqpTempTablesState::TConstPtr tempTablesState = nullptr,
927927
NActors::TActorSystem* actorSystem = nullptr)
@@ -932,7 +932,7 @@ class TKqpHost : public IKqpHost {
932932
, KeepConfigChanges(keepConfigChanges)
933933
, IsInternalCall(isInternalCall)
934934
, FederatedQuerySetup(federatedQuerySetup)
935-
, SessionCtx(new TKikimrSessionContext(funcRegistry, config, TAppData::TimeProvider, TAppData::RandomProvider))
935+
, SessionCtx(new TKikimrSessionContext(funcRegistry, config, TAppData::TimeProvider, TAppData::RandomProvider, userToken))
936936
, TypesCtx(MakeIntrusive<TTypeAnnotationContext>())
937937
, PlanBuilder(CreatePlanBuilder(*TypesCtx))
938938
, FakeWorld(ExprCtx->NewWorld(TPosition()))
@@ -1672,11 +1672,11 @@ Ydb::Table::QueryStatsCollection::Mode GetStatsMode(NYql::EKikimrStatsMode stats
16721672

16731673
TIntrusivePtr<IKqpHost> CreateKqpHost(TIntrusivePtr<IKqpGateway> gateway,
16741674
const TString& cluster, const TString& database, TKikimrConfiguration::TPtr config, IModuleResolver::TPtr moduleResolver,
1675-
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup,
1675+
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup, const TIntrusiveConstPtr<NACLib::TUserToken>& userToken,
16761676
const NKikimr::NMiniKQL::IFunctionRegistry* funcRegistry, bool keepConfigChanges, bool isInternalCall,
16771677
TKqpTempTablesState::TConstPtr tempTablesState, NActors::TActorSystem* actorSystem)
16781678
{
1679-
return MakeIntrusive<TKqpHost>(gateway, cluster, database, config, moduleResolver, federatedQuerySetup, funcRegistry,
1679+
return MakeIntrusive<TKqpHost>(gateway, cluster, database, config, moduleResolver, federatedQuerySetup, userToken, funcRegistry,
16801680
keepConfigChanges, isInternalCall, std::move(tempTablesState), actorSystem);
16811681
}
16821682

ydb/core/kqp/host/kqp_host.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <ydb/core/kqp/gateway/kqp_gateway.h>
55
#include <ydb/core/kqp/provider/yql_kikimr_provider.h>
66
#include <ydb/core/kqp/host/kqp_translate.h>
7+
#include <ydb/library/aclib/aclib.h>
78
#include <ydb/library/yql/providers/common/http_gateway/yql_http_gateway.h>
89
#include <ydb/library/yql/providers/common/token_accessor/client/factory.h>
910

@@ -108,7 +109,7 @@ class IKqpHost : public TThrRefBase {
108109

109110
TIntrusivePtr<IKqpHost> CreateKqpHost(TIntrusivePtr<IKqpGateway> gateway,
110111
const TString& cluster, const TString& database, NYql::TKikimrConfiguration::TPtr config, NYql::IModuleResolver::TPtr moduleResolver,
111-
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup, const NKikimr::NMiniKQL::IFunctionRegistry* funcRegistry = nullptr,
112+
std::optional<TKqpFederatedQuerySetup> federatedQuerySetup, const TIntrusiveConstPtr<NACLib::TUserToken>& userToken, const NKikimr::NMiniKQL::IFunctionRegistry* funcRegistry = nullptr,
112113
bool keepConfigChanges = false, bool isInternalCall = false, TKqpTempTablesState::TConstPtr tempTablesState = nullptr,
113114
NActors::TActorSystem* actorSystem = nullptr /*take from TLS by default*/);
114115

ydb/core/kqp/provider/yql_kikimr_provider.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -445,11 +445,14 @@ class TKikimrSessionContext : public TThrRefBase {
445445
TKikimrConfiguration::TPtr config,
446446
TIntrusivePtr<ITimeProvider> timeProvider,
447447
TIntrusivePtr<IRandomProvider> randomProvider,
448+
const TIntrusiveConstPtr<NACLib::TUserToken>& userToken,
448449
TIntrusivePtr<TKikimrTransactionContextBase> txCtx = nullptr)
449450
: Configuration(config)
450451
, TablesData(MakeIntrusive<TKikimrTablesData>())
451452
, QueryCtx(MakeIntrusive<TKikimrQueryContext>(functionRegistry, timeProvider, randomProvider))
452-
, TxCtx(txCtx) {}
453+
, TxCtx(txCtx)
454+
, UserToken(userToken)
455+
{}
453456

454457
TKikimrSessionContext(const TKikimrSessionContext&) = delete;
455458
TKikimrSessionContext& operator=(const TKikimrSessionContext&) = delete;
@@ -518,6 +521,10 @@ class TKikimrSessionContext : public TThrRefBase {
518521
TempTablesState = tempTablesState;
519522
}
520523

524+
const TIntrusiveConstPtr<NACLib::TUserToken>& GetUserToken() const {
525+
return UserToken;
526+
}
527+
521528
private:
522529
TString UserName;
523530
TString Cluster;
@@ -527,6 +534,7 @@ class TKikimrSessionContext : public TThrRefBase {
527534
TIntrusivePtr<TKikimrQueryContext> QueryCtx;
528535
TIntrusivePtr<TKikimrTransactionContextBase> TxCtx;
529536
NKikimr::NKqp::TKqpTempTablesState::TConstPtr TempTablesState;
537+
TIntrusiveConstPtr<NACLib::TUserToken> UserToken;
530538
};
531539

532540
TIntrusivePtr<IDataProvider> CreateKikimrDataSource(

ydb/core/kqp/session_actor/kqp_worker_actor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class TKqpWorkerActor : public TActorBootstrapped<TKqpWorkerActor> {
187187
Config->FeatureFlags = AppData(ctx)->FeatureFlags;
188188

189189
KqpHost = CreateKqpHost(Gateway, Settings.Cluster, Settings.Database, Config, ModuleResolverState->ModuleResolver,
190-
FederatedQuerySetup, AppData(ctx)->FunctionRegistry, !Settings.LongSession, false);
190+
FederatedQuerySetup, QueryState->RequestEv->GetUserToken(), AppData(ctx)->FunctionRegistry, !Settings.LongSession, false);
191191

192192
auto& queryRequest = QueryState->RequestEv;
193193
QueryState->ProxyRequestId = proxyRequestId;

ydb/core/kqp/ut/federated_query/generic/kqp_generic_provider_join_ut.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ Y_UNIT_TEST_SUITE(FederatedQueryJoin) {
6363
}
6464

6565
std::shared_ptr<NKikimr::NKqp::TKikimrRunner> kikimr = MakeKikimrRunnerWithConnector();
66-
67-
auto tableCLient = kikimr->GetTableClient();
68-
auto session = tableCLient.CreateSession().GetValueSync().GetSession();
66+
auto queryClient = kikimr->GetQueryClient();
6967

7068
// external tables to pg/ch
7169
{
@@ -104,7 +102,7 @@ Y_UNIT_TEST_SUITE(FederatedQueryJoin) {
104102
"ch_database"_a = GetChDatabase(),
105103
"ch_user"_a = GetChUser(),
106104
"ch_password"_a = GetChPassword());
107-
auto result = session.ExecuteSchemeQuery(sql).GetValueSync();
105+
auto result = queryClient.ExecuteQuery(sql, NYdb::NQuery::TTxControl::NoTx()).GetValueSync();
108106
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
109107
}
110108

@@ -116,7 +114,6 @@ Y_UNIT_TEST_SUITE(FederatedQueryJoin) {
116114
WHERE ch.key > 998
117115
)sql";
118116

119-
auto queryClient = kikimr->GetQueryClient();
120117
auto result = queryClient.ExecuteQuery(sql, NYdb::NQuery::TTxControl::BeginTx().CommitTx()).GetValueSync();
121118
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
122119

ydb/core/kqp/ut/federated_query/s3/kqp_federated_scheme_ut.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using namespace NTestUtils;
1717
using namespace fmt::literals;
1818

1919
Y_UNIT_TEST_SUITE(KqpFederatedSchemeTest) {
20-
Y_UNIT_TEST(CreateExternalTable) {
20+
Y_UNIT_TEST(ExternalTableDdl) {
2121
enum EEx {
2222
Empty,
2323
IfExists,

ydb/core/kqp/ut/indexes/kqp_indexes_ut.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ TIntrusivePtr<IKqpHost> CreateKikimrQueryProcessor(TIntrusivePtr<IKqpGateway> ga
5555

5656
auto federatedQuerySetup = std::make_optional<TKqpFederatedQuerySetup>({NYql::IHTTPGateway::Make(), nullptr, nullptr, nullptr, {}, {}});
5757
return NKqp::CreateKqpHost(gateway, cluster, "/Root", kikimrConfig, moduleResolver,
58-
federatedQuerySetup, funcRegistry, funcRegistry, keepConfigChanges, nullptr, actorSystem);
58+
federatedQuerySetup, nullptr, funcRegistry, funcRegistry, keepConfigChanges, nullptr, actorSystem);
5959
}
6060

6161
NYql::NNodes::TExprBase GetExpr(const TString& ast, NYql::TExprContext& ctx, NYql::IModuleResolver* moduleResolver) {

ydb/core/kqp/ut/service/kqp_qs_queries_ut.cpp

+92
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,98 @@ Y_UNIT_TEST_SUITE(KqpQueryService) {
11601160
});
11611161
}
11621162

1163+
Y_UNIT_TEST(DdlSecret) {
1164+
NKikimrConfig::TAppConfig appConfig;
1165+
appConfig.MutableTableServiceConfig()->SetEnablePreparedDdl(true);
1166+
auto setting = NKikimrKqp::TKqpSetting();
1167+
auto serverSettings = TKikimrSettings()
1168+
.SetAppConfig(appConfig)
1169+
.SetKqpSettings({setting});
1170+
1171+
TKikimrRunner kikimr(serverSettings);
1172+
auto db = kikimr.GetQueryClient();
1173+
1174+
enum EEx {
1175+
Empty,
1176+
IfExists,
1177+
IfNotExists,
1178+
};
1179+
1180+
auto executeSql = [&](const TString& sql, bool expectSuccess) {
1181+
Cerr << "Execute SQL:\n" << sql << Endl;
1182+
1183+
auto result = db.ExecuteQuery(sql, TTxControl::NoTx()).ExtractValueSync();
1184+
if (expectSuccess) {
1185+
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
1186+
} else {
1187+
UNIT_ASSERT_VALUES_UNEQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
1188+
}
1189+
UNIT_ASSERT(result.GetResultSets().empty());
1190+
};
1191+
1192+
auto checkCreate = [&](bool expectSuccess, EEx exMode, int nameSuffix) {
1193+
UNIT_ASSERT_UNEQUAL(exMode, EEx::IfExists);
1194+
const TString ifNotExistsStatement = exMode == EEx::IfNotExists ? "IF NOT EXISTS" : "";
1195+
const TString sql = fmt::format(R"sql(
1196+
CREATE OBJECT {if_not_exists} my_secret_{name_suffix} (TYPE SECRET) WITH (value="qwerty");
1197+
)sql",
1198+
"if_not_exists"_a = ifNotExistsStatement,
1199+
"name_suffix"_a = nameSuffix
1200+
);
1201+
1202+
executeSql(sql, expectSuccess);
1203+
};
1204+
1205+
auto checkAlter = [&](bool expectSuccess, int nameSuffix) {
1206+
const TString sql = fmt::format(R"sql(
1207+
ALTER OBJECT my_secret_{name_suffix} (TYPE SECRET) SET value = "abcde";
1208+
)sql",
1209+
"name_suffix"_a = nameSuffix
1210+
);
1211+
1212+
executeSql(sql, expectSuccess);
1213+
};
1214+
1215+
auto checkUpsert = [&](bool expectSuccess, int nameSuffix) {
1216+
const TString sql = fmt::format(R"sql(
1217+
UPSERT OBJECT my_secret_{name_suffix} (TYPE SECRET) WITH value = "edcba";
1218+
)sql",
1219+
"name_suffix"_a = nameSuffix
1220+
);
1221+
1222+
executeSql(sql, expectSuccess);
1223+
};
1224+
1225+
auto checkDrop = [&](bool expectSuccess, EEx exMode, int nameSuffix) {
1226+
UNIT_ASSERT_UNEQUAL(exMode, EEx::IfNotExists);
1227+
const TString ifExistsStatement = exMode == EEx::IfExists ? "IF EXISTS" : "";
1228+
const TString sql = fmt::format(R"sql(
1229+
DROP OBJECT {if_exists} my_secret_{name_suffix} (TYPE SECRET);
1230+
)sql",
1231+
"if_exists"_a = ifExistsStatement,
1232+
"name_suffix"_a = nameSuffix
1233+
);
1234+
1235+
executeSql(sql, expectSuccess);
1236+
};
1237+
1238+
checkCreate(true, EEx::Empty, 0);
1239+
checkCreate(false, EEx::Empty, 0);
1240+
checkAlter(true, 0);
1241+
checkAlter(false, 2); // not exists
1242+
checkDrop(true, EEx::Empty, 0);
1243+
checkDrop(true, EEx::Empty, 0); // we don't check object existence
1244+
1245+
checkCreate(true, EEx::IfNotExists, 1);
1246+
checkCreate(true, EEx::IfNotExists, 1);
1247+
checkDrop(true, EEx::IfExists, 1);
1248+
checkDrop(true, EEx::IfExists, 1);
1249+
1250+
checkUpsert(true, 2);
1251+
checkCreate(false, EEx::Empty, 2); // already exists
1252+
checkUpsert(true, 2);
1253+
}
1254+
11631255
Y_UNIT_TEST(DdlCache) {
11641256
NKikimrConfig::TAppConfig appConfig;
11651257
appConfig.MutableTableServiceConfig()->SetEnablePreparedDdl(true);

ydb/core/protos/kqp_physical.proto

+15
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,17 @@ message TKqpPhyResult {
374374
optional uint32 QueryResultIndex = 5;
375375
}
376376

377+
message TKqpPhyMetadataOperation {
378+
message TColumnValue {
379+
string Column = 1;
380+
Ydb.Value Value = 2;
381+
}
382+
repeated TColumnValue ColumnValues = 1;
383+
384+
optional bool SuccessOnNotExist = 2;
385+
optional bool SuccessOnAlreadyExists = 3;
386+
}
387+
377388
message TKqpSchemeOperation {
378389
enum EFlags {
379390
FLAG_UNSPECIFIED = 0;
@@ -409,6 +420,10 @@ message TKqpSchemeOperation {
409420
NKikimrSchemeOp.TModifyScheme CreateView = 20;
410421
NKikimrSchemeOp.TModifyScheme AlterView = 21;
411422
NKikimrSchemeOp.TModifyScheme DropView = 22;
423+
TKqpPhyMetadataOperation CreateObject = 23;
424+
TKqpPhyMetadataOperation UpsertObject = 24;
425+
TKqpPhyMetadataOperation AlterObject = 25;
426+
TKqpPhyMetadataOperation DropObject = 26;
412427
}
413428
}
414429

0 commit comments

Comments
 (0)