summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/sql_into_tables.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-06-18 15:12:37 +0300
committervvvv <[email protected]>2025-06-18 15:49:04 +0300
commit379a419911ee1bbb93f56085133712fa5d8c3112 (patch)
treec68bfc7f62d5a601925ee586521da83ab69ea791 /yql/essentials/sql/v1/sql_into_tables.cpp
parentf96379cdde0b2b470d341cb8df3c4866478a3b1c (diff)
YQL-20086 sql
commit_hash:b06f3d2f5fa81e2073966eb172758758bd94fdf2
Diffstat (limited to 'yql/essentials/sql/v1/sql_into_tables.cpp')
-rw-r--r--yql/essentials/sql/v1/sql_into_tables.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/yql/essentials/sql/v1/sql_into_tables.cpp b/yql/essentials/sql/v1/sql_into_tables.cpp
index ff7dd271cd3..c4b4fd0c21a 100644
--- a/yql/essentials/sql/v1/sql_into_tables.cpp
+++ b/yql/essentials/sql/v1/sql_into_tables.cpp
@@ -79,15 +79,15 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
modeStrings.push_back("Into");
userModeStrings.push_back("INTO");
- SqlIntoModeStr = JoinRange("", modeStrings.begin(), modeStrings.end());
- SqlIntoUserModeStr = JoinRange(" ", userModeStrings.begin(), userModeStrings.end());
+ SqlIntoModeStr_ = JoinRange("", modeStrings.begin(), modeStrings.end());
+ SqlIntoUserModeStr_ = JoinRange(" ", userModeStrings.begin(), userModeStrings.end());
const auto& intoTableRef = node.GetRule_into_simple_table_ref3();
const auto& tableRef = intoTableRef.GetRule_simple_table_ref1();
const auto& tableRefCore = tableRef.GetRule_simple_table_ref_core1();
- auto service = Ctx.Scoped->CurrService;
- auto cluster = Ctx.Scoped->CurrCluster;
+ auto service = Ctx_.Scoped->CurrService;
+ auto cluster = Ctx_.Scoped->CurrCluster;
std::pair<bool, TDeferredAtom> nameOrAt;
bool isBinding = false;
switch (tableRefCore.Alt_case()) {
@@ -103,12 +103,12 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
}
if (!isBinding && cluster.Empty()) {
- Ctx.Error() << "No cluster name given and no default cluster is selected";
+ Ctx_.Error() << "No cluster name given and no default cluster is selected";
return nullptr;
}
auto id = Id(tableRefCore.GetAlt_simple_table_ref_core1().GetRule_object_ref1().GetRule_id_or_at2(), *this);
- nameOrAt = std::make_pair(id.first, TDeferredAtom(Ctx.Pos(), id.second));
+ nameOrAt = std::make_pair(id.first, TDeferredAtom(Ctx_.Pos(), id.second));
break;
}
case TRule_simple_table_ref_core::AltCase::kAltSimpleTableRefCore2: {
@@ -122,14 +122,14 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
return nullptr;
}
- named->SetRefPos(Ctx.Pos());
+ named->SetRefPos(Ctx_.Pos());
if (cluster.Empty()) {
- Ctx.Error() << "No cluster name given and no default cluster is selected";
+ Ctx_.Error() << "No cluster name given and no default cluster is selected";
return nullptr;
}
TDeferredAtom table;
- MakeTableFromExpression(Ctx.Pos(), Ctx, named, table);
+ MakeTableFromExpression(Ctx_.Pos(), Ctx_, named, table);
nameOrAt = std::make_pair(at, table);
break;
}
@@ -142,7 +142,7 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
if (tableRef.HasBlock2()) {
auto hints = TableHintsImpl(tableRef.GetBlock2().GetRule_table_hints1(), service);
if (!hints) {
- Ctx.Error() << "Failed to parse table hints";
+ Ctx_.Error() << "Failed to parse table hints";
return nullptr;
}
for (const auto& hint : *hints) {
@@ -157,7 +157,7 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
TVector<TString> eraseColumns;
if (intoTableRef.HasBlock2()) {
if (service != StatProviderName && service != UnknownProviderName) {
- Ctx.Error() << "ERASE BY is unsupported for " << service;
+ Ctx_.Error() << "ERASE BY is unsupported for " << service;
return nullptr;
}
@@ -167,19 +167,19 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
}
if (withTruncate) {
- if (SqlIntoModeStr != "InsertInto") {
- Error() << "Unable " << SqlIntoUserModeStr << " with truncate mode";
+ if (SqlIntoModeStr_ != "InsertInto") {
+ Error() << "Unable " << SqlIntoUserModeStr_ << " with truncate mode";
return nullptr;
}
- SqlIntoModeStr += "WithTruncate";
- SqlIntoUserModeStr += " ... WITH TRUNCATE";
+ SqlIntoModeStr_ += "WithTruncate";
+ SqlIntoUserModeStr_ += " ... WITH TRUNCATE";
}
- const auto iterMode = str2Mode.find(SqlIntoModeStr);
- YQL_ENSURE(iterMode != str2Mode.end(), "Invalid sql write mode string: " << SqlIntoModeStr);
+ const auto iterMode = str2Mode.find(SqlIntoModeStr_);
+ YQL_ENSURE(iterMode != str2Mode.end(), "Invalid sql write mode string: " << SqlIntoModeStr_);
const auto SqlIntoMode = iterMode->second;
- TPosition pos(Ctx.Pos());
- TTableRef table(Ctx.MakeName("table"), service, cluster, nullptr);
+ TPosition pos(Ctx_.Pos());
+ TTableRef table(Ctx_.MakeName("table"), service, cluster, nullptr);
if (isBinding) {
const TString* binding = nameOrAt.second.GetLiteral();
YQL_ENSURE(binding);
@@ -191,16 +191,16 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
table.Keys = BuildTableKey(pos, service, cluster, nameOrAt.second, {nameOrAt.first ? "@" : ""});
}
- Ctx.IncrementMonCounter("sql_insert_clusters", table.Cluster.GetLiteral() ? *table.Cluster.GetLiteral() : "unknown");
+ Ctx_.IncrementMonCounter("sql_insert_clusters", table.Cluster.GetLiteral() ? *table.Cluster.GetLiteral() : "unknown");
- auto values = TSqlIntoValues(Ctx, Mode).Build(node.GetRule_into_values_source4(), SqlIntoUserModeStr);
+ auto values = TSqlIntoValues(Ctx_, Mode_).Build(node.GetRule_into_values_source4(), SqlIntoUserModeStr_);
if (!values) {
return nullptr;
}
if (!ValidateServiceName(node, table, SqlIntoMode, GetPos(modeTokens[0]))) {
return nullptr;
}
- Ctx.IncrementMonCounter("sql_features", SqlIntoModeStr);
+ Ctx_.IncrementMonCounter("sql_features", SqlIntoModeStr_);
auto options = BuildIntoTableOptions(pos, eraseColumns, tableHints);
@@ -208,7 +208,7 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) {
options = options->L(options, ReturningList(node.GetBlock5().GetRule_returning_columns_list1()));
}
- return BuildWriteColumns(pos, Ctx.Scoped, table,
+ return BuildWriteColumns(pos, Ctx_.Scoped, table,
ToWriteColumnsMode(SqlIntoMode), std::move(values),
options);
}
@@ -232,34 +232,34 @@ bool TSqlIntoTable::ValidateServiceName(const TRule_into_table_stmt& node, const
mode == ESQLWriteColumnMode::InsertOrRevertInto ||
mode == ESQLWriteColumnMode::UpsertInto && !isStat)
{
- Ctx.Error(pos) << SqlIntoUserModeStr << " is not supported for " << serviceName << " tables";
- Ctx.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr << "UnsupportedFor" << serviceName);
+ Ctx_.Error(pos) << SqlIntoUserModeStr_ << " is not supported for " << serviceName << " tables";
+ Ctx_.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr_ << "UnsupportedFor" << serviceName);
return false;
}
}
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");
+ 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 (mode == ESQLWriteColumnMode::InsertIntoWithTruncate) {
- Ctx.Error(pos) << "INSERT INTO WITH TRUNCATE is not supported for " << serviceName << " tables";
- Ctx.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr << "UnsupportedFor" << serviceName);
+ Ctx_.Error(pos) << "INSERT INTO WITH TRUNCATE is not supported for " << serviceName << " tables";
+ Ctx_.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr_ << "UnsupportedFor" << serviceName);
return false;
}
} else if (isRtmr) {
if (mode != ESQLWriteColumnMode::InsertInto) {
- Ctx.Error(pos) << SqlIntoUserModeStr << " is unsupported for " << serviceName;
- Ctx.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr << "UnsupportedFor" << serviceName);
+ Ctx_.Error(pos) << SqlIntoUserModeStr_ << " is unsupported for " << serviceName;
+ Ctx_.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr_ << "UnsupportedFor" << serviceName);
return false;
}
} else if (isStat) {
if (mode != ESQLWriteColumnMode::UpsertInto) {
- Ctx.Error(pos) << SqlIntoUserModeStr << " is unsupported for " << serviceName;
- Ctx.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr << "UnsupportedFor" << serviceName);
+ Ctx_.Error(pos) << SqlIntoUserModeStr_ << " is unsupported for " << serviceName;
+ Ctx_.IncrementMonCounter("sql_errors", TStringBuilder() << SqlIntoUserModeStr_ << "UnsupportedFor" << serviceName);
return false;
}
}