Skip to content

Commit c95fc8d

Browse files
committed
Fixed PR comments
1 parent b7b517a commit c95fc8d

19 files changed

+107
-101
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void FillCreateExternalDataSourceDesc(NKikimrSchemeOp::TExternalDataSourceDescri
3737
externaDataSourceDesc.SetSourceType(GetOrEmpty(settings, "source_type"));
3838
externaDataSourceDesc.SetLocation(GetOrEmpty(settings, "location"));
3939
externaDataSourceDesc.SetInstallation(GetOrEmpty(settings, "installation"));
40-
externaDataSourceDesc.SetIsReplace(settings.GetIsReplace());
40+
externaDataSourceDesc.SetReplaceIfExists(settings.GetReplaceIfExists());
4141

4242
TString authMethod = GetOrEmpty(settings, "auth_method");
4343
if (authMethod == "NONE") {

ydb/core/kqp/gateway/kqp_ic_gateway.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -855,11 +855,11 @@ class TKikimrIcGateway : public IKqpGateway {
855855
return profilesPromise.GetFuture();
856856
}
857857

858-
TFuture<TGenericResult> CreateTable(NYql::TKikimrTableMetadataPtr metadata, bool createDir, bool existingOk, bool isReplace) override {
858+
TFuture<TGenericResult> CreateTable(NYql::TKikimrTableMetadataPtr metadata, bool createDir, bool existingOk, bool replaceIfExists) override {
859859
Y_UNUSED(metadata);
860860
Y_UNUSED(createDir);
861861
Y_UNUSED(existingOk);
862-
Y_UNUSED(isReplace);
862+
Y_UNUSED(replaceIfExists);
863863
return NotImplemented<TGenericResult>();
864864
}
865865

@@ -1188,7 +1188,7 @@ class TKikimrIcGateway : public IKqpGateway {
11881188

11891189
TFuture<TGenericResult> CreateExternalTable(const TString& cluster,
11901190
const NYql::TCreateExternalTableSettings& settings,
1191-
bool createDir, bool existingOk, bool isReplace) override {
1191+
bool createDir, bool existingOk, bool replaceIfExists) override {
11921192
using TRequest = TEvTxUserProxy::TEvProposeTransaction;
11931193

11941194
try {
@@ -1215,7 +1215,7 @@ class TKikimrIcGateway : public IKqpGateway {
12151215
schemeTx.SetFailedOnAlreadyExists(!existingOk);
12161216

12171217
NKikimrSchemeOp::TExternalTableDescription& externalTableDesc = *schemeTx.MutableCreateExternalTable();
1218-
NSchemeHelpers::FillCreateExternalTableColumnDesc(externalTableDesc, pathPair.second, isReplace, settings);
1218+
NSchemeHelpers::FillCreateExternalTableColumnDesc(externalTableDesc, pathPair.second, replaceIfExists, settings);
12191219
return SendSchemeRequest(ev.Release(), true);
12201220
}
12211221
catch (yexception& e) {

ydb/core/kqp/gateway/utils/scheme_helpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ bool SetDatabaseForLoginOperation(TString& result, bool getDomainLoginOnly, TMay
6161

6262
void FillCreateExternalTableColumnDesc(NKikimrSchemeOp::TExternalTableDescription& externalTableDesc,
6363
const TString& name,
64-
bool isReplace,
64+
bool replaceIfExists,
6565
const NYql::TCreateExternalTableSettings& settings)
6666
{
6767
externalTableDesc.SetName(name);
6868
externalTableDesc.SetDataSourcePath(settings.DataSourcePath);
6969
externalTableDesc.SetLocation(settings.Location);
7070
externalTableDesc.SetSourceType("General");
71-
externalTableDesc.SetIsReplace(isReplace);
71+
externalTableDesc.SetReplaceIfExists(replaceIfExists);
7272

7373
Y_ENSURE(settings.ColumnOrder.size() == settings.Columns.size());
7474
for (const auto& name : settings.ColumnOrder) {

ydb/core/kqp/gateway/utils/scheme_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bool SetDatabaseForLoginOperation(TString& result, bool getDomainLoginOnly, TMay
2929

3030
void FillCreateExternalTableColumnDesc(NKikimrSchemeOp::TExternalTableDescription& externalTableDesc,
3131
const TString& name,
32-
bool isReplace,
32+
bool replaceIfExists,
3333
const NYql::TCreateExternalTableSettings& settings);
3434

3535
std::pair<TString, TString> SplitPathByDirAndBaseNames(const TString& path);

ydb/core/kqp/host/kqp_gateway_proxy.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ class TKqpGatewayProxy : public IKikimrGateway {
444444
return Gateway->LoadTableMetadata(cluster, table, settings);
445445
}
446446

447-
TFuture<TGenericResult> CreateTable(TKikimrTableMetadataPtr metadata, bool createDir, bool existingOk, bool isReplace) override {
448-
Y_UNUSED(isReplace);
447+
TFuture<TGenericResult> CreateTable(TKikimrTableMetadataPtr metadata, bool createDir, bool existingOk, bool replaceIfExists) override {
448+
Y_UNUSED(replaceIfExists);
449449
CHECK_PREPARED_DDL(CreateTable);
450450

451451
std::pair<TString, TString> pathPair;
@@ -1244,7 +1244,7 @@ class TKqpGatewayProxy : public IKikimrGateway {
12441244
}
12451245

12461246
TFuture<TGenericResult> CreateExternalTable(const TString& cluster, const TCreateExternalTableSettings& settings,
1247-
bool createDir, bool existingOk, bool isReplace) override
1247+
bool createDir, bool existingOk, bool replaceIfExists) override
12481248
{
12491249
CHECK_PREPARED_DDL(CreateExternalTable);
12501250

@@ -1271,13 +1271,13 @@ class TKqpGatewayProxy : public IKikimrGateway {
12711271
schemeTx.SetFailedOnAlreadyExists(!existingOk);
12721272

12731273
NKikimrSchemeOp::TExternalTableDescription& externalTableDesc = *schemeTx.MutableCreateExternalTable();
1274-
NSchemeHelpers::FillCreateExternalTableColumnDesc(externalTableDesc, pathPair.second, isReplace, settings);
1274+
NSchemeHelpers::FillCreateExternalTableColumnDesc(externalTableDesc, pathPair.second, replaceIfExists, settings);
12751275
TGenericResult result;
12761276
result.SetSuccess();
12771277
phyTxRemover.Forget();
12781278
return MakeFuture(result);
12791279
} else {
1280-
return Gateway->CreateExternalTable(cluster, settings, createDir, existingOk, isReplace);
1280+
return Gateway->CreateExternalTable(cluster, settings, createDir, existingOk, replaceIfExists);
12811281
}
12821282
}
12831283

ydb/core/kqp/provider/yql_kikimr_datasink.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ class TKikimrDataSink : public TDataProviderBase
779779
? settings.Temporary.Cast()
780780
: Build<TCoAtom>(ctx, node->Pos()).Value("false").Done();
781781

782-
auto isReplace = (settings.Mode.Cast().Value() == "create_or_replace");
782+
auto replaceIfExists = (settings.Mode.Cast().Value() == "create_or_replace");
783783
auto existringOk = (settings.Mode.Cast().Value() == "create_if_not_exists");
784784

785785
return Build<TKiCreateTable>(ctx, node->Pos())
@@ -796,8 +796,8 @@ class TKikimrDataSink : public TDataProviderBase
796796
.ColumnFamilies(settings.ColumnFamilies.Cast())
797797
.TableSettings(settings.TableSettings.Cast())
798798
.TableType(tableType)
799-
.IsReplace<TCoAtom>()
800-
.Value(isReplace)
799+
.ReplaceIfExists<TCoAtom>()
800+
.Value(replaceIfExists)
801801
.Build()
802802
.ExistingOk<TCoAtom>()
803803
.Value(existringOk)
@@ -897,7 +897,7 @@ class TKikimrDataSink : public TDataProviderBase
897897
.ObjectId().Build(key.GetObjectId())
898898
.TypeId().Build(key.GetObjectType())
899899
.Features(settings.Features)
900-
.IsReplace<TCoAtom>()
900+
.ReplaceIfExists<TCoAtom>()
901901
.Value(mode == "createObjectOrReplace")
902902
.Build()
903903
.ExistingOk<TCoAtom>()

ydb/core/kqp/provider/yql_kikimr_exec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,11 +934,11 @@ class TKiSinkCallableExecutionTransformer : public TAsyncCallbackTransformer<TKi
934934
NThreading::TFuture<IKikimrGateway::TGenericResult> future;
935935
bool isColumn = (table.Metadata->StoreType == EStoreType::Column);
936936
bool existingOk = (maybeCreate.ExistingOk().Cast().Value() == "1");
937-
bool isReplace = (maybeCreate.IsReplace().Cast().Value() == "1");
937+
bool replaceIfExists = (maybeCreate.ReplaceIfExists().Cast().Value() == "1");
938938
switch (tableTypeItem) {
939939
case ETableType::ExternalTable: {
940940
future = Gateway->CreateExternalTable(cluster,
941-
ParseCreateExternalTableSettings(maybeCreate.Cast(), table.Metadata->TableSettings), true, existingOk, isReplace);
941+
ParseCreateExternalTableSettings(maybeCreate.Cast(), table.Metadata->TableSettings), true, existingOk, replaceIfExists);
942942
break;
943943
}
944944
case ETableType::TableStore: {

ydb/core/kqp/provider/yql_kikimr_expr_nodes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
{"Index": 11, "Name": "TableType", "Type": "TCoAtom"},
133133
{"Index": 12, "Name": "Temporary", "Type": "TCoAtom"},
134134
{"Index": 13, "Name": "ExistingOk", "Type": "TCoAtom"},
135-
{"Index": 14, "Name": "IsReplace", "Type": "TCoAtom"}
135+
{"Index": 14, "Name": "ReplaceIfExists", "Type": "TCoAtom"}
136136
]
137137
},
138138
{
@@ -256,7 +256,7 @@
256256
{"Index": 3, "Name": "TypeId", "Type": "TCoAtom"},
257257
{"Index": 4, "Name": "Features", "Type": "TCoNameValueTupleList"},
258258
{"Index": 5, "Name": "ExistingOk", "Type": "TCoAtom"},
259-
{"Index": 6, "Name": "IsReplace", "Type": "TCoAtom"}
259+
{"Index": 6, "Name": "ReplaceIfExists", "Type": "TCoAtom"}
260260
]
261261
},
262262
{

ydb/core/kqp/provider/yql_kikimr_gateway.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ class IKikimrGateway : public TThrRefBase {
843843

844844
virtual NThreading::TFuture<TGenericResult> DropTableStore(const TString& cluster, const TDropTableStoreSettings& settings) = 0;
845845

846-
virtual NThreading::TFuture<TGenericResult> CreateExternalTable(const TString& cluster, const TCreateExternalTableSettings& settings, bool createDir, bool existingOk, bool isReplace) = 0;
846+
virtual NThreading::TFuture<TGenericResult> CreateExternalTable(const TString& cluster, const TCreateExternalTableSettings& settings, bool createDir, bool existingOk, bool replaceIfExists) = 0;
847847

848848
virtual NThreading::TFuture<TGenericResult> AlterExternalTable(const TString& cluster, const TAlterExternalTableSettings& settings) = 0;
849849

ydb/core/protos/flat_scheme_op.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ message TExternalTableDescription {
18061806
optional string Location = 6;
18071807
repeated TColumnDescription Columns = 7;
18081808
optional bytes Content = 8;
1809-
optional bool IsReplace = 9;
1809+
optional bool ReplaceIfExists = 9;
18101810
}
18111811

18121812
// Access without authorization
@@ -1867,7 +1867,7 @@ message TExternalDataSourceDescription {
18671867
optional string Installation = 6;
18681868
optional TAuth Auth = 7;
18691869
optional TExternalDataSourceProperties Properties = 8;
1870-
optional bool IsReplace = 9;
1870+
optional bool ReplaceIfExists = 9;
18711871
}
18721872

18731873
message TViewDescription {

ydb/library/yql/sql/v1/SQLv1.g.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ values_source_row: LPAREN expr_list RPAREN;
570570

571571
simple_values_source: expr_list | select_stmt;
572572

573-
create_external_data_source_stmt: CREATE EXTERNAL DATA SOURCE (IF NOT EXISTS | OR REPLACE)? object_ref
573+
create_external_data_source_stmt: CREATE (OR REPLACE)? EXTERNAL DATA SOURCE (IF NOT EXISTS)? object_ref
574574
with_table_settings
575575
;
576576

@@ -623,7 +623,7 @@ object_features: object_feature | LPAREN object_feature (COMMA object_feature)*
623623

624624
object_type_ref: an_id_or_type;
625625

626-
create_table_stmt: CREATE (TABLE | TABLESTORE | EXTERNAL TABLE) (IF NOT EXISTS | OR REPLACE)? simple_table_ref LPAREN create_table_entry (COMMA create_table_entry)* COMMA? RPAREN
626+
create_table_stmt: CREATE (OR REPLACE)? (TABLE | TABLESTORE | EXTERNAL TABLE) (IF NOT EXISTS)? simple_table_ref LPAREN create_table_entry (COMMA create_table_entry)* COMMA? RPAREN
627627
table_inherits?
628628
table_partition_by?
629629
with_table_settings?

ydb/library/yql/sql/v1/format/sql_format.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -891,27 +891,24 @@ friend struct TStaticData;
891891
Visit(msg.GetToken1());
892892
Visit(msg.GetBlock2());
893893
Visit(msg.GetBlock3());
894-
Visit(msg.GetRule_simple_table_ref4());
895-
Visit(msg.GetToken5());
894+
Visit(msg.GetBlock4());
895+
Visit(msg.GetRule_simple_table_ref5());
896+
Visit(msg.GetToken6());
896897
PushCurrentIndent();
897898
NewLine();
898-
Visit(msg.GetRule_create_table_entry6());
899-
for (const auto& b : msg.GetBlock7()) {
899+
Visit(msg.GetRule_create_table_entry7());
900+
for (const auto& b : msg.GetBlock8()) {
900901
Visit(b.GetToken1());
901902
NewLine();
902903
Visit(b.GetRule_create_table_entry2());
903904
}
904-
if (msg.HasBlock8()) {
905-
Visit(msg.GetBlock8());
905+
if (msg.HasBlock9()) {
906+
Visit(msg.GetBlock9());
906907
}
907908

908909
PopCurrentIndent();
909910
NewLine();
910-
Visit(msg.GetToken9());
911-
if (msg.HasBlock10()) {
912-
NewLine();
913-
Visit(msg.GetBlock10());
914-
}
911+
Visit(msg.GetToken10());
915912
if (msg.HasBlock11()) {
916913
NewLine();
917914
Visit(msg.GetBlock11());
@@ -924,6 +921,10 @@ friend struct TStaticData;
924921
NewLine();
925922
Visit(msg.GetBlock13());
926923
}
924+
if (msg.HasBlock14()) {
925+
NewLine();
926+
Visit(msg.GetBlock14());
927+
}
927928
}
928929

929930
void VisitDropTable(const TRule_drop_table_stmt& msg) {

ydb/library/yql/sql/v1/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ namespace NSQLTranslationV1 {
12311231
TNodePtr BuildUpsertObjectOperation(TPosition pos, const TString& objectId, const TString& typeId,
12321232
std::map<TString, TDeferredAtom>&& features, const TObjectOperatorContext& context);
12331233
TNodePtr BuildCreateObjectOperation(TPosition pos, const TString& objectId, const TString& typeId,
1234-
bool existingOk, bool isReplace, std::map<TString, TDeferredAtom>&& features, const TObjectOperatorContext& context);
1234+
bool existingOk, bool replaceIfExists, std::map<TString, TDeferredAtom>&& features, const TObjectOperatorContext& context);
12351235
TNodePtr BuildAlterObjectOperation(TPosition pos, const TString& secretId, const TString& typeId,
12361236
std::map<TString, TDeferredAtom>&& features, std::set<TString>&& featuresToReset, const TObjectOperatorContext& context);
12371237
TNodePtr BuildDropObjectOperation(TPosition pos, const TString& secretId, const TString& typeId,

ydb/library/yql/sql/v1/object_processing.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class TCreateObject: public TObjectProcessorImpl {
4040
std::set<TString> FeaturesToReset;
4141
protected:
4242
bool ExistingOk = false;
43-
bool IsReplace = false;
43+
bool ReplaceIfExists = false;
4444
protected:
4545
virtual INode::TPtr BuildOptions() const override {
4646
TString mode;
4747
if (ExistingOk) {
4848
mode = "createObjectIfNotExists";
49-
} else if (IsReplace) {
49+
} else if (ReplaceIfExists) {
5050
mode = "createObjectOrReplace";
5151
} else {
5252
mode = "createObject";
@@ -57,12 +57,12 @@ class TCreateObject: public TObjectProcessorImpl {
5757
virtual INode::TPtr FillFeatures(INode::TPtr options) const override;
5858
public:
5959
TCreateObject(TPosition pos, const TString& objectId,
60-
const TString& typeId, bool existingOk, bool isReplace, std::map<TString, TDeferredAtom>&& features, std::set<TString>&& featuresToReset, const TObjectOperatorContext& context)
60+
const TString& typeId, bool existingOk, bool replaceIfExists, std::map<TString, TDeferredAtom>&& features, std::set<TString>&& featuresToReset, const TObjectOperatorContext& context)
6161
: TBase(pos, objectId, typeId, context)
6262
, Features(std::move(features))
6363
, FeaturesToReset(std::move(featuresToReset))
6464
, ExistingOk(existingOk)
65-
, IsReplace(isReplace) {
65+
, ReplaceIfExists(replaceIfExists) {
6666
}
6767
};
6868

ydb/library/yql/sql/v1/query.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,12 +808,12 @@ TNodePtr BuildInputTables(TPosition pos, const TTableList& tables, bool inSubque
808808

809809
class TCreateTableNode final: public TAstListNode {
810810
public:
811-
TCreateTableNode(TPosition pos, const TTableRef& tr, bool existingOk, bool isReplace, const TCreateTableParameters& params, TScopedStatePtr scoped)
811+
TCreateTableNode(TPosition pos, const TTableRef& tr, bool existingOk, bool replaceIfExists, const TCreateTableParameters& params, TScopedStatePtr scoped)
812812
: TAstListNode(pos)
813813
, Table(tr)
814814
, Params(params)
815815
, ExistingOk(existingOk)
816-
, IsReplace(isReplace)
816+
, ReplaceIfExists(replaceIfExists)
817817
, Scoped(scoped)
818818
{
819819
scoped->UseCluster(Table.Service, Table.Cluster);
@@ -901,7 +901,7 @@ class TCreateTableNode final: public TAstListNode {
901901

902902
if (ExistingOk) {
903903
opts = L(opts, Q(Y(Q("mode"), Q("create_if_not_exists"))));
904-
} else if (IsReplace) {
904+
} else if (ReplaceIfExists) {
905905
opts = L(opts, Q(Y(Q("mode"), Q("create_or_replace"))));
906906
} else {
907907
opts = L(opts, Q(Y(Q("mode"), Q("create"))));
@@ -1156,13 +1156,13 @@ class TCreateTableNode final: public TAstListNode {
11561156
const TTableRef Table;
11571157
const TCreateTableParameters Params;
11581158
const bool ExistingOk;
1159-
const bool IsReplace;
1159+
const bool ReplaceIfExists;
11601160
TScopedStatePtr Scoped;
11611161
};
11621162

1163-
TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, bool existingOk, bool isReplace, const TCreateTableParameters& params, TScopedStatePtr scoped)
1163+
TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, bool existingOk, bool replaceIfExists, const TCreateTableParameters& params, TScopedStatePtr scoped)
11641164
{
1165-
return new TCreateTableNode(pos, tr, existingOk, isReplace, params, scoped);
1165+
return new TCreateTableNode(pos, tr, existingOk, replaceIfExists, params, scoped);
11661166
}
11671167

11681168
class TAlterTableNode final: public TAstListNode {
@@ -2120,8 +2120,8 @@ TNodePtr BuildUpsertObjectOperation(TPosition pos, const TString& objectId, cons
21202120
return new TUpsertObject(pos, objectId, typeId, false, false, std::move(features), std::set<TString>(), context);
21212121
}
21222122
TNodePtr BuildCreateObjectOperation(TPosition pos, const TString& objectId, const TString& typeId,
2123-
bool existingOk, bool isReplace, std::map<TString, TDeferredAtom>&& features, const TObjectOperatorContext& context) {
2124-
return new TCreateObject(pos, objectId, typeId, existingOk, isReplace, std::move(features), std::set<TString>(), context);
2123+
bool existingOk, bool replaceIfExists, std::map<TString, TDeferredAtom>&& features, const TObjectOperatorContext& context) {
2124+
return new TCreateObject(pos, objectId, typeId, existingOk, replaceIfExists, std::move(features), std::set<TString>(), context);
21252125
}
21262126
TNodePtr BuildAlterObjectOperation(TPosition pos, const TString& secretId, const TString& typeId,
21272127
std::map<TString, TDeferredAtom>&& features, std::set<TString>&& featuresToReset, const TObjectOperatorContext& context)

ydb/library/yql/sql/v1/source.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ namespace NSQLTranslationV1 {
295295
TNodePtr BuildTopicKey(TPosition pos, const TDeferredAtom& cluster, const TDeferredAtom& name);
296296
TNodePtr BuildInputOptions(TPosition pos, const TTableHints& hints);
297297
TNodePtr BuildInputTables(TPosition pos, const TTableList& tables, bool inSubquery, TScopedStatePtr scoped);
298-
TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, bool existingOk, bool isReplace, const TCreateTableParameters& params, TScopedStatePtr scoped);
298+
TNodePtr BuildCreateTable(TPosition pos, const TTableRef& tr, bool existingOk, bool replaceIfExists, const TCreateTableParameters& params, TScopedStatePtr scoped);
299299
TNodePtr BuildAlterTable(TPosition pos, const TTableRef& tr, const TAlterTableParameters& params, TScopedStatePtr scoped);
300300
TNodePtr BuildDropTable(TPosition pos, const TTableRef& table, bool missingOk, ETableType tableType, TScopedStatePtr scoped);
301301
TNodePtr BuildWriteTable(TPosition pos, const TString& label, const TTableRef& table, EWriteColumnMode mode, TNodePtr options,

0 commit comments

Comments
 (0)