diff options
author | zverevgeny <zverevgeny@ydb.tech> | 2023-07-24 10:38:08 +0300 |
---|---|---|
committer | zverevgeny <zverevgeny@ydb.tech> | 2023-07-24 10:38:08 +0300 |
commit | 35ca72d4bc15798a02808fb53ea7f1f2a63a0c6a (patch) | |
tree | 87cedb16a38d67137c1492b5fa09faa081ceee09 | |
parent | ea2f03558d057a7baeb20c82ca1cd460c3f2579e (diff) | |
download | ydb-35ca72d4bc15798a02808fb53ea7f1f2a63a0c6a.tar.gz |
YQL-16186 detect unhandled gramma alternatives at compile time
-rw-r--r-- | ydb/library/yql/sql/v1/sql_call_expr.cpp | 10 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_expression.cpp | 44 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_group_by.cpp | 2 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_into_tables.cpp | 4 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_query.cpp | 22 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_select.cpp | 31 | ||||
-rw-r--r-- | ydb/library/yql/sql/v1/sql_translation.cpp | 106 |
7 files changed, 113 insertions, 106 deletions
diff --git a/ydb/library/yql/sql/v1/sql_call_expr.cpp b/ydb/library/yql/sql/v1/sql_call_expr.cpp index a89aa62dcf0..0d2da4a34fb 100644 --- a/ydb/library/yql/sql/v1/sql_call_expr.cpp +++ b/ydb/library/yql/sql/v1/sql_call_expr.cpp @@ -148,7 +148,7 @@ bool TSqlCallExpr::Init(const TRule_value_constructor& node) { } break; } - default: + case TRule_value_constructor::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } PositionalArgs = Args; @@ -227,7 +227,7 @@ bool TSqlCallExpr::Init(const TRule_using_call_expr& node) { IsExternalCall = true; break; } - default: + case TRule_using_call_expr::TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } YQL_ENSURE(!DistinctAllowed); @@ -343,7 +343,7 @@ bool TSqlCallExpr::Init(const TRule_invoke_expr& node) { Args.push_back(new TAsteriskNode(Pos)); } break; - default: + case TRule_invoke_expr::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -372,7 +372,7 @@ bool TSqlCallExpr::Init(const TRule_invoke_expr& node) { Ctx.Error() << "FILTER clause is not supported yet"; return false; } - default: + case TRule_invoke_expr_tail::TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -408,7 +408,7 @@ bool TSqlCallExpr::Init(const TRule_invoke_expr& node) { specs[WindowName] = spec; break; } - default: + case TRule_window_name_or_specification::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } Ctx.IncrementMonCounter("sql_features", "WindowFunctionOver"); diff --git a/ydb/library/yql/sql/v1/sql_expression.cpp b/ydb/library/yql/sql/v1/sql_expression.cpp index f2b89b18eea..d8800ab4854 100644 --- a/ydb/library/yql/sql/v1/sql_expression.cpp +++ b/ydb/library/yql/sql/v1/sql_expression.cpp @@ -27,7 +27,7 @@ TNodePtr TSqlExpression::Build(const TRule_expr& node) { case TRule_expr::kAltExpr2: { return TypeNode(node.GetAlt_expr2().GetRule_type_name_composite1()); } - default: + case TRule_expr::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -392,7 +392,11 @@ TMaybe<TExprOrIdent> TSqlExpression::LiteralExpr(const TRule_literal_value& node result.Expr = BuildEmptyAction(Ctx.Pos()); break; } - default: + case TRule_literal_value::kAltLiteralValue4: + case TRule_literal_value::kAltLiteralValue6: + case TRule_literal_value::kAltLiteralValue7: + case TRule_literal_value::kAltLiteralValue8: + case TRule_literal_value::ALT_NOT_SET: AltNotImplemented("literal_value", node); } if (!result.Expr) { @@ -488,7 +492,7 @@ void TSqlExpression::AddJsonVariable(const TRule_json_variable& node, TVector<TN nameFlags = parsed->Flags; break; } - default: + case TRule_json_variable_name::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -552,7 +556,7 @@ TNodePtr TSqlExpression::JsonValueCaseHandler(const TRule_json_case_handler& nod case TRule_json_case_handler::kAltJsonCaseHandler3: mode = EJsonValueHandlerMode::DefaultValue; return Build(node.GetAlt_json_case_handler3().GetBlock1().GetRule_expr2()); - default: + case TRule_json_case_handler::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -734,7 +738,7 @@ EJsonQueryHandler TSqlExpression::JsonQueryHandler(const TRule_json_query_handle return EJsonQueryHandler::EmptyArray; case TRule_json_query_handler::kAltJsonQueryHandler4: return EJsonQueryHandler::EmptyObject; - default: + case TRule_json_query_handler::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -804,7 +808,7 @@ TNodePtr TSqlExpression::JsonApiExpr(const TRule_json_api_expr& node) { result = JsonQueryExpr(jsonQuery); break; } - default: + case TRule_json_api_expr::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -860,7 +864,7 @@ TNodePtr TSqlExpression::UnaryCasualExpr(const TUnaryCasualExprRule& node, const } break; } - default: + case TUnaryCasualExprRule::TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -888,7 +892,7 @@ TNodePtr TSqlExpression::UnaryCasualExpr(const TUnaryCasualExprRule& node, const // dot break; } - default: + case TRule_unary_subexpr_suffix::TBlock1::ALT_NOT_SET: AltNotImplemented("unary_subexpr_suffix", b); return nullptr; } @@ -1013,7 +1017,7 @@ TNodePtr TSqlExpression::UnaryCasualExpr(const TUnaryCasualExprRule& node, const ids.push_back(Id(bb.GetAlt3().GetRule_an_id_or_type1(), *this)); break; } - default: + case TRule_unary_subexpr_suffix_TBlock1_TAlt3_TBlock1_TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -1024,7 +1028,7 @@ TNodePtr TSqlExpression::UnaryCasualExpr(const TUnaryCasualExprRule& node, const break; } - default: + case TRule_unary_subexpr_suffix::TBlock1::ALT_NOT_SET: AltNotImplemented("unary_subexpr_suffix", b); return nullptr; } @@ -1180,7 +1184,7 @@ TNodePtr TSqlExpression::ExistsRule(const TRule_exists_expr& rule) { source = values.Build(alt, pos); break; } - default: + case TRule_exists_expr::TBlock3::ALT_NOT_SET: AltNotImplemented("exists_expr", rule.GetBlock3()); } @@ -1301,7 +1305,7 @@ TMaybe<TExprOrIdent> TSqlExpression::AtomExpr(const TRule_atom_expr& node, const } break; } - default: + case TRule_atom_expr::TAlt7::TBlock3::ALT_NOT_SET: Y_FAIL("Unsigned number: you should change implementation according to grammar changes"); } result.Expr = BuildCallable(pos, module, name, {}); @@ -1323,7 +1327,7 @@ TMaybe<TExprOrIdent> TSqlExpression::AtomExpr(const TRule_atom_expr& node, const case TRule_atom_expr::kAltAtomExpr12: result.Expr = StructLiteral(node.GetAlt_atom_expr12().GetRule_struct_literal1()); break; - default: + case TRule_atom_expr::ALT_NOT_SET: AltNotImplemented("atom_expr", node); } if (!result.Expr) { @@ -1387,7 +1391,7 @@ TMaybe<TExprOrIdent> TSqlExpression::InAtomExpr(const TRule_in_atom_expr& node, } break; } - default: + case TRule_in_atom_expr::TAlt6::TBlock3::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } result.Expr = BuildCallable(pos, module, name, {}); @@ -1429,7 +1433,7 @@ TMaybe<TExprOrIdent> TSqlExpression::InAtomExpr(const TRule_in_atom_expr& node, case TRule_in_atom_expr::kAltInAtomExpr12: result.Expr = StructLiteral(node.GetAlt_in_atom_expr12().GetRule_struct_literal1()); break; - default: + case TRule_in_atom_expr::ALT_NOT_SET: AltNotImplemented("in_atom_expr", node); } if (!result.Expr) { @@ -1524,7 +1528,7 @@ bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& n } break; } - default: + case TRule_lambda_stmt::ALT_NOT_SET: Y_FAIL("SampleClause: does not correspond to grammar changes"); } } @@ -1571,7 +1575,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_con_subexpr& node, const TTrailingQ auto expr = UnaryExpr(node.GetAlt_con_subexpr2().GetRule_unary_subexpr2(), tail); return expr ? expr->ApplyUnaryOp(Ctx, pos, opName) : expr; } - default: + case TRule_con_subexpr::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return nullptr; @@ -1857,7 +1861,7 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ auto getNode = [](const TRule_cond_expr::TAlt5::TBlock1& b) -> const TRule_eq_subexpr& { return b.GetRule_eq_subexpr2(); }; return BinOpList(node.GetRule_eq_subexpr1(), getNode, alt.GetBlock1().begin(), alt.GetBlock1().end(), tail); } - default: + case TRule_cond_expr::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownConditionExpr"); AltNotImplemented("cond_expr", cond); return nullptr; @@ -2059,7 +2063,7 @@ TNodePtr TSqlExpression::BinOpList(const TRule_bit_subexpr& node, TGetNode getNo Ctx.IncrementMonCounter("sql_binary_operations", "BitXor"); break; } - default: + case TRule_neq_subexpr_TBlock2_TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2128,7 +2132,7 @@ TNodePtr TSqlExpression::BinOpList(const TRule_eq_subexpr& node, TGetNode getNod Ctx.IncrementMonCounter("sql_binary_operations", opName); break; } - default: + case TRule_cond_expr::TAlt5::TBlock1::TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } diff --git a/ydb/library/yql/sql/v1/sql_group_by.cpp b/ydb/library/yql/sql/v1/sql_group_by.cpp index d1dd439045f..eed36c47686 100644 --- a/ydb/library/yql/sql/v1/sql_group_by.cpp +++ b/ydb/library/yql/sql/v1/sql_group_by.cpp @@ -270,7 +270,7 @@ bool TGroupByClause::GroupingElement(const TRule_grouping_element& node, EGroupB } break; } - default: + case TRule_grouping_element::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return true; diff --git a/ydb/library/yql/sql/v1/sql_into_tables.cpp b/ydb/library/yql/sql/v1/sql_into_tables.cpp index 478fe3f3689..1100576fa43 100644 --- a/ydb/library/yql/sql/v1/sql_into_tables.cpp +++ b/ydb/library/yql/sql/v1/sql_into_tables.cpp @@ -56,7 +56,7 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) { case TRule_into_table_stmt_TBlock1::AltCase::kAlt6: modeTokens = {modeBlock.GetAlt6().GetToken1()}; break; - default: + case TRule_into_table_stmt_TBlock1::AltCase::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -134,7 +134,7 @@ TNodePtr TSqlIntoTable::Build(const TRule_into_table_stmt& node) { nameOrAt = std::make_pair(at, table); break; } - default: + case TRule_simple_table_ref_core::AltCase::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } diff --git a/ydb/library/yql/sql/v1/sql_query.cpp b/ydb/library/yql/sql/v1/sql_query.cpp index 9ed305223e4..40cd4a5abae 100644 --- a/ydb/library/yql/sql/v1/sql_query.cpp +++ b/ydb/library/yql/sql/v1/sql_query.cpp @@ -457,7 +457,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core& stmt = BuildRenameUser(pos, service, cluster, roleName, tgtRoleName,Ctx.Scoped); break; } - default: + case TRule_alter_user_stmt_TBlock4::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -542,7 +542,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core& stmt = BuildRenameGroup(pos, service, cluster, roleName, tgtRoleName, Ctx.Scoped); break; } - default: + case TRule_alter_group_stmt_TBlock4::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -932,7 +932,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core& AddStatementToBlocks(blocks, BuildUpsertObjectOperation(Ctx.Pos(), objectId, typeId, std::move(kv), context)); break; } - default: + case TRule_sql_stmt_core::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownStatement" + internalStatementName); AltNotImplemented("sql_stmt_core", core); return false; @@ -1141,7 +1141,7 @@ bool TSqlQuery::AlterTableAction(const TRule_alter_table_action& node, TAlterTab break; } - default: + case TRule_alter_table_action::ALT_NOT_SET: AltNotImplemented("alter_table_action", node); return false; } @@ -1318,7 +1318,7 @@ bool TSqlQuery::AlterTableAlterChangefeed(const TRule_alter_table_alter_changefe break; } - default: + case TRule_changefeed_alter_settings::ALT_NOT_SET: AltNotImplemented("changefeed_alter_settings", alter); return false; } @@ -2008,7 +2008,7 @@ TNodePtr TSqlQuery::Build(const TRule_delete_stmt& stmt) { return BuildWriteColumns(Ctx.Pos(), Ctx.Scoped, table, EWriteColumnMode::DeleteOn, std::move(values)); } - default: + case TRule_delete_stmt_TBlock4::ALT_NOT_SET: return nullptr; } } @@ -2059,7 +2059,7 @@ TNodePtr TSqlQuery::Build(const TRule_update_stmt& stmt) { return BuildWriteColumns(Ctx.Pos(), Ctx.Scoped, table, EWriteColumnMode::UpdateOn, std::move(values)); } - default: + case TRule_update_stmt_TBlock3::ALT_NOT_SET: return nullptr; } } @@ -2070,7 +2070,7 @@ TSourcePtr TSqlQuery::Build(const TRule_set_clause_choice& stmt) { return Build(stmt.GetAlt_set_clause_choice1().GetRule_set_clause_list1()); case TRule_set_clause_choice::kAltSetClauseChoice2: return Build(stmt.GetAlt_set_clause_choice2().GetRule_multiple_column_assignment1()); - default: + case TRule_set_clause_choice::ALT_NOT_SET: AltNotImplemented("set_clause_choice", stmt); return nullptr; } @@ -2125,7 +2125,7 @@ TSourcePtr TSqlQuery::Build(const TRule_multiple_column_assignment& stmt) { } return BuildWriteValues(pos, "UPDATE", targetList, std::move(source)); } - default: + case TRule_simple_values_source::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownSimpleValuesSourceAlt"); AltNotImplemented("simple_values_source", simpleValuesNode); return nullptr; @@ -2230,7 +2230,7 @@ namespace { } case TRule_type_name_or_bind::kAltTypeNameOrBind2: return false; - default: + case TRule_type_name_or_bind::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2266,7 +2266,7 @@ bool TSqlQuery::ParseTableStoreFeatures(std::map<TString, TDeferredAtom> & resul result["ACTION"] = TDeferredAtom(Ctx.Pos(), "DROP_COLUMN"); break; } - default: + case TRule_alter_table_store_action::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return true; diff --git a/ydb/library/yql/sql/v1/sql_select.cpp b/ydb/library/yql/sql/v1/sql_select.cpp index 551ed619a15..d2f4a870754 100644 --- a/ydb/library/yql/sql/v1/sql_select.cpp +++ b/ydb/library/yql/sql/v1/sql_select.cpp @@ -68,7 +68,7 @@ bool TSqlSelect::JoinOp(ISource* join, const TRule_join_source::TBlock3& block, // full joinOp = Token(block.GetAlt4().GetToken1()); break; - default: + case TRule_join_op_TAlt2_TBlock2_TAlt1_TBlock1::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownJoinOperation"); AltNotImplemented("join_op", node); return false; @@ -92,7 +92,7 @@ bool TSqlSelect::JoinOp(ISource* join, const TRule_join_source::TBlock3& block, case TRule_join_op::TAlt2::TBlock2::kAlt3: joinOp = Token(alt.GetBlock2().GetAlt3().GetToken1()); break; - default: + case TRule_join_op::TAlt2::TBlock2::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownJoinOperation"); AltNotImplemented("join_op", node); return false; @@ -134,7 +134,7 @@ bool TSqlSelect::JoinOp(ISource* join, const TRule_join_source::TBlock3& block, join->GetJoin()->SetupJoin(joinOp, joinKeyExpr, linkSettings); break; } - default: + case TRule_join_op::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownJoinOperation2"); AltNotImplemented("join_op", node); return false; @@ -163,7 +163,7 @@ TNodePtr TSqlSelect::JoinExpr(ISource* join, const TRule_join_constraint& node) Y_VERIFY_DEBUG(join->GetJoin()); return join->GetJoin()->BuildJoinKeys(Ctx, names); } - default: + case TRule_join_constraint::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownJoinConstraint"); AltNotImplemented("join_constraint", node); break; @@ -246,7 +246,7 @@ bool TSqlSelect::FlattenByArg(const TString& sourceLabel, TVector<TNodePtr>& fla } break; } - default: + case TRule_flatten_by_arg::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownFlattenByArg"); AltNotImplemented("flatten_by_arg", node); return false; @@ -293,7 +293,7 @@ TSourcePtr TSqlSelect::FlattenSource(const TRule_flatten_source& node) { break; } - default: + case TRule_flatten_source::TBlock2::TBlock2::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownOrdinaryNamedColumn"); AltNotImplemented("flatten_source", flatten2); } @@ -392,7 +392,7 @@ bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& } implicitLabel = true; break; - default: + case TRule_result_column_TAlt2_TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } term->SetLabel(label, Ctx.Pos()); @@ -401,7 +401,7 @@ bool TSqlSelect::SelectTerm(TVector<TNodePtr>& terms, const TRule_result_column& terms.push_back(term); break; } - default: + case TRule_result_column::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownResultColumn"); AltNotImplemented("result_column", node); return false; @@ -492,7 +492,7 @@ TSourcePtr TSqlSelect::SingleSource(const TRule_single_source& node, const TVect TPosition pos; return TSqlValues(Ctx, Mode).Build(alt.GetRule_values_stmt2(), pos, derivedColumns, derivedColumnsPos); } - default: + case TRule_single_source::ALT_NOT_SET: AltNotImplemented("single_source", node); Ctx.IncrementMonCounter("sql_errors", "UnknownSingleSource"); return nullptr; @@ -534,7 +534,7 @@ TSourcePtr TSqlSelect::NamedSingleSource(const TRule_named_single_source& node, return {}; } break; - default: + case TRule_named_single_source_TBlock2_TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } singleSource->SetLabel(label); @@ -588,7 +588,7 @@ TSourcePtr TSqlSelect::NamedSingleSource(const TRule_named_single_source& node, Ctx.IncrementMonCounter("sql_features", "SampleClause"); } break; - default: + case TRule_named_single_source::TBlock3::ALT_NOT_SET: Y_FAIL("SampleClause: does not corresond to grammar changes"); } if (!singleSource->SetSamplingOptions(Ctx, pos, mode, samplingRateNode, samplingSeedNode)) { @@ -625,7 +625,7 @@ bool TSqlSelect::ColumnName(TVector<TNodePtr>& keys, const TRule_without_column_ case TRule_without_column_name::kAltWithoutColumnName2: columnName = Id(node.GetAlt_without_column_name2().GetRule_an_id_without1(), *this); break; - default: + case TRule_without_column_name::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -1272,7 +1272,7 @@ TSqlSelect::TSelectKindResult TSqlSelect::SelectKind(const TRule_select_kind& no placement, res.SelectOpOrderBy, res.SelectOpAssumeOrderBy); break; } - default: + case TRule_select_kind_TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -1331,9 +1331,12 @@ TSourcePtr TSqlSelect::Build(const TRule& node, TPosition pos, TSelectKindResult } break; } - default: + case TRule_select_op::kAltSelectOp2: + case TRule_select_op::kAltSelectOp3: Ctx.Error() << "INTERSECT and EXCEPT are not implemented yet"; return nullptr; + case TRule_select_op::ALT_NOT_SET: + Y_FAIL("You should change implementation according to grammar changes"); } } diff --git a/ydb/library/yql/sql/v1/sql_translation.cpp b/ydb/library/yql/sql/v1/sql_translation.cpp index a366e587ca9..325bacc9441 100644 --- a/ydb/library/yql/sql/v1/sql_translation.cpp +++ b/ydb/library/yql/sql/v1/sql_translation.cpp @@ -43,7 +43,7 @@ TIdentifier GetKeywordId(TTranslation& ctx, const TRule_keyword& node) { return GetIdentifier(ctx, node.GetAlt_keyword7().GetRule_keyword_window_uncompat1()); case TRule_keyword::kAltKeyword8: return GetIdentifier(ctx, node.GetAlt_keyword8().GetRule_keyword_hint_uncompat1()); - default: + case TRule_keyword::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -55,7 +55,7 @@ TString Id(const TRule_id& node, TTranslation& ctx) { return Id(node.GetAlt_id1().GetRule_identifier1(), ctx); case TRule_id::kAltId2: return GetKeyword(ctx, node.GetAlt_id2().GetRule_keyword1()); - default: + case TRule_id::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -66,7 +66,7 @@ TString Id(const TRule_id_or_type& node, TTranslation& ctx) { return Id(node.GetAlt_id_or_type1().GetRule_id1(), ctx); case TRule_id_or_type::kAltIdOrType2: return ctx.Identifier(node.GetAlt_id_or_type2().GetRule_type_id1().GetToken1()); - default: + case TRule_id_or_type::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -77,7 +77,7 @@ TString Id(const TRule_id_as_compat& node, TTranslation& ctx) { return Id(node.GetAlt_id_as_compat1().GetRule_identifier1(), ctx); case TRule_id_as_compat::kAltIdAsCompat2: return ctx.Token(node.GetAlt_id_as_compat2().GetRule_keyword_as_compat1().GetToken1()); - default: + case TRule_id_as_compat::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -88,7 +88,7 @@ TString Id(const TRule_an_id_as_compat& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_as_compat1().GetRule_id_as_compat1(), ctx); case TRule_an_id_as_compat::kAltAnIdAsCompat2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_as_compat2().GetToken1())); - default: + case TRule_an_id_as_compat::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -120,7 +120,7 @@ TString Id(const TRule_id_schema& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_schema6().GetRule_keyword_window_uncompat1()); case TRule_id_schema::kAltIdSchema7: return GetKeyword(ctx, node.GetAlt_id_schema7().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_schema::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -132,7 +132,7 @@ TString Id(const TRule_an_id_or_type& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_or_type1().GetRule_id_or_type1(), ctx); case TRule_an_id_or_type::kAltAnIdOrType2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_or_type2().GetToken1())); - default: + case TRule_an_id_or_type::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -169,7 +169,7 @@ TString Id(const TRule_id_table& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_table6().GetRule_keyword_window_uncompat1()); case TRule_id_table::kAltIdTable7: return GetKeyword(ctx, node.GetAlt_id_table7().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_table::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -181,7 +181,7 @@ TString Id(const TRule_an_id_table& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_table1().GetRule_id_table1(), ctx); case TRule_an_id_table::kAltAnIdTable2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_table2().GetToken1())); - default: + case TRule_an_id_table::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -192,7 +192,7 @@ TString Id(const TRule_id_table_or_type& node, TTranslation& ctx) { return Id(node.GetAlt_id_table_or_type1().GetRule_an_id_table1(), ctx); case TRule_id_table_or_type::kAltIdTableOrType2: return ctx.Identifier(node.GetAlt_id_table_or_type2().GetRule_type_id1().GetToken1()); - default: + case TRule_id_table_or_type::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -222,7 +222,7 @@ TString Id(const TRule_id_expr& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_expr5().GetRule_keyword_window_uncompat1()); case TRule_id_expr::kAltIdExpr6: return GetKeyword(ctx, node.GetAlt_id_expr6().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_expr::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -259,7 +259,7 @@ TString Id(const TRule_id_expr_in& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_expr_in4().GetRule_keyword_window_uncompat1()); case TRule_id_expr_in::kAltIdExprIn5: return GetKeyword(ctx, node.GetAlt_id_expr_in5().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_expr_in::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -293,7 +293,7 @@ TString Id(const TRule_id_window& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_window7().GetRule_keyword_in_uncompat1()); case TRule_id_window::kAltIdWindow8: return GetKeyword(ctx, node.GetAlt_id_window8().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_window::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -325,7 +325,7 @@ TString Id(const TRule_id_without& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_without6().GetRule_keyword_window_uncompat1()); case TRule_id_without::kAltIdWithout7: return GetKeyword(ctx, node.GetAlt_id_without7().GetRule_keyword_hint_uncompat1()); - default: + case TRule_id_without::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -359,7 +359,7 @@ TString Id(const TRule_id_hint& node, TTranslation& ctx) { return GetKeyword(ctx, node.GetAlt_id_hint7().GetRule_keyword_in_uncompat1()); case TRule_id_hint::kAltIdHint8: return GetKeyword(ctx, node.GetAlt_id_hint8().GetRule_keyword_window_uncompat1()); - default: + case TRule_id_hint::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -371,7 +371,7 @@ TString Id(const TRule_an_id& node, TTranslation& ctx) { return Id(node.GetAlt_an_id1().GetRule_id1(), ctx); case TRule_an_id::kAltAnId2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id2().GetToken1())); - default: + case TRule_an_id::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -383,7 +383,7 @@ TString Id(const TRule_an_id_schema& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_schema1().GetRule_id_schema1(), ctx); case TRule_an_id_schema::kAltAnIdSchema2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_schema2().GetToken1())); - default: + case TRule_an_id_schema::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -395,7 +395,7 @@ TString Id(const TRule_an_id_expr& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_expr1().GetRule_id_expr1(), ctx); case TRule_an_id_expr::kAltAnIdExpr2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_expr2().GetToken1())); - default: + case TRule_an_id_expr::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -407,7 +407,7 @@ TString Id(const TRule_an_id_window& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_window1().GetRule_id_window1(), ctx); case TRule_an_id_window::kAltAnIdWindow2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_window2().GetToken1())); - default: + case TRule_an_id_window::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -419,7 +419,7 @@ TString Id(const TRule_an_id_without& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_without1().GetRule_id_without1(), ctx); case TRule_an_id_without::kAltAnIdWithout2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_without2().GetToken1())); - default: + case TRule_an_id_without::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -431,7 +431,7 @@ TString Id(const TRule_an_id_hint& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_hint1().GetRule_id_hint1(), ctx); case TRule_an_id_hint::kAltAnIdHint2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_hint2().GetToken1())); - default: + case TRule_an_id_hint::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -443,7 +443,7 @@ TString Id(const TRule_an_id_pure& node, TTranslation& ctx) { return Id(node.GetAlt_an_id_pure1().GetRule_identifier1(), ctx); case TRule_an_id_pure::kAltAnIdPure2: return IdContentFromString(ctx.Context(), ctx.Token(node.GetAlt_an_id_pure2().GetToken1())); - default: + case TRule_an_id_pure::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -461,7 +461,7 @@ bool NamedNodeImpl(const TRule_bind_parameter& node, TString& name, TTranslation case TRule_bind_parameter::TBlock2::kAlt3: id = ctx.Token(node.GetBlock2().GetAlt3().GetToken1()); break; - default: + case TRule_bind_parameter::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } auto dollar = ctx.Token(node.GetToken1()); @@ -522,7 +522,7 @@ TDeferredAtom PureColumnOrNamed(const TRule_pure_column_or_named& node, TTransla case TRule_pure_column_or_named::kAltPureColumnOrNamed2: return TDeferredAtom(ctx.Context().Pos(), Id(node.GetAlt_pure_column_or_named2().GetRule_an_id1(), ctx)); - default: + case TRule_pure_column_or_named::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -569,7 +569,7 @@ bool CreateTableIndex(const TRule_table_index& node, TTranslation& ctx, TVector< case TRule_table_index_type::kAltTableIndexType2: ctx.AltNotImplemented("local", indexType); return false; - default: + case TRule_table_index_type::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -900,7 +900,7 @@ bool TSqlTranslation::ClusterExpr(const TRule_cluster_expr& node, bool allowWild return true; } - default: + case TRule_cluster_expr::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -1127,7 +1127,7 @@ bool TSqlTranslation::TableRefImpl(const TRule_table_ref& node, TTableRef& resul result.Source = ret; return true; } - default: + case TRule_table_ref::TBlock3::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -1224,7 +1224,7 @@ TNodePtr TSqlTranslation::SerialTypeNode(const TRule_type_name_or_bind& node) { auto typeNameNode = node.GetAlt_type_name_or_bind1().GetRule_type_name1(); if (typeNameNode.Alt_case() != TRule_type_name::kAltTypeName2) { - return nullptr; + return nullptr; } auto alt = typeNameNode.GetAlt_type_name2(); @@ -1232,7 +1232,7 @@ TNodePtr TSqlTranslation::SerialTypeNode(const TRule_type_name_or_bind& node) { if (block.Alt_case() != TRule_type_name::TAlt2::TBlock1::kAlt2) { return nullptr; } - + auto alt2 = block.GetAlt2().GetRule_type_name_simple1(); const TString name = Id(alt2.GetRule_an_id_pure1(), *this); if (name.empty()) { @@ -2240,7 +2240,7 @@ TNodePtr TSqlTranslation::IntegerOrBind(const TRule_integer_or_bind& node) { auto atom = MakeAtomFromExpression(Ctx, namedNode); return atom.Build(); } - default: + case TRule_integer_or_bind::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -2274,7 +2274,7 @@ TNodePtr TSqlTranslation::TypeNameTag(const TRule_type_name_tag& node) { MakeTableFromExpression(Ctx, namedNode, atom); return atom.Build(); } - default: + case TRule_type_name_tag::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -2386,7 +2386,7 @@ TNodePtr TSqlTranslation::TypeNodeOrBind(const TRule_type_name_or_bind& node) { } return GetNamedNode(bindName); } - default: + case TRule_type_name_or_bind::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -2415,7 +2415,7 @@ TNodePtr TSqlTranslation::TypeNode(const TRule_type_name& node) { result = TypeSimple(simpleType, false); break; } - default: + case TRule_type_name::TAlt2::TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2485,7 +2485,7 @@ TNodePtr TSqlTranslation::TypeNode(const TRule_type_name_composite& node) { } case TRule_type_name_tuple::TBlock2::kAlt2: break; - default: + case TRule_type_name_tuple::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2527,7 +2527,7 @@ TNodePtr TSqlTranslation::TypeNode(const TRule_type_name_composite& node) { } case TRule_type_name_struct::TBlock2::kAlt2: break; - default: + case TRule_type_name_struct::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2713,7 +2713,7 @@ TNodePtr TSqlTranslation::TypeNode(const TRule_type_name_composite& node) { result = new TAstListNodeImpl(pos, items); break; } - default: + case TRule_type_name_composite_TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2876,7 +2876,7 @@ bool TSqlTranslation::TableHintImpl(const TRule_table_hint& rule, TTableHints& h } break; } - default: + case TRule_table_hint_TAlt1_TBlock2_TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -2960,7 +2960,7 @@ bool TSqlTranslation::TableHintImpl(const TRule_table_hint& rule, TTableHints& h break; } - default: + case TRule_table_hint::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -2984,7 +2984,7 @@ TMaybe<TTableHints> TSqlTranslation::TableHintsImpl(const TRule_table_hints& nod break; } - default: + case TRule_table_hints::TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } if (hasErrors) { @@ -3069,7 +3069,7 @@ bool TSqlTranslation::SimpleTableRefCoreImpl(const TRule_simple_table_ref_core& result.Keys = BuildTableKey(Context().Pos(), result.Service, result.Cluster, table, at ? "@" : ""); break; } - default: + case TRule_simple_table_ref_core::AltCase::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -3132,7 +3132,7 @@ TNodePtr TSqlTranslation::NamedNode(const TRule_named_nodes_stmt& rule, TVector< source = expr.Build(subselect_rule.GetBlock1().GetAlt2().GetRule_select_unparenthesized_stmt1(), pos); break; - default: + case TRule_subselect_stmt::TBlock1::ALT_NOT_SET: AltNotImplemented("subselect_stmt", subselect_rule.GetBlock1()); Ctx.IncrementMonCounter("sql_errors", "UnknownNamedNode"); return nullptr; @@ -3145,7 +3145,7 @@ TNodePtr TSqlTranslation::NamedNode(const TRule_named_nodes_stmt& rule, TVector< return BuildSourceNode(pos, std::move(source)); } - default: + case TRule_named_nodes_stmt::TBlock3::ALT_NOT_SET: AltNotImplemented("named_node", rule.GetBlock3()); Ctx.IncrementMonCounter("sql_errors", "UnknownNamedNode"); return nullptr; @@ -3269,7 +3269,7 @@ bool TSqlTranslation::RoleNameClause(const TRule_role_name& node, TDeferredAtom& } break; } - default: + case TRule_role_name::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -3411,7 +3411,7 @@ bool TSqlTranslation::PermissionNameClause(const TRule_permission_id& node, TDef handleOneOrTwoIdentifiers(node.GetAlt_permission_id12()); break; } - default: + case TRule_permission_id::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return true; @@ -3435,7 +3435,7 @@ bool TSqlTranslation::PermissionNameClause(const TRule_permission_name& node, TD result = TDeferredAtom(Ctx.Pos(), unescaped->Content); break; } - default: + case TRule_permission_name::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return true; @@ -3464,7 +3464,7 @@ bool TSqlTranslation::PermissionNameClause(const TRule_permission_name_target& n result.emplace_back(Ctx.Pos(), "all_privileges"); break; } - default: + case TRule_permission_name_target::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } if (withGrantOption) { @@ -3602,7 +3602,7 @@ bool TSqlTranslation::FrameBound(const TRule_window_frame_bound& rule, TFrameBou case TRule_window_frame_bound_TAlt2_TBlock1::kAlt2: bound->Pos = GetPos(block.GetAlt2().GetToken1()); break; - default: + case TRule_window_frame_bound_TAlt2_TBlock1::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } @@ -3616,7 +3616,7 @@ bool TSqlTranslation::FrameBound(const TRule_window_frame_bound& rule, TFrameBou } break; } - default: + case TRule_window_frame_bound::ALT_NOT_SET: Y_FAIL("FrameClause: frame bound not corresond to grammar changes"); } return true; @@ -3661,7 +3661,7 @@ bool TSqlTranslation::FrameClause(const TRule_window_frame_clause& rule, TFrameS } break; } - default: + case TRule_window_frame_extent::ALT_NOT_SET: Y_FAIL("FrameClause: frame extent not correspond to grammar changes"); } YQL_ENSURE(frameSpec->FrameBegin); @@ -3685,7 +3685,7 @@ bool TSqlTranslation::FrameClause(const TRule_window_frame_clause& rule, TFrameS case TRule_window_frame_exclusion::kAltWindowFrameExclusion4: frameSpec->FrameExclusion = FrameExclNone; break; - default: + case TRule_window_frame_exclusion::ALT_NOT_SET: Y_FAIL("FrameClause: frame exclusion not correspond to grammar changes"); } } @@ -3832,7 +3832,7 @@ TNodePtr TSqlTranslation::DoStatement(const TRule_do_stmt& stmt, bool makeLambda case TRule_call_action_TBlock1::kAlt2: action = BuildEmptyAction(Ctx.Pos()); break; - default: + case TRule_call_action_TBlock1::ALT_NOT_SET: Ctx.IncrementMonCounter("sql_errors", "UnknownDoStmt"); AltNotImplemented("do_stmt", callAction.GetBlock1()); return nullptr; @@ -3899,7 +3899,7 @@ TNodePtr TSqlTranslation::DoStatement(const TRule_do_stmt& stmt, bool makeLambda return BuildLambda(Ctx.Pos(), params, blockNode); } - default: + case TRule_do_stmt_TBlock2::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } } @@ -4102,7 +4102,7 @@ bool TSqlTranslation::ObjectFeatureValueClause(const TRule_object_feature_value& } break; } - default: + case TRule_object_feature_value::ALT_NOT_SET: Y_FAIL("You should change implementation according to grammar changes"); } return true; |