summaryrefslogtreecommitdiffstats
path: root/yql/essentials/sql/v1/format/sql_format.cpp
diff options
context:
space:
mode:
authorvitya-smirnov <[email protected]>2025-10-07 09:34:39 +0300
committervitya-smirnov <[email protected]>2025-10-07 09:52:14 +0300
commitbabe7533f18c11be1f8a195ed2324d2d9a89436a (patch)
tree45b7627141bf5a52b45a3d61fd1fbdd564bb8dd9 /yql/essentials/sql/v1/format/sql_format.cpp
parent8fe7cfe254fde2772477a8933a163b5f303716b4 (diff)
YQL-20086 sql/v1
commit_hash:55bc611cdaa0d8a0fc3c4c7708ed9f17cc4976cf
Diffstat (limited to 'yql/essentials/sql/v1/format/sql_format.cpp')
-rw-r--r--yql/essentials/sql/v1/format/sql_format.cpp1128
1 files changed, 563 insertions, 565 deletions
diff --git a/yql/essentials/sql/v1/format/sql_format.cpp b/yql/essentials/sql/v1/format/sql_format.cpp
index d76b64df3b7..aed116585a6 100644
--- a/yql/essentials/sql/v1/format/sql_format.cpp
+++ b/yql/essentials/sql/v1/format/sql_format.cpp
@@ -16,7 +16,6 @@
#include <util/string/subst.h>
#include <util/generic/hash_set.h>
-
namespace NSQLFormat {
namespace {
@@ -54,8 +53,7 @@ void SkipForValidate(
TTokenIterator& out,
const TParsedTokenList& query,
const TParsedTokenList& formattedQuery,
- i32& parenthesesBalance
-) {
+ i32& parenthesesBalance) {
in = SkipWS(in, query.end());
out = SkipWS(out, formattedQuery.end());
@@ -66,8 +64,7 @@ void SkipForValidate(
out != formattedQuery.end() && out->Name == addedToken &&
(in == query.end() || in->Name != addedToken) &&
(beforeTokens.empty() || (inSkippedComments != query.end() && IsIn(beforeTokens, inSkippedComments->Name))) &&
- (afterTokens.empty() || (in != query.begin() && IsIn(afterTokens, SkipWSOrCommentBackward(in - 1, query.begin())->Name)))
- ) {
+ (afterTokens.empty() || (in != query.begin() && IsIn(afterTokens, SkipWSOrCommentBackward(in - 1, query.begin())->Name)))) {
out = SkipWS(++out, formattedQuery.end());
if (addedToken == "LPAREN") {
++parenthesesBalance;
@@ -85,15 +82,15 @@ void SkipForValidate(
if (
in != query.end() && in->Name == deletedToken &&
(out == formattedQuery.end() || out->Name != deletedToken) &&
- in != query.begin() && IsIn(afterTokens, SkipWSOrCommentBackward(in - 1, query.begin())->Name)
- ) {
+ in != query.begin() && IsIn(afterTokens, SkipWSOrCommentBackward(in - 1, query.begin())->Name)) {
in = SkipWS(++in, query.end());
return true;
}
return false;
};
- while (skipDeletedToken("SEMICOLON", {"AS", "BEGIN", "LBRACE_CURLY", "SEMICOLON"})) {}
+ while (skipDeletedToken("SEMICOLON", {"AS", "BEGIN", "LBRACE_CURLY", "SEMICOLON"})) {
+ }
}
TParsedToken TransformTokenForValidate(TParsedToken token) {
@@ -202,11 +199,13 @@ void VisitAllFieldsImpl(T* obj, const NProtoBuf::Descriptor* descr, const NProto
}
class TObfuscatingVisitor {
-friend struct TStaticData;
+ friend struct TStaticData;
+
public:
TObfuscatingVisitor()
: StaticData_(TStaticData::GetInstance())
- {}
+ {
+ }
TString Process(const NProtoBuf::Message& msg) {
Scopes_.push_back(EScope::Default);
@@ -247,42 +246,42 @@ private:
void VisitPragmaValue(const TRule_pragma_value& msg) {
switch (msg.Alt_case()) {
- case TRule_pragma_value::kAltPragmaValue1: {
- NextToken_ = "0";
- break;
- }
- case TRule_pragma_value::kAltPragmaValue3: {
- NextToken_ = "'str'";
- break;
- }
- case TRule_pragma_value::kAltPragmaValue4: {
- NextToken_ = "false";
- break;
- }
- default:;
+ case TRule_pragma_value::kAltPragmaValue1: {
+ NextToken_ = "0";
+ break;
+ }
+ case TRule_pragma_value::kAltPragmaValue3: {
+ NextToken_ = "'str'";
+ break;
+ }
+ case TRule_pragma_value::kAltPragmaValue4: {
+ NextToken_ = "false";
+ break;
+ }
+ default:;
}
VisitAllFields(TRule_pragma_value::GetDescriptor(), msg);
}
void VisitLiteralValue(const TRule_literal_value& msg) {
switch (msg.Alt_case()) {
- case TRule_literal_value::kAltLiteralValue1: {
- NextToken_ = "0";
- break;
- }
- case TRule_literal_value::kAltLiteralValue2: {
- NextToken_ = "0.0";
- break;
- }
- case TRule_literal_value::kAltLiteralValue3: {
- NextToken_ = "'str'";
- break;
- }
- case TRule_literal_value::kAltLiteralValue9: {
- NextToken_ = "false";
- break;
- }
- default:;
+ case TRule_literal_value::kAltLiteralValue1: {
+ NextToken_ = "0";
+ break;
+ }
+ case TRule_literal_value::kAltLiteralValue2: {
+ NextToken_ = "0.0";
+ break;
+ }
+ case TRule_literal_value::kAltLiteralValue3: {
+ NextToken_ = "'str'";
+ break;
+ }
+ case TRule_literal_value::kAltLiteralValue9: {
+ NextToken_ = "false";
+ break;
+ }
+ default:;
}
VisitAllFields(TRule_literal_value::GetDescriptor(), msg);
@@ -290,11 +289,11 @@ private:
void VisitAtomExpr(const TRule_atom_expr& msg) {
switch (msg.Alt_case()) {
- case TRule_atom_expr::kAltAtomExpr7: {
- FuncCall_ = true;
- break;
- }
- default:;
+ case TRule_atom_expr::kAltAtomExpr7: {
+ FuncCall_ = true;
+ break;
+ }
+ default:;
}
VisitAllFields(TRule_atom_expr::GetDescriptor(), msg);
@@ -303,11 +302,11 @@ private:
void VisitInAtomExpr(const TRule_in_atom_expr& msg) {
switch (msg.Alt_case()) {
- case TRule_in_atom_expr::kAltInAtomExpr6: {
- FuncCall_ = true;
- break;
- }
- default:;
+ case TRule_in_atom_expr::kAltInAtomExpr6: {
+ FuncCall_ = true;
+ break;
+ }
+ default:;
}
VisitAllFields(TRule_in_atom_expr::GetDescriptor(), msg);
@@ -318,11 +317,11 @@ private:
bool invoke = false;
for (auto& b : msg.GetRule_unary_subexpr_suffix2().GetBlock1()) {
switch (b.GetBlock1().Alt_case()) {
- case TRule_unary_subexpr_suffix::TBlock1::TBlock1::kAlt2: {
- invoke = true;
- break;
- }
- default:;
+ case TRule_unary_subexpr_suffix::TBlock1::TBlock1::kAlt2: {
+ invoke = true;
+ break;
+ }
+ default:;
}
break;
@@ -344,11 +343,11 @@ private:
bool invoke = false;
for (auto& b : msg.GetRule_unary_subexpr_suffix2().GetBlock1()) {
switch (b.GetBlock1().Alt_case()) {
- case TRule_unary_subexpr_suffix::TBlock1::TBlock1::kAlt2: {
- invoke = true;
- break;
- }
- default:;
+ case TRule_unary_subexpr_suffix::TBlock1::TBlock1::kAlt2: {
+ invoke = true;
+ break;
+ }
+ default:;
}
break;
@@ -398,7 +397,8 @@ private:
};
class TPrettyVisitor {
-friend struct TStaticData;
+ friend struct TStaticData;
+
public:
TPrettyVisitor(const TParsedTokenList& parsedTokens, const TParsedTokenList& comments, bool ansiLexer)
: StaticData_(TStaticData::GetInstance())
@@ -508,8 +508,7 @@ private:
if (!text.StartsWith("--") &&
TokenIndex_ < ParsedTokens_.size() &&
Comments_[LastComment_].Line < ParsedTokens_[TokenIndex_].Line &&
- (LastComment_ + 1 >= Comments_.size() || Comments_[LastComment_].Line < Comments_[LastComment_ + 1].Line)
- ) {
+ (LastComment_ + 1 >= Comments_.size() || Comments_[LastComment_].Line < Comments_[LastComment_ + 1].Line)) {
Out('\n');
}
}
@@ -660,7 +659,7 @@ private:
void Visit(const NProtoBuf::Message& msg) {
const NProtoBuf::Descriptor* descr = msg.GetDescriptor();
- //Cerr << descr->name() << "\n";
+ // Cerr << descr->name() << "\n";
auto scopePtr = StaticData_.ScopeDispatch.FindPtr(descr);
if (descr == TRule_invoke_expr::GetDescriptor()) {
AfterInvokeExpr_ = true;
@@ -696,10 +695,10 @@ private:
TMaybe<bool> IsSimpleStatement(const TRule_sql_stmt_core& msg) {
switch (msg.Alt_case()) {
- case TRule_sql_stmt_core::kAltSqlStmtCore1: // pragma
- case TRule_sql_stmt_core::kAltSqlStmtCore5: // drop table
- case TRule_sql_stmt_core::kAltSqlStmtCore6: // use
- case TRule_sql_stmt_core::kAltSqlStmtCore8: // commit
+ case TRule_sql_stmt_core::kAltSqlStmtCore1: // pragma
+ case TRule_sql_stmt_core::kAltSqlStmtCore5: // drop table
+ case TRule_sql_stmt_core::kAltSqlStmtCore6: // use
+ case TRule_sql_stmt_core::kAltSqlStmtCore8: // commit
case TRule_sql_stmt_core::kAltSqlStmtCore11: // rollback
case TRule_sql_stmt_core::kAltSqlStmtCore12: // declare
case TRule_sql_stmt_core::kAltSqlStmtCore13: // import
@@ -714,10 +713,9 @@ private:
case TRule_sql_stmt_core::kAltSqlStmtCore3: { // named nodes
const auto& stmt = msg.GetAlt_sql_stmt_core3().GetRule_named_nodes_stmt1();
- const bool isSelect = (
- (stmt.GetBlock3().HasAlt1() &&
- IsSelect(stmt.GetBlock3().GetAlt1().GetRule_expr1())) ||
- (stmt.GetBlock3().HasAlt2()));
+ const bool isSelect = ((stmt.GetBlock3().HasAlt1() &&
+ IsSelect(stmt.GetBlock3().GetAlt1().GetRule_expr1())) ||
+ (stmt.GetBlock3().HasAlt2()));
if (!isSelect) {
return true;
@@ -937,26 +935,26 @@ private:
ExprLineIndent_ = CurrentIndent_;
switch (msg.GetBlock3().Alt_case()) {
- case TRule_named_nodes_stmt::TBlock3::kAlt1: {
- const auto& alt = msg.GetBlock3().GetAlt1();
- Visit(alt);
- break;
- }
+ case TRule_named_nodes_stmt::TBlock3::kAlt1: {
+ const auto& alt = msg.GetBlock3().GetAlt1();
+ Visit(alt);
+ break;
+ }
- case TRule_named_nodes_stmt::TBlock3::kAlt2: {
- const auto& alt = msg.GetBlock3().GetAlt2();
- Out(" (");
- NewLine();
- PushCurrentIndent();
- Visit(alt);
- PopCurrentIndent();
- NewLine();
- Out(')');
- break;
- }
+ case TRule_named_nodes_stmt::TBlock3::kAlt2: {
+ const auto& alt = msg.GetBlock3().GetAlt2();
+ Out(" (");
+ NewLine();
+ PushCurrentIndent();
+ Visit(alt);
+ PopCurrentIndent();
+ NewLine();
+ Out(')');
+ break;
+ }
- default:
- ythrow yexception() << "Alt is not supported";
+ default:
+ ythrow yexception() << "Alt is not supported";
}
ExprLineIndent_ = 0;
@@ -1081,107 +1079,106 @@ private:
Visit(msg.GetToken2());
Visit(msg.GetRule_simple_table_ref3());
switch (msg.GetBlock4().Alt_case()) {
- case TRule_update_stmt_TBlock4::kAlt1: {
- const auto& alt = msg.GetBlock4().GetAlt1();
- NewLine();
- Visit(alt.GetToken1());
- const auto& choice = alt.GetRule_set_clause_choice2();
- NewLine();
-
- switch (choice.Alt_case()) {
- case TRule_set_clause_choice::kAltSetClauseChoice1: {
- const auto& clauses = choice.GetAlt_set_clause_choice1().GetRule_set_clause_list1();
- NewLine();
- PushCurrentIndent();
- Visit(clauses.GetRule_set_clause1());
- for (auto& block : clauses.GetBlock2()) {
- Visit(block.GetToken1());
- NewLine();
- Visit(block.GetRule_set_clause2());
- }
-
- PopCurrentIndent();
+ case TRule_update_stmt_TBlock4::kAlt1: {
+ const auto& alt = msg.GetBlock4().GetAlt1();
NewLine();
- break;
- }
- case TRule_set_clause_choice::kAltSetClauseChoice2: {
- const auto& multiColumn = choice.GetAlt_set_clause_choice2().GetRule_multiple_column_assignment1();
- const auto& targets = multiColumn.GetRule_set_target_list1();
- Visit(targets.GetToken1());
+ Visit(alt.GetToken1());
+ const auto& choice = alt.GetRule_set_clause_choice2();
NewLine();
- PushCurrentIndent();
- Visit(targets.GetRule_set_target2());
- for (auto& block : targets.GetBlock3()) {
- Visit(block.GetToken1());
- NewLine();
- Visit(block.GetRule_set_target2());
- }
- NewLine();
- PopCurrentIndent();
- Visit(targets.GetToken4());
- Visit(multiColumn.GetToken2());
-
- const auto& parenthesis = multiColumn.GetRule_smart_parenthesis3();
+ switch (choice.Alt_case()) {
+ case TRule_set_clause_choice::kAltSetClauseChoice1: {
+ const auto& clauses = choice.GetAlt_set_clause_choice1().GetRule_set_clause_list1();
+ NewLine();
+ PushCurrentIndent();
+ Visit(clauses.GetRule_set_clause1());
+ for (auto& block : clauses.GetBlock2()) {
+ Visit(block.GetToken1());
+ NewLine();
+ Visit(block.GetRule_set_clause2());
+ }
+
+ PopCurrentIndent();
+ NewLine();
+ break;
+ }
+ case TRule_set_clause_choice::kAltSetClauseChoice2: {
+ const auto& multiColumn = choice.GetAlt_set_clause_choice2().GetRule_multiple_column_assignment1();
+ const auto& targets = multiColumn.GetRule_set_target_list1();
+ Visit(targets.GetToken1());
+ NewLine();
+ PushCurrentIndent();
+ Visit(targets.GetRule_set_target2());
+ for (auto& block : targets.GetBlock3()) {
+ Visit(block.GetToken1());
+ NewLine();
+ Visit(block.GetRule_set_target2());
+ }
- const auto* tuple_or_expr = GetTupleOrExpr(parenthesis);
- if (!tuple_or_expr) {
- Visit(parenthesis);
- break;
- }
+ NewLine();
+ PopCurrentIndent();
+ Visit(targets.GetToken4());
+ Visit(multiColumn.GetToken2());
+
+ const auto& parenthesis = multiColumn.GetRule_smart_parenthesis3();
+
+ const auto* tuple_or_expr = GetTupleOrExpr(parenthesis);
+ if (!tuple_or_expr) {
+ Visit(parenthesis);
+ break;
+ }
+
+ const bool isHeadNamed = tuple_or_expr->HasBlock2();
+ const bool isTailNamed = AnyOf(tuple_or_expr->GetBlock3(), [](const auto& block) {
+ return block.GetRule_named_expr2().HasBlock2();
+ });
+ if (isHeadNamed || isTailNamed) {
+ Visit(parenthesis);
+ break;
+ }
+
+ Visit(parenthesis.GetToken1());
+ PushCurrentIndent();
+ NewLine();
- const bool isHeadNamed = tuple_or_expr->HasBlock2();
- const bool isTailNamed = AnyOf(tuple_or_expr->GetBlock3(), [](const auto& block) {
- return block.GetRule_named_expr2().HasBlock2();
- });
- if (isHeadNamed || isTailNamed) {
- Visit(parenthesis);
- break;
- }
+ Visit(tuple_or_expr->GetRule_expr1());
+ for (auto& block : tuple_or_expr->GetBlock3()) {
+ Visit(block.GetToken1());
+ NewLine();
+ Visit(block.GetRule_named_expr2().GetRule_expr1());
+ }
+ if (tuple_or_expr->HasBlock4()) {
+ Visit(tuple_or_expr->GetBlock4().GetToken1());
+ }
+ NewLine();
+ PopCurrentIndent();
+ Visit(parenthesis.GetToken3());
- Visit(parenthesis.GetToken1());
- PushCurrentIndent();
- NewLine();
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
+ }
- Visit(tuple_or_expr->GetRule_expr1());
- for (auto& block : tuple_or_expr->GetBlock3()) {
- Visit(block.GetToken1());
+ PopCurrentIndent();
+ if (alt.HasBlock3()) {
NewLine();
- Visit(block.GetRule_named_expr2().GetRule_expr1());
- }
- if (tuple_or_expr->HasBlock4()) {
- Visit(tuple_or_expr->GetBlock4().GetToken1());
+ Visit(alt.GetBlock3());
}
- NewLine();
PopCurrentIndent();
- Visit(parenthesis.GetToken3());
-
break;
}
- default:
- ythrow yexception() << "Alt is not supported";
- }
-
- PopCurrentIndent();
- if (alt.HasBlock3()) {
+ case TRule_update_stmt_TBlock4::kAlt2: {
+ const auto& alt = msg.GetBlock4().GetAlt2();
NewLine();
- Visit(alt.GetBlock3());
+ Visit(alt.GetToken1());
+ Visit(alt.GetRule_into_values_source2());
+ break;
}
-
- PopCurrentIndent();
- break;
- }
- case TRule_update_stmt_TBlock4::kAlt2: {
- const auto& alt = msg.GetBlock4().GetAlt2();
- NewLine();
- Visit(alt.GetToken1());
- Visit(alt.GetRule_into_values_source2());
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -1192,20 +1189,20 @@ private:
Visit(msg.GetRule_simple_table_ref4());
if (msg.HasBlock5()) {
switch (msg.GetBlock5().Alt_case()) {
- case TRule_delete_stmt_TBlock5::kAlt1: {
- const auto& alt = msg.GetBlock5().GetAlt1();
- NewLine();
- Visit(alt);
- break;
- }
- case TRule_delete_stmt_TBlock5::kAlt2: {
- const auto& alt = msg.GetBlock5().GetAlt2();
- NewLine();
- Visit(alt);
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ case TRule_delete_stmt_TBlock5::kAlt1: {
+ const auto& alt = msg.GetBlock5().GetAlt1();
+ NewLine();
+ Visit(alt);
+ break;
+ }
+ case TRule_delete_stmt_TBlock5::kAlt2: {
+ const auto& alt = msg.GetBlock5().GetAlt2();
+ NewLine();
+ Visit(alt);
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
}
@@ -1289,35 +1286,35 @@ private:
void VisitDo(const TRule_do_stmt& msg) {
VisitKeyword(msg.GetToken1());
switch (msg.GetBlock2().Alt_case()) {
- case TRule_do_stmt_TBlock2::kAlt1: { // CALL
- PushCurrentIndent();
- NewLine();
- const auto& alt = msg.GetBlock2().GetAlt1().GetRule_call_action1();
- Visit(alt.GetBlock1());
- AfterInvokeExpr_ = true;
- Visit(alt.GetToken2());
- if (alt.HasBlock3()) {
- Visit(alt.GetBlock3());
+ case TRule_do_stmt_TBlock2::kAlt1: { // CALL
+ PushCurrentIndent();
+ NewLine();
+ const auto& alt = msg.GetBlock2().GetAlt1().GetRule_call_action1();
+ Visit(alt.GetBlock1());
+ AfterInvokeExpr_ = true;
+ Visit(alt.GetToken2());
+ if (alt.HasBlock3()) {
+ Visit(alt.GetBlock3());
+ }
+ Visit(alt.GetToken4());
+ PopCurrentIndent();
+ NewLine();
+ break;
}
- Visit(alt.GetToken4());
- PopCurrentIndent();
- NewLine();
- break;
- }
- case TRule_do_stmt_TBlock2::kAlt2: { // INLINE
- const auto& alt = msg.GetBlock2().GetAlt2().GetRule_inline_action1();
- VisitKeyword(alt.GetToken1());
- PushCurrentIndent();
- NewLine();
- Visit(alt.GetRule_define_action_or_subquery_body2());
- PopCurrentIndent();
- NewLine();
- VisitKeyword(alt.GetToken3());
- VisitKeyword(alt.GetToken4());
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ case TRule_do_stmt_TBlock2::kAlt2: { // INLINE
+ const auto& alt = msg.GetBlock2().GetAlt2().GetRule_inline_action1();
+ VisitKeyword(alt.GetToken1());
+ PushCurrentIndent();
+ NewLine();
+ Visit(alt.GetRule_define_action_or_subquery_body2());
+ PopCurrentIndent();
+ NewLine();
+ VisitKeyword(alt.GetToken3());
+ VisitKeyword(alt.GetToken4());
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -1597,26 +1594,26 @@ private:
NewLine();
PushCurrentIndent();
switch (msg.GetBlock3().Alt_case()) {
- case TRule_alter_backup_collection_stmt_TBlock3::kAlt1: {
- Visit(msg.GetBlock3().GetAlt1().GetRule_alter_backup_collection_actions1().GetRule_alter_backup_collection_action1());
- for (const auto& action : msg.GetBlock3().GetAlt1().GetRule_alter_backup_collection_actions1().GetBlock2()) {
- Visit(action.GetToken1()); // comma
- NewLine();
- Visit(action.GetRule_alter_backup_collection_action2());
+ case TRule_alter_backup_collection_stmt_TBlock3::kAlt1: {
+ Visit(msg.GetBlock3().GetAlt1().GetRule_alter_backup_collection_actions1().GetRule_alter_backup_collection_action1());
+ for (const auto& action : msg.GetBlock3().GetAlt1().GetRule_alter_backup_collection_actions1().GetBlock2()) {
+ Visit(action.GetToken1()); // comma
+ NewLine();
+ Visit(action.GetRule_alter_backup_collection_action2());
+ }
+ break;
}
- break;
- }
- case TRule_alter_backup_collection_stmt_TBlock3::kAlt2: {
- Visit(msg.GetBlock3().GetAlt2().GetRule_alter_backup_collection_entries1().GetRule_alter_backup_collection_entry1());
- for (const auto& entry : msg.GetBlock3().GetAlt2().GetRule_alter_backup_collection_entries1().GetBlock2()) {
- Visit(entry.GetToken1()); // comma
- NewLine();
- Visit(entry.GetRule_alter_backup_collection_entry2());
+ case TRule_alter_backup_collection_stmt_TBlock3::kAlt2: {
+ Visit(msg.GetBlock3().GetAlt2().GetRule_alter_backup_collection_entries1().GetRule_alter_backup_collection_entry1());
+ for (const auto& entry : msg.GetBlock3().GetAlt2().GetRule_alter_backup_collection_entries1().GetBlock2()) {
+ Visit(entry.GetToken1()); // comma
+ NewLine();
+ Visit(entry.GetRule_alter_backup_collection_entry2());
+ }
+ break;
}
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ default:
+ ythrow yexception() << "Alt is not supported";
}
PopCurrentIndent();
@@ -1733,21 +1730,22 @@ private:
return;
}
- //Cerr << str << "\n";
+ // Cerr << str << "\n";
auto currentScope = Scopes_.back();
if (!SkipSpaceAfterUnaryOp_ && !InMultiTokenOp_) {
if (AfterLess_ && str == ">") {
Out(' ');
} else if (AfterDigits_ && str == ".") {
Out(' ');
- } else if (OutColumn_ && (currentScope == EScope::DoubleQuestion || str != "?")
- && str != ":" && str != "." && str != "," && str != ";" && str != ")" && str != "]"
- && str != "}" && str != "|>" && str != "::" && !AfterNamespace_ && !AfterBracket_
- && !AfterInvokeExpr_ && !AfterDollarOrAt_ && !AfterDot_ && (!AfterQuestion_ || str != "?")
- && (!InsideType_ || (str != "<" && str != ">" && str != "<>"))
- && (!InsideType_ || !AfterLess_)
- && (!AfterKeyExpr_ || str != "[")
- ) {
+ } else if (OutColumn_ &&
+ (currentScope == EScope::DoubleQuestion || str != "?") &&
+ str != ":" && str != "." && str != "," && str != ";" && str != ")" &&
+ str != "]" && str != "}" && str != "|>" && str != "::" &&
+ !AfterNamespace_ && !AfterBracket_ && !AfterInvokeExpr_ &&
+ !AfterDollarOrAt_ && !AfterDot_ && (!AfterQuestion_ || str != "?") &&
+ (!InsideType_ || (str != "<" && str != ">" && str != "<>")) &&
+ (!InsideType_ || !AfterLess_) && (!AfterKeyExpr_ || str != "["))
+ {
Out(' ');
}
}
@@ -1774,7 +1772,7 @@ private:
if (forceKeyword) {
str = to_upper(str);
} else if (currentScope == EScope::Default) {
- if (auto p = StaticData_.Keywords.find(to_upper(str)); p != StaticData_.Keywords.end()) {
+ if (auto p = StaticData_.Keywords.find(to_upper(str)); p != StaticData_.Keywords.end()) {
str = *p;
}
}
@@ -1830,8 +1828,7 @@ private:
if (str == "," && !MarkTokenStack_.empty()) {
const bool addNewline =
- (TokenIndex_ + 1 < ParsedTokens_.size() && ParsedTokens_[TokenIndex_].Line != ParsedTokens_[TokenIndex_ + 1].Line)
- || (TokenIndex_ > 0 && ParsedTokens_[TokenIndex_ - 1].Line != ParsedTokens_[TokenIndex_].Line);
+ (TokenIndex_ + 1 < ParsedTokens_.size() && ParsedTokens_[TokenIndex_].Line != ParsedTokens_[TokenIndex_ + 1].Line) || (TokenIndex_ > 0 && ParsedTokens_[TokenIndex_ - 1].Line != ParsedTokens_[TokenIndex_].Line);
// add line for trailing comma
if (addNewline) {
NewLine();
@@ -1843,35 +1840,35 @@ private:
void VisitIntoValuesSource(const TRule_into_values_source& msg) {
switch (msg.Alt_case()) {
- case TRule_into_values_source::kAltIntoValuesSource1: {
- const auto& alt = msg.GetAlt_into_values_source1();
- if (alt.HasBlock1()) {
- const auto& columns = alt.GetBlock1().GetRule_pure_column_list1();
- Visit(columns.GetToken1());
- NewLine();
- PushCurrentIndent();
- Visit(columns.GetRule_an_id2());
- for (const auto& block : columns.GetBlock3()) {
- Visit(block.GetToken1());
+ case TRule_into_values_source::kAltIntoValuesSource1: {
+ const auto& alt = msg.GetAlt_into_values_source1();
+ if (alt.HasBlock1()) {
+ const auto& columns = alt.GetBlock1().GetRule_pure_column_list1();
+ Visit(columns.GetToken1());
+ NewLine();
+ PushCurrentIndent();
+ Visit(columns.GetRule_an_id2());
+ for (const auto& block : columns.GetBlock3()) {
+ Visit(block.GetToken1());
+ NewLine();
+ Visit(block.GetRule_an_id2());
+ }
+
+ PopCurrentIndent();
+ NewLine();
+ Visit(columns.GetToken4());
NewLine();
- Visit(block.GetRule_an_id2());
}
- PopCurrentIndent();
- NewLine();
- Visit(columns.GetToken4());
- NewLine();
+ Visit(alt.GetRule_values_source2());
+ break;
}
-
- Visit(alt.GetRule_values_source2());
- break;
- }
- case TRule_into_values_source::kAltIntoValuesSource2: {
- VisitAllFields(TRule_into_values_source::GetDescriptor(), msg);
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ case TRule_into_values_source::kAltIntoValuesSource2: {
+ VisitAllFields(TRule_into_values_source::GetDescriptor(), msg);
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -2220,35 +2217,35 @@ private:
void VisitSingleSource(const TRule_single_source& msg) {
switch (msg.Alt_case()) {
- case TRule_single_source::kAltSingleSource1: {
- const auto& alt = msg.GetAlt_single_source1();
- Visit(alt);
- break;
- }
- case TRule_single_source::kAltSingleSource2: {
- const auto& alt = msg.GetAlt_single_source2();
- Visit(alt.GetToken1());
- NewLine();
- PushCurrentIndent();
- Visit(alt.GetRule_select_stmt2());
- PopCurrentIndent();
- NewLine();
- Visit(alt.GetToken3());
- break;
- }
- case TRule_single_source::kAltSingleSource3: {
- const auto& alt = msg.GetAlt_single_source3();
- Visit(alt.GetToken1());
- NewLine();
- PushCurrentIndent();
- Visit(alt.GetRule_values_stmt2());
- PopCurrentIndent();
- NewLine();
- Visit(alt.GetToken3());
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ case TRule_single_source::kAltSingleSource1: {
+ const auto& alt = msg.GetAlt_single_source1();
+ Visit(alt);
+ break;
+ }
+ case TRule_single_source::kAltSingleSource2: {
+ const auto& alt = msg.GetAlt_single_source2();
+ Visit(alt.GetToken1());
+ NewLine();
+ PushCurrentIndent();
+ Visit(alt.GetRule_select_stmt2());
+ PopCurrentIndent();
+ NewLine();
+ Visit(alt.GetToken3());
+ break;
+ }
+ case TRule_single_source::kAltSingleSource3: {
+ const auto& alt = msg.GetAlt_single_source3();
+ Visit(alt.GetToken1());
+ NewLine();
+ PushCurrentIndent();
+ Visit(alt.GetRule_values_stmt2());
+ PopCurrentIndent();
+ NewLine();
+ Visit(alt.GetToken3());
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -2377,35 +2374,35 @@ private:
void VisitFlattenByArg(const TRule_flatten_by_arg& msg) {
switch (msg.Alt_case()) {
- case TRule_flatten_by_arg::kAltFlattenByArg1: {
- const auto& alt = msg.GetAlt_flatten_by_arg1();
- Visit(alt);
- break;
- }
- case TRule_flatten_by_arg::kAltFlattenByArg2: {
- const auto& alt = msg.GetAlt_flatten_by_arg2();
- Visit(alt.GetToken1());
- NewLine();
- PushCurrentIndent();
- const auto& exprs = alt.GetRule_named_expr_list2();
- Visit(exprs.GetRule_named_expr1());
- for (const auto& block : exprs.GetBlock2()) {
- Visit(block.GetToken1());
- NewLine();
- Visit(block.GetRule_named_expr2());
+ case TRule_flatten_by_arg::kAltFlattenByArg1: {
+ const auto& alt = msg.GetAlt_flatten_by_arg1();
+ Visit(alt);
+ break;
}
+ case TRule_flatten_by_arg::kAltFlattenByArg2: {
+ const auto& alt = msg.GetAlt_flatten_by_arg2();
+ Visit(alt.GetToken1());
+ NewLine();
+ PushCurrentIndent();
+ const auto& exprs = alt.GetRule_named_expr_list2();
+ Visit(exprs.GetRule_named_expr1());
+ for (const auto& block : exprs.GetBlock2()) {
+ Visit(block.GetToken1());
+ NewLine();
+ Visit(block.GetRule_named_expr2());
+ }
- if (alt.HasBlock3()) {
- Visit(alt.GetBlock3());
- }
+ if (alt.HasBlock3()) {
+ Visit(alt.GetBlock3());
+ }
- NewLine();
- PopCurrentIndent();
- Visit(alt.GetToken4());
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ NewLine();
+ PopCurrentIndent();
+ Visit(alt.GetToken4());
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -2438,42 +2435,42 @@ private:
const auto& block3 = msg.GetBlock3();
switch (block3.Alt_case()) {
- case TRule_table_ref::TBlock3::kAlt1: {
- const auto& alt = block3.GetAlt1();
- const auto& key = alt.GetRule_table_key1();
- Visit(key.GetRule_id_table_or_type1());
- Visit(key.GetBlock2());
+ case TRule_table_ref::TBlock3::kAlt1: {
+ const auto& alt = block3.GetAlt1();
+ const auto& key = alt.GetRule_table_key1();
+ Visit(key.GetRule_id_table_or_type1());
+ Visit(key.GetBlock2());
- break;
- }
- case TRule_table_ref::TBlock3::kAlt2: {
- const auto& alt = block3.GetAlt2();
- Visit(alt.GetRule_an_id_expr1());
- AfterInvokeExpr_ = true;
- Visit(alt.GetToken2());
- if (alt.HasBlock3()) {
- Visit(alt.GetBlock3());
+ break;
}
-
- Visit(alt.GetToken4());
- break;
- }
- case TRule_table_ref::TBlock3::kAlt3: {
- const auto& alt = block3.GetAlt3();
- Visit(alt.GetRule_bind_parameter1());
- if (alt.HasBlock2()) {
+ case TRule_table_ref::TBlock3::kAlt2: {
+ const auto& alt = block3.GetAlt2();
+ Visit(alt.GetRule_an_id_expr1());
AfterInvokeExpr_ = true;
- Visit(alt.GetBlock2());
- }
+ Visit(alt.GetToken2());
+ if (alt.HasBlock3()) {
+ Visit(alt.GetBlock3());
+ }
- if (alt.HasBlock3()) {
- Visit(alt.GetBlock3());
+ Visit(alt.GetToken4());
+ break;
}
+ case TRule_table_ref::TBlock3::kAlt3: {
+ const auto& alt = block3.GetAlt3();
+ Visit(alt.GetRule_bind_parameter1());
+ if (alt.HasBlock2()) {
+ AfterInvokeExpr_ = true;
+ Visit(alt.GetBlock2());
+ }
- break;
- }
- default:
- ythrow yexception() << "Alt is not supported";
+ if (alt.HasBlock3()) {
+ Visit(alt.GetBlock3());
+ }
+
+ break;
+ }
+ default:
+ ythrow yexception() << "Alt is not supported";
}
if (msg.HasBlock4()) {
@@ -2835,43 +2832,43 @@ private:
if (msg.HasBlock3()) {
const auto& b = msg.GetBlock3();
switch (b.Alt_case()) {
- case TRule_neq_subexpr_TBlock3::kAlt1: {
- const auto& alt = b.GetAlt1();
- const bool hasFirstNewline = LastLine_ != ParsedTokens_[TokenIndex_].Line;
- // 2 is `??` size in tokens
- const bool hasSecondNewline = ParsedTokens_[TokenIndex_].Line != ParsedTokens_[TokenIndex_ + 2].Line;
- const ui32 currentOutLine = OutLine_;
-
- if (currentOutLine != OutLine_ || (hasFirstNewline && hasSecondNewline)) {
- NewLine();
- if (!pushedIndent) {
- PushCurrentIndent();
- pushedIndent = true;
+ case TRule_neq_subexpr_TBlock3::kAlt1: {
+ const auto& alt = b.GetAlt1();
+ const bool hasFirstNewline = LastLine_ != ParsedTokens_[TokenIndex_].Line;
+ // 2 is `??` size in tokens
+ const bool hasSecondNewline = ParsedTokens_[TokenIndex_].Line != ParsedTokens_[TokenIndex_ + 2].Line;
+ const ui32 currentOutLine = OutLine_;
+
+ if (currentOutLine != OutLine_ || (hasFirstNewline && hasSecondNewline)) {
+ NewLine();
+ if (!pushedIndent) {
+ PushCurrentIndent();
+ pushedIndent = true;
+ }
}
- }
- Visit(alt.GetRule_double_question1());
- if (hasFirstNewline || hasSecondNewline) {
- NewLine();
- if (!pushedIndent) {
- PushCurrentIndent();
- pushedIndent = true;
+ Visit(alt.GetRule_double_question1());
+ if (hasFirstNewline || hasSecondNewline) {
+ NewLine();
+ if (!pushedIndent) {
+ PushCurrentIndent();
+ pushedIndent = true;
+ }
}
- }
- VisitNeqSubexprImpl(alt.GetRule_neq_subexpr2(), pushedIndent, false);
- if (pushedIndent && top) {
- PopCurrentIndent();
- pushedIndent = false;
- }
+ VisitNeqSubexprImpl(alt.GetRule_neq_subexpr2(), pushedIndent, false);
+ if (pushedIndent && top) {
+ PopCurrentIndent();
+ pushedIndent = false;
+ }
- break;
- }
- case TRule_neq_subexpr_TBlock3::kAlt2:
- Visit(b.GetAlt2());
- break;
- default:
- ythrow yexception() << "Alt is not supported";
+ break;
+ }
+ case TRule_neq_subexpr_TBlock3::kAlt2:
+ Visit(b.GetAlt2());
+ break;
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
}
@@ -2900,18 +2897,18 @@ private:
ui32 BinaryOpTokenSize(const TRule_neq_subexpr::TBlock2::TBlock1& block) {
switch (block.Alt_case()) {
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt1:
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt3:
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt5:
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt6:
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt7:
- return 1;
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt2:
- return 2;
- case TRule_neq_subexpr::TBlock2::TBlock1::kAlt4:
- return 3;
- default:
- ythrow yexception() << "Alt is not supported";
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt1:
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt3:
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt5:
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt6:
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt7:
+ return 1;
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt2:
+ return 2;
+ case TRule_neq_subexpr::TBlock2::TBlock1::kAlt4:
+ return 3;
+ default:
+ ythrow yexception() << "Alt is not supported";
}
}
@@ -3036,161 +3033,161 @@ TObfuscatingFunctor MakeObfuscatingFunctor(void (TObfuscatingVisitor::*memberPtr
TStaticData::TStaticData()
: Keywords(GetKeywords())
, ScopeDispatch({
- {TRule_type_name::GetDescriptor(), EScope::TypeName},
- {TRule_type_name_composite::GetDescriptor(), EScope::TypeName},
- {TRule_double_question::GetDescriptor(), EScope::DoubleQuestion},
- {TRule_id::GetDescriptor(), EScope::Identifier},
- {TRule_id_or_type::GetDescriptor(), EScope::Identifier},
- {TRule_id_schema::GetDescriptor(), EScope::Identifier},
- {TRule_id_expr::GetDescriptor(), EScope::Identifier},
- {TRule_id_expr_in::GetDescriptor(), EScope::Identifier},
- {TRule_id_window::GetDescriptor(), EScope::Identifier},
- {TRule_id_table::GetDescriptor(), EScope::Identifier},
- {TRule_id_without::GetDescriptor(), EScope::Identifier},
- {TRule_id_hint::GetDescriptor(), EScope::Identifier},
- {TRule_identifier::GetDescriptor(), EScope::Identifier},
- {TRule_id_table_or_type::GetDescriptor(), EScope::Identifier},
- {TRule_bind_parameter::GetDescriptor(), EScope::Identifier},
- {TRule_an_id_as_compat::GetDescriptor(), EScope::Identifier},
- })
+ {TRule_type_name::GetDescriptor(), EScope::TypeName},
+ {TRule_type_name_composite::GetDescriptor(), EScope::TypeName},
+ {TRule_double_question::GetDescriptor(), EScope::DoubleQuestion},
+ {TRule_id::GetDescriptor(), EScope::Identifier},
+ {TRule_id_or_type::GetDescriptor(), EScope::Identifier},
+ {TRule_id_schema::GetDescriptor(), EScope::Identifier},
+ {TRule_id_expr::GetDescriptor(), EScope::Identifier},
+ {TRule_id_expr_in::GetDescriptor(), EScope::Identifier},
+ {TRule_id_window::GetDescriptor(), EScope::Identifier},
+ {TRule_id_table::GetDescriptor(), EScope::Identifier},
+ {TRule_id_without::GetDescriptor(), EScope::Identifier},
+ {TRule_id_hint::GetDescriptor(), EScope::Identifier},
+ {TRule_identifier::GetDescriptor(), EScope::Identifier},
+ {TRule_id_table_or_type::GetDescriptor(), EScope::Identifier},
+ {TRule_bind_parameter::GetDescriptor(), EScope::Identifier},
+ {TRule_an_id_as_compat::GetDescriptor(), EScope::Identifier},
+ })
, PrettyVisitDispatch({
- {TToken::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitToken)},
- {TRule_value_constructor::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitValueConstructor)},
- {TRule_into_values_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoValuesSource)},
- {TRule_select_kind::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKind)},
- {TRule_process_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitProcessCore)},
- {TRule_reduce_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitReduceCore)},
- {TRule_sort_specification_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSortSpecificationList)},
- {TRule_select_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectCore)},
- {TRule_row_pattern_recognition_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRowPatternRecognitionClause)},
- {TRule_join_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitJoinSource)},
- {TRule_join_constraint::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitJoinConstraint)},
- {TRule_single_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSingleSource)},
- {TRule_flatten_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFlattenSource)},
- {TRule_named_single_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNamedSingleSource)},
- {TRule_table_hints::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableHints)},
- {TRule_simple_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSimpleTableRef)},
- {TRule_into_simple_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoSimpleTableRef)},
- {TRule_select_kind_partial::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKindPartial)},
- {TRule_flatten_by_arg::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFlattenByArg)},
- {TRule_without_column_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWithoutColumnList)},
- {TRule_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableRef)},
- {TRule_grouping_element_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGroupingElementList)},
- {TRule_group_by_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGroupByClause)},
- {TRule_window_definition_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowDefinitionList)},
- {TRule_window_specification::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowSpecification)},
- {TRule_window_partition_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowParitionClause)},
- {TRule_lambda_body::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitLambdaBody)},
- {TRule_select_kind_parenthesis::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKindParenthesis)},
- {TRule_cast_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCastExpr)},
- {TRule_bitcast_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBitCastExpr)},
- {TRule_ext_order_by_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExtOrderByClause)},
- {TRule_key_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitKeyExpr)},
- {TRule_define_action_or_subquery_body::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDefineActionOrSubqueryBody)},
- {TRule_exists_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExistsExpr)},
- {TRule_case_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCaseExpr)},
- {TRule_with_table_settings::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWithTableSettingsExpr)},
- {TRule_table_setting_value::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableSettingValue)},
- {TRule_ttl_tier_action::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTtlTierAction)},
-
- {TRule_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExpr)},
- {TRule_cond_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCondExpr)},
- {TRule_or_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitOrSubexpr)},
- {TRule_and_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAndSubexpr)},
- {TRule_eq_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitEqSubexpr)},
- {TRule_neq_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNeqSubexpr)},
- {TRule_bit_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBitSubexpr)},
- {TRule_add_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAddSubexpr)},
- {TRule_mul_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitMulSubexpr)},
-
- {TRule_rot_right::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRotRight)},
- {TRule_shift_right::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitShiftRight)},
-
- {TRule_pragma_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitPragma)},
- {TRule_select_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelect)},
- {TRule_select_stmt_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectIntersect)},
- {TRule_smart_parenthesis::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSmartParenthesis)},
- {TRule_select_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectSubExpr)},
- {TRule_select_subexpr_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectSubExprIntersect)},
- {TRule_select_unparenthesized_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectUnparenthesized)},
- {TRule_select_unparenthesized_stmt_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectUnparenthesizedIntersect)},
- {TRule_named_nodes_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNamedNodes)},
- {TRule_create_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTable)},
- {TRule_drop_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTable)},
- {TRule_use_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUse)},
- {TRule_into_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoTable)},
- {TRule_commit_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCommit)},
- {TRule_update_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUpdate)},
- {TRule_delete_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDelete)},
- {TRule_rollback_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRollback)},
- {TRule_declare_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDeclare)},
- {TRule_import_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitImport)},
- {TRule_export_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExport)},
- {TRule_alter_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTable)},
- {TRule_alter_external_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterExternalTable)},
- {TRule_do_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDo)},
- {TRule_define_action_or_subquery_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAction)},
- {TRule_if_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIf)},
- {TRule_for_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFor)},
- {TRule_values_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitValues)},
- {TRule_create_user_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateUser)},
- {TRule_alter_user_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterUser)},
- {TRule_create_group_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateGroup)},
- {TRule_alter_group_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterGroup)},
- {TRule_drop_role_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropRole)},
- {TRule_upsert_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUpsertObject)},
- {TRule_create_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateObject)},
- {TRule_alter_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterObject)},
- {TRule_drop_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropObject)},
- {TRule_create_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateExternalDataSource)},
- {TRule_alter_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterExternalDataSource)},
- {TRule_drop_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropExternalDataSource)},
- {TRule_create_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateAsyncReplication)},
- {TRule_alter_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterAsyncReplication)},
- {TRule_drop_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropAsyncReplication)},
- {TRule_create_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTransfer)},
- {TRule_alter_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTransfer)},
- {TRule_drop_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTransfer)},
- {TRule_create_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTopic)},
- {TRule_alter_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTopic)},
- {TRule_drop_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTopic)},
- {TRule_grant_permissions_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGrantPermissions)},
- {TRule_revoke_permissions_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRevokePermissions)},
- {TRule_alter_table_store_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTableStore)},
- {TRule_create_view_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateView)},
- {TRule_drop_view_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropView)},
- {TRule_create_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateResourcePool)},
- {TRule_alter_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterResourcePool)},
- {TRule_drop_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropResourcePool)},
- {TRule_create_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateBackupCollection)},
- {TRule_alter_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterBackupCollection)},
- {TRule_drop_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropBackupCollection)},
- {TRule_analyze_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAnalyze)},
- {TRule_create_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateResourcePoolClassifier)},
- {TRule_alter_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterResourcePoolClassifier)},
- {TRule_drop_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropResourcePoolClassifier)},
- {TRule_backup_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBackup)},
- {TRule_restore_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRestore)},
- {TRule_alter_sequence_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterSequence)},
- {TRule_alter_database_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterDatabase)},
- {TRule_show_create_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitShowCreateTable)},
- {TRule_streaming_query_settings::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitStreamingQuerySettings)},
- {TRule_create_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateStreamingQuery)},
- {TRule_alter_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterStreamingQuery)},
- {TRule_drop_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropStreamingQuery)},
- {TRule_create_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateSecret)},
- {TRule_alter_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterSecret)},
- {TRule_drop_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropSecret)},
- })
+ {TToken::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitToken)},
+ {TRule_value_constructor::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitValueConstructor)},
+ {TRule_into_values_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoValuesSource)},
+ {TRule_select_kind::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKind)},
+ {TRule_process_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitProcessCore)},
+ {TRule_reduce_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitReduceCore)},
+ {TRule_sort_specification_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSortSpecificationList)},
+ {TRule_select_core::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectCore)},
+ {TRule_row_pattern_recognition_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRowPatternRecognitionClause)},
+ {TRule_join_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitJoinSource)},
+ {TRule_join_constraint::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitJoinConstraint)},
+ {TRule_single_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSingleSource)},
+ {TRule_flatten_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFlattenSource)},
+ {TRule_named_single_source::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNamedSingleSource)},
+ {TRule_table_hints::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableHints)},
+ {TRule_simple_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSimpleTableRef)},
+ {TRule_into_simple_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoSimpleTableRef)},
+ {TRule_select_kind_partial::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKindPartial)},
+ {TRule_flatten_by_arg::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFlattenByArg)},
+ {TRule_without_column_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWithoutColumnList)},
+ {TRule_table_ref::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableRef)},
+ {TRule_grouping_element_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGroupingElementList)},
+ {TRule_group_by_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGroupByClause)},
+ {TRule_window_definition_list::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowDefinitionList)},
+ {TRule_window_specification::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowSpecification)},
+ {TRule_window_partition_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWindowParitionClause)},
+ {TRule_lambda_body::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitLambdaBody)},
+ {TRule_select_kind_parenthesis::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectKindParenthesis)},
+ {TRule_cast_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCastExpr)},
+ {TRule_bitcast_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBitCastExpr)},
+ {TRule_ext_order_by_clause::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExtOrderByClause)},
+ {TRule_key_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitKeyExpr)},
+ {TRule_define_action_or_subquery_body::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDefineActionOrSubqueryBody)},
+ {TRule_exists_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExistsExpr)},
+ {TRule_case_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCaseExpr)},
+ {TRule_with_table_settings::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitWithTableSettingsExpr)},
+ {TRule_table_setting_value::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTableSettingValue)},
+ {TRule_ttl_tier_action::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitTtlTierAction)},
+
+ {TRule_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExpr)},
+ {TRule_cond_expr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCondExpr)},
+ {TRule_or_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitOrSubexpr)},
+ {TRule_and_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAndSubexpr)},
+ {TRule_eq_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitEqSubexpr)},
+ {TRule_neq_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNeqSubexpr)},
+ {TRule_bit_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBitSubexpr)},
+ {TRule_add_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAddSubexpr)},
+ {TRule_mul_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitMulSubexpr)},
+
+ {TRule_rot_right::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRotRight)},
+ {TRule_shift_right::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitShiftRight)},
+
+ {TRule_pragma_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitPragma)},
+ {TRule_select_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelect)},
+ {TRule_select_stmt_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectIntersect)},
+ {TRule_smart_parenthesis::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSmartParenthesis)},
+ {TRule_select_subexpr::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectSubExpr)},
+ {TRule_select_subexpr_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectSubExprIntersect)},
+ {TRule_select_unparenthesized_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectUnparenthesized)},
+ {TRule_select_unparenthesized_stmt_intersect::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitSelectUnparenthesizedIntersect)},
+ {TRule_named_nodes_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitNamedNodes)},
+ {TRule_create_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTable)},
+ {TRule_drop_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTable)},
+ {TRule_use_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUse)},
+ {TRule_into_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIntoTable)},
+ {TRule_commit_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCommit)},
+ {TRule_update_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUpdate)},
+ {TRule_delete_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDelete)},
+ {TRule_rollback_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRollback)},
+ {TRule_declare_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDeclare)},
+ {TRule_import_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitImport)},
+ {TRule_export_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitExport)},
+ {TRule_alter_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTable)},
+ {TRule_alter_external_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterExternalTable)},
+ {TRule_do_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDo)},
+ {TRule_define_action_or_subquery_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAction)},
+ {TRule_if_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitIf)},
+ {TRule_for_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitFor)},
+ {TRule_values_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitValues)},
+ {TRule_create_user_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateUser)},
+ {TRule_alter_user_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterUser)},
+ {TRule_create_group_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateGroup)},
+ {TRule_alter_group_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterGroup)},
+ {TRule_drop_role_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropRole)},
+ {TRule_upsert_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitUpsertObject)},
+ {TRule_create_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateObject)},
+ {TRule_alter_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterObject)},
+ {TRule_drop_object_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropObject)},
+ {TRule_create_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateExternalDataSource)},
+ {TRule_alter_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterExternalDataSource)},
+ {TRule_drop_external_data_source_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropExternalDataSource)},
+ {TRule_create_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateAsyncReplication)},
+ {TRule_alter_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterAsyncReplication)},
+ {TRule_drop_replication_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropAsyncReplication)},
+ {TRule_create_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTransfer)},
+ {TRule_alter_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTransfer)},
+ {TRule_drop_transfer_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTransfer)},
+ {TRule_create_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateTopic)},
+ {TRule_alter_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTopic)},
+ {TRule_drop_topic_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropTopic)},
+ {TRule_grant_permissions_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitGrantPermissions)},
+ {TRule_revoke_permissions_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRevokePermissions)},
+ {TRule_alter_table_store_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterTableStore)},
+ {TRule_create_view_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateView)},
+ {TRule_drop_view_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropView)},
+ {TRule_create_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateResourcePool)},
+ {TRule_alter_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterResourcePool)},
+ {TRule_drop_resource_pool_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropResourcePool)},
+ {TRule_create_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateBackupCollection)},
+ {TRule_alter_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterBackupCollection)},
+ {TRule_drop_backup_collection_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropBackupCollection)},
+ {TRule_analyze_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAnalyze)},
+ {TRule_create_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateResourcePoolClassifier)},
+ {TRule_alter_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterResourcePoolClassifier)},
+ {TRule_drop_resource_pool_classifier_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropResourcePoolClassifier)},
+ {TRule_backup_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitBackup)},
+ {TRule_restore_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitRestore)},
+ {TRule_alter_sequence_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterSequence)},
+ {TRule_alter_database_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterDatabase)},
+ {TRule_show_create_table_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitShowCreateTable)},
+ {TRule_streaming_query_settings::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitStreamingQuerySettings)},
+ {TRule_create_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateStreamingQuery)},
+ {TRule_alter_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterStreamingQuery)},
+ {TRule_drop_streaming_query_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropStreamingQuery)},
+ {TRule_create_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitCreateSecret)},
+ {TRule_alter_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitAlterSecret)},
+ {TRule_drop_secret_stmt::GetDescriptor(), MakePrettyFunctor(&TPrettyVisitor::VisitDropSecret)},
+ })
, ObfuscatingVisitDispatch({
- {TToken::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitToken)},
- {TRule_literal_value::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitLiteralValue)},
- {TRule_pragma_value::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitPragmaValue)},
- {TRule_atom_expr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitAtomExpr)},
- {TRule_in_atom_expr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitInAtomExpr)},
- {TRule_unary_casual_subexpr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitUnaryCasualSubexpr)},
- {TRule_in_unary_casual_subexpr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitInUnaryCasualSubexpr)},
- })
+ {TToken::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitToken)},
+ {TRule_literal_value::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitLiteralValue)},
+ {TRule_pragma_value::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitPragmaValue)},
+ {TRule_atom_expr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitAtomExpr)},
+ {TRule_in_atom_expr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitInAtomExpr)},
+ {TRule_unary_casual_subexpr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitUnaryCasualSubexpr)},
+ {TRule_in_unary_casual_subexpr::GetDescriptor(), MakeObfuscatingFunctor(&TObfuscatingVisitor::VisitInUnaryCasualSubexpr)},
+ })
{
// ensure that all statements have a visitor
auto coreDescr = TRule_sql_stmt_core::GetDescriptor();
@@ -3213,15 +3210,16 @@ TStaticData::TStaticData()
}
}
-class TSqlFormatter : public NSQLFormat::ISqlFormatter {
+class TSqlFormatter: public NSQLFormat::ISqlFormatter {
public:
TSqlFormatter(const NSQLTranslationV1::TLexers& lexers,
- const NSQLTranslationV1::TParsers& parsers,
- const NSQLTranslation::TTranslationSettings& settings)
+ const NSQLTranslationV1::TParsers& parsers,
+ const NSQLTranslation::TTranslationSettings& settings)
: Lexers_(lexers)
, Parsers_(parsers)
, Settings_(settings)
- {}
+ {
+ }
bool Format(const TString& query, TString& formattedQuery, NYql::TIssues& issues, EFormatMode mode) override {
formattedQuery = (mode == EFormatMode::Obfuscate) ? "" : query;
@@ -3323,16 +3321,16 @@ private:
const NSQLTranslation::TTranslationSettings Settings_;
};
-}
+} // namespace
ISqlFormatter::TPtr MakeSqlFormatter(const NSQLTranslationV1::TLexers& lexers,
- const NSQLTranslationV1::TParsers& parsers,
- const NSQLTranslation::TTranslationSettings& settings) {
+ const NSQLTranslationV1::TParsers& parsers,
+ const NSQLTranslation::TTranslationSettings& settings) {
return ISqlFormatter::TPtr(new TSqlFormatter(lexers, parsers, settings));
}
TString MutateQuery(const NSQLTranslationV1::TLexers& lexers,
- const TString& query, const NSQLTranslation::TTranslationSettings& settings) {
+ const TString& query, const NSQLTranslation::TTranslationSettings& settings) {
auto parsedSettings = settings;
NYql::TIssues issues;
if (!NSQLTranslation::ParseTranslationSettings(query, parsedSettings, issues)) {
@@ -3363,8 +3361,8 @@ TString MutateQuery(const NSQLTranslationV1::TLexers& lexers,
}
bool SqlFormatSimple(const NSQLTranslationV1::TLexers& lexers,
- const NSQLTranslationV1::TParsers& parsers,
- const TString& query, TString& formattedQuery, TString& error) {
+ const NSQLTranslationV1::TParsers& parsers,
+ const TString& query, TString& formattedQuery, TString& error) {
try {
google::protobuf::Arena arena;
NSQLTranslation::TTranslationSettings settings;
@@ -3407,7 +3405,7 @@ THashSet<TString> GetKeywords() {
SubstGlobal(after, " ", "");
SubstGlobal(after, "'", "");
if (after == before) {
- //Cerr << before << "\n";
+ // Cerr << before << "\n";
res.insert(before);
}
}