From feaa8a4c68601e945afd39c10c167c539b729f46 Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Tue, 5 Dec 2023 17:07:05 +0800 Subject: [PATCH] fix code style --- .../scalar_function_parser/elementAt.cpp | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/cpp-ch/local-engine/Parser/scalar_function_parser/elementAt.cpp b/cpp-ch/local-engine/Parser/scalar_function_parser/elementAt.cpp index 956ef162f1a9a..eb369a373bf5d 100644 --- a/cpp-ch/local-engine/Parser/scalar_function_parser/elementAt.cpp +++ b/cpp-ch/local-engine/Parser/scalar_function_parser/elementAt.cpp @@ -21,27 +21,25 @@ namespace local_engine { - class FunctionParserElementAt : public FunctionParserArrayElement - { - public: - explicit FunctionParserElementAt(SerializedPlanParser * plan_parser_) : FunctionParserArrayElement(plan_parser_) { } - ~FunctionParserElementAt() override = default; - static constexpr auto name = "element_at"; - String getName() const override { return name; } +class FunctionParserElementAt : public FunctionParserArrayElement +{ +public: + explicit FunctionParserElementAt(SerializedPlanParser * plan_parser_) : FunctionParserArrayElement(plan_parser_) { } + ~FunctionParserElementAt() override = default; + static constexpr auto name = "element_at"; + String getName() const override { return name; } - const ActionsDAG::Node * parse( - const substrait::Expression_ScalarFunction & substrait_func, - ActionsDAGPtr & actions_dag) const override - { - auto parsed_args = parseFunctionArguments(substrait_func, "", actions_dag); - if (parsed_args.size() != 2) - throw Exception(DB::ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} requires exactly two arguments", getName()); - if (isMap(removeNullable(parsed_args[0]->result_type))) - return toFunctionNode(actions_dag, "arrayElement", parsed_args); - else - return FunctionParserArrayElement::parse(substrait_func, actions_dag); - } - }; + const ActionsDAG::Node * parse(const substrait::Expression_ScalarFunction & substrait_func, ActionsDAGPtr & actions_dag) const override + { + auto parsed_args = parseFunctionArguments(substrait_func, "", actions_dag); + if (parsed_args.size() != 2) + throw Exception(DB::ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} requires exactly two arguments", getName()); + if (isMap(removeNullable(parsed_args[0]->result_type))) + return toFunctionNode(actions_dag, "arrayElement", parsed_args); + else + return FunctionParserArrayElement::parse(substrait_func, actions_dag); + } +}; - static FunctionParserRegister register_element_at; +static FunctionParserRegister register_element_at; }