aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorudovichenko-r <rvu@ydb.tech>2022-08-10 12:58:42 +0300
committerudovichenko-r <rvu@ydb.tech>2022-08-10 12:58:42 +0300
commit41c0210dc6f25ccb7584f1efd8dde6f3824a197e (patch)
treec2df241f7217833f8e8580fbd1c870324c4706be
parent80e5365ef2b1dd1a7c608103d8c13c0515aa8e95 (diff)
downloadydb-41c0210dc6f25ccb7584f1efd8dde6f3824a197e.tar.gz
[] replace into
-rw-r--r--ydb/library/yql/sql/v1/query.cpp3
-rw-r--r--ydb/library/yql/sql/v1/sql.cpp9
-rw-r--r--ydb/library/yql/sql/v1/sql_ut.cpp6
3 files changed, 3 insertions, 15 deletions
diff --git a/ydb/library/yql/sql/v1/query.cpp b/ydb/library/yql/sql/v1/query.cpp
index 9d7b22ec9f..4be71d3ab8 100644
--- a/ydb/library/yql/sql/v1/query.cpp
+++ b/ydb/library/yql/sql/v1/query.cpp
@@ -1470,7 +1470,8 @@ TNodePtr BuildDropRoles(TPosition pos, const TString& service, const TDeferredAt
static const TMap<EWriteColumnMode, TString> columnModeToStrMapMR {
{EWriteColumnMode::Default, ""},
{EWriteColumnMode::Insert, "append"},
- {EWriteColumnMode::Renew, "renew"}
+ {EWriteColumnMode::Renew, "renew"},
+ {EWriteColumnMode::Replace, "replace"},
};
static const TMap<EWriteColumnMode, TString> columnModeToStrMapStat {
diff --git a/ydb/library/yql/sql/v1/sql.cpp b/ydb/library/yql/sql/v1/sql.cpp
index dd3cc19d16..f23d57f6b3 100644
--- a/ydb/library/yql/sql/v1/sql.cpp
+++ b/ydb/library/yql/sql/v1/sql.cpp
@@ -8297,7 +8297,6 @@ bool TSqlIntoTable::ValidateServiceName(const TRule_into_table_stmt& node, const
ESQLWriteColumnMode mode, const TPosition& pos) {
Y_UNUSED(node);
auto serviceName = table.Service;
- const bool isMapReduce = serviceName == YtProviderName;
const bool isKikimr = serviceName == KikimrProviderName || serviceName == YdbProviderName;
const bool isRtmr = serviceName == RtmrProviderName;
const bool isStat = serviceName == StatProviderName;
@@ -8314,13 +8313,7 @@ bool TSqlIntoTable::ValidateServiceName(const TRule_into_table_stmt& node, const
}
}
- if (isMapReduce) {
- if (mode == ESQLWriteColumnMode::ReplaceInto) {
- Ctx.Error(pos) << "Meaning of REPLACE INTO has been changed, now you should use INSERT INTO <table> WITH TRUNCATE ... for " << serviceName;
- Ctx.IncrementMonCounter("sql_errors", "ReplaceIntoConflictUsage");
- return false;
- }
- } else if (isKikimr) {
+ if (isKikimr) {
if (mode == ESQLWriteColumnMode::InsertIntoWithTruncate) {
Ctx.Error(pos) << "INSERT INTO WITH TRUNCATE is not supported for " << serviceName << " tables";
Ctx.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr << "UnsupportedFor" << serviceName);
diff --git a/ydb/library/yql/sql/v1/sql_ut.cpp b/ydb/library/yql/sql/v1/sql_ut.cpp
index dbe336b261..e86e478609 100644
--- a/ydb/library/yql/sql/v1/sql_ut.cpp
+++ b/ydb/library/yql/sql/v1/sql_ut.cpp
@@ -2381,12 +2381,6 @@ Y_UNIT_TEST_SUITE(SqlToYQLErrors) {
UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:0: Error: INSERT OR ABORT INTO is not supported for yt tables\n");
}
- Y_UNIT_TEST(ReplaceIntoMapReduce) {
- NYql::TAstParseResult res = SqlToYql("REPLACE INTO plato.Output SELECT key FROM plato.Input");
- UNIT_ASSERT(!res.Root);
- UNIT_ASSERT_NO_DIFF(Err2Str(res), "<main>:1:0: Error: Meaning of REPLACE INTO has been changed, now you should use INSERT INTO <table> WITH TRUNCATE ... for yt\n");
- }
-
Y_UNIT_TEST(UpsertIntoMapReduce) {
NYql::TAstParseResult res = SqlToYql("UPSERT INTO plato.Output SELECT key FROM plato.Input");
UNIT_ASSERT(!res.Root);