@@ -76,7 +76,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
76
76
TKqpSchemeExecuter (
77
77
TKqpPhyTxHolder::TConstPtr phyTx, NKikimrKqp::EQueryType queryType, const TActorId& target, const TMaybe<TString>& requestType,
78
78
const TString& database, TIntrusiveConstPtr<NACLib::TUserToken> userToken, const TString& clientAddress,
79
- bool temporary, bool createTmpDir, bool isCreateTableAs, TString sessionId , TIntrusivePtr<TUserRequestContext> ctx,
79
+ bool temporary, bool createTmpDir, bool isCreateTableAs, TString tempDirName , TIntrusivePtr<TUserRequestContext> ctx,
80
80
const TActorId& kqpTempTablesAgentActor)
81
81
: PhyTx(phyTx)
82
82
, QueryType(queryType)
@@ -87,7 +87,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
87
87
, Temporary(temporary)
88
88
, CreateTmpDir(createTmpDir)
89
89
, IsCreateTableAs(isCreateTableAs)
90
- , SessionId(sessionId )
90
+ , TempDirName(tempDirName )
91
91
, RequestContext(std::move(ctx))
92
92
, RequestType(requestType)
93
93
, KqpTempTablesAgentActor(kqpTempTablesAgentActor)
@@ -157,7 +157,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
157
157
modifyScheme->SetFailOnExist (true );
158
158
159
159
auto * makeDir = modifyScheme->MutableMkDir ();
160
- makeDir->SetName (SessionId );
160
+ makeDir->SetName (TempDirName );
161
161
ActorIdToProto (KqpTempTablesAgentActor, modifyScheme->MutableTempDirOwnerActorId ());
162
162
163
163
if (UserToken) {
@@ -329,11 +329,12 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
329
329
switch (schemeOp.GetOperationCase ()) {
330
330
case NKqpProto::TKqpSchemeOperation::kCreateTable : {
331
331
auto modifyScheme = schemeOp.GetCreateTable ();
332
+ AFL_ENSURE (!IsCreateTableAs || Temporary);
332
333
if (Temporary) {
333
334
auto changePath = [this ](NKikimrSchemeOp::TTableDescription* tableDesc) {
334
335
const auto fullPath = JoinPath ({tableDesc->GetPath (), tableDesc->GetName ()});
335
336
YQL_ENSURE (fullPath.size () > 1 );
336
- tableDesc->SetName (GetCreateTempTablePath (Database, SessionId , fullPath));
337
+ tableDesc->SetName (GetCreateTempTablePath (Database, TempDirName , fullPath));
337
338
tableDesc->SetPath (Database);
338
339
};
339
340
@@ -348,7 +349,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
348
349
}
349
350
case NKikimrSchemeOp::ESchemeOpCreateColumnTable: {
350
351
modifyScheme.MutableCreateColumnTable ()->SetName (
351
- GetCreateTempTablePath (Database, SessionId , modifyScheme.GetCreateColumnTable ().GetName ()));
352
+ GetCreateTempTablePath (Database, TempDirName , modifyScheme.GetCreateColumnTable ().GetName ()));
352
353
break ;
353
354
}
354
355
default :
@@ -369,6 +370,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
369
370
370
371
case NKqpProto::TKqpSchemeOperation::kAlterTable : {
371
372
const auto & modifyScheme = schemeOp.GetAlterTable ();
373
+ AFL_ENSURE (!IsCreateTableAs || modifyScheme.GetOperationType () == NKikimrSchemeOp::ESchemeOpMoveTable);
372
374
ev->Record .MutableTransaction ()->MutableModifyScheme ()->CopyFrom (modifyScheme);
373
375
break ;
374
376
}
@@ -803,7 +805,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
803
805
void Handle (TEvPrivate::TEvMakeSessionDirResult::TPtr& result) {
804
806
if (!result->Get ()->Result .Success ()) {
805
807
InternalError (TStringBuilder ()
806
- << " Error creating directory for session " << SessionId
808
+ << " Error creating directory for session " << TempDirName
807
809
<< " : " << result->Get ()->Result .Issues ().ToString (true ));
808
810
}
809
811
MakeSchemeOperationRequest ();
@@ -1102,7 +1104,7 @@ class TKqpSchemeExecuter : public TActorBootstrapped<TKqpSchemeExecuter> {
1102
1104
bool Temporary;
1103
1105
bool CreateTmpDir;
1104
1106
bool IsCreateTableAs;
1105
- TString SessionId ;
1107
+ TString TempDirName ;
1106
1108
ui64 TxId = 0 ;
1107
1109
TActorId SchemePipeActorId_;
1108
1110
ui64 SchemeShardTabletId = 0 ;
@@ -1118,11 +1120,11 @@ IActor* CreateKqpSchemeExecuter(
1118
1120
const TMaybe<TString>& requestType, const TString& database,
1119
1121
TIntrusiveConstPtr<NACLib::TUserToken> userToken, const TString& clientAddress,
1120
1122
bool temporary, bool createTmpDir, bool isCreateTableAs,
1121
- TString sessionId , TIntrusivePtr<TUserRequestContext> ctx, const TActorId& kqpTempTablesAgentActor)
1123
+ TString tempDirName , TIntrusivePtr<TUserRequestContext> ctx, const TActorId& kqpTempTablesAgentActor)
1122
1124
{
1123
1125
return new TKqpSchemeExecuter (
1124
1126
phyTx, queryType, target, requestType, database, userToken, clientAddress,
1125
- temporary, createTmpDir, isCreateTableAs, sessionId , std::move (ctx), kqpTempTablesAgentActor);
1127
+ temporary, createTmpDir, isCreateTableAs, tempDirName , std::move (ctx), kqpTempTablesAgentActor);
1126
1128
}
1127
1129
1128
1130
} // namespace NKikimr::NKqp
0 commit comments