2
2
3
3
#include < ydb/core/base/path.h>
4
4
#include < ydb/core/kqp/gateway/actors/scheme.h>
5
+ #include < ydb/core/kqp/gateway/utils/scheme_helpers.h>
5
6
#include < ydb/core/tx/tx_proxy/proxy.h>
6
7
7
8
namespace NKikimr ::NKqp {
@@ -36,6 +37,15 @@ std::pair<TString, TString> SplitPathByDb(const TString& objectId,
36
37
return pathPair;
37
38
}
38
39
40
+ std::pair<TString, TString> SplitPathByObjectId (const TString& objectId) {
41
+ std::pair<TString, TString> pathPair;
42
+ TString error;
43
+ if (!NSchemeHelpers::TrySplitTablePath (objectId, pathPair, error)) {
44
+ ythrow TBadArgumentException () << error;
45
+ }
46
+ return pathPair;
47
+ }
48
+
39
49
void FillCreateViewProposal (NKikimrSchemeOp::TModifyScheme& modifyScheme,
40
50
const NYql::TCreateObjectSettings& settings,
41
51
const TString& database) {
@@ -54,10 +64,9 @@ void FillCreateViewProposal(NKikimrSchemeOp::TModifyScheme& modifyScheme,
54
64
}
55
65
56
66
void FillDropViewProposal (NKikimrSchemeOp::TModifyScheme& modifyScheme,
57
- const NYql::TDropObjectSettings& settings,
58
- const TString& database) {
67
+ const NYql::TDropObjectSettings& settings) {
59
68
60
- const auto pathPair = SplitPathByDb (settings.GetObjectId (), database );
69
+ const auto pathPair = SplitPathByObjectId (settings.GetObjectId ());
61
70
modifyScheme.SetWorkingDir (pathPair.first );
62
71
modifyScheme.SetOperationType (NKikimrSchemeOp::ESchemeOpDropView);
63
72
@@ -103,7 +112,7 @@ NThreading::TFuture<TYqlConclusionStatus> DropView(const NYql::TDropObjectSettin
103
112
proposal->Record .SetUserToken (context.GetExternalData ().GetUserToken ()->GetSerializedToken ());
104
113
}
105
114
auto & schemeTx = *proposal->Record .MutableTransaction ()->MutableModifyScheme ();
106
- FillDropViewProposal (schemeTx, settings, context. GetExternalData (). GetDatabase () );
115
+ FillDropViewProposal (schemeTx, settings);
107
116
108
117
return SendSchemeRequest (proposal.Release (), context.GetExternalData ().GetActorSystem (), false );
109
118
}
@@ -115,9 +124,8 @@ void PrepareCreateView(NKqpProto::TKqpSchemeOperation& schemeOperation,
115
124
}
116
125
117
126
void PrepareDropView (NKqpProto::TKqpSchemeOperation& schemeOperation,
118
- const NYql::TObjectSettingsImpl& settings,
119
- TInternalModificationContext& context) {
120
- FillDropViewProposal (*schemeOperation.MutableDropView (), settings, context.GetExternalData ().GetDatabase ());
127
+ const NYql::TObjectSettingsImpl& settings) {
128
+ FillDropViewProposal (*schemeOperation.MutableDropView (), settings);
121
129
}
122
130
123
131
}
@@ -173,7 +181,7 @@ TViewManager::TYqlConclusionStatus TViewManager::DoPrepare(NKqpProto::TKqpScheme
173
181
PrepareCreateView (schemeOperation, settings, context);
174
182
break ;
175
183
case EActivityType::Drop:
176
- PrepareDropView (schemeOperation, settings, context );
184
+ PrepareDropView (schemeOperation, settings);
177
185
break ;
178
186
}
179
187
} catch (...) {
0 commit comments