This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit db847e2629ea673a062e1e212de968ffd284da83
Author: Pxl <[email protected]>
AuthorDate: Thu Mar 31 13:53:41 2022 +0800

    [refactor] add some clang-tidy checks && some code style fix (#8752)
---
 .../vec/aggregate_functions/aggregate_function.h   | 11 +--
 .../aggregate_function_approx_count_distinct.cpp   |  2 +-
 .../aggregate_functions/aggregate_function_avg.cpp |  5 +-
 .../aggregate_functions/aggregate_function_avg.h   | 11 +--
 .../aggregate_function_bitmap.cpp                  | 12 ++--
 .../aggregate_function_combinator.h                |  2 +-
 .../aggregate_functions/aggregate_function_count.h |  4 +-
 .../aggregate_function_distinct.cpp                | 28 +++++---
 .../aggregate_function_distinct.h                  | 24 +++++--
 .../aggregate_function_min_max.h                   | 73 +++++++++++++-------
 .../aggregate_function_null.cpp                    | 32 +++++----
 .../aggregate_functions/aggregate_function_null.h  | 33 ++++++---
 .../aggregate_function_percentile_approx.h         | 28 +++++---
 .../aggregate_function_stddev.h                    | 14 ++--
 .../aggregate_functions/aggregate_function_sum.cpp |  5 +-
 .../aggregate_functions/aggregate_function_sum.h   |  5 +-
 .../aggregate_function_uniq.cpp                    | 10 +--
 .../aggregate_function_window.cpp                  |  3 +-
 .../aggregate_function_window.h                    | 32 ++++-----
 be/src/vec/aggregate_functions/factory_helpers.h   |  4 +-
 be/src/vec/aggregate_functions/helpers.h           | 79 +++++++++++++++-------
 .../vec/aggregate_functions/key_holder_helpers.h   |  9 +--
 22 files changed, 273 insertions(+), 153 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function.h 
b/be/src/vec/aggregate_functions/aggregate_function.h
index 5cf529c..7506883 100644
--- a/be/src/vec/aggregate_functions/aggregate_function.h
+++ b/be/src/vec/aggregate_functions/aggregate_function.h
@@ -57,7 +57,7 @@ public:
     /// Get the result type.
     virtual DataTypePtr get_return_type() const = 0;
 
-    virtual ~IAggregateFunction() {}
+    virtual ~IAggregateFunction() = default;
 
     /** Create empty data for aggregation with `placement new` at the 
specified location.
       * You will have to destroy them using the `destroy` method.
@@ -147,14 +147,16 @@ public:
 
     void add_batch(size_t batch_size, AggregateDataPtr* places, size_t 
place_offset,
                    const IColumn** columns, Arena* arena) const override {
-        for (size_t i = 0; i < batch_size; ++i)
+        for (size_t i = 0; i < batch_size; ++i) {
             static_cast<const Derived*>(this)->add(places[i] + place_offset, 
columns, i, arena);
+        }
     }
 
     void add_batch_single_place(size_t batch_size, AggregateDataPtr place, 
const IColumn** columns,
                                 Arena* arena) const override {
-        for (size_t i = 0; i < batch_size; ++i)
+        for (size_t i = 0; i < batch_size; ++i) {
             static_cast<const Derived*>(this)->add(place, columns, i, arena);
+        }
     }
     //now this is use for sum/count/avg/min/max win function, other win 
function should override this function in class
     void add_range_single_place(int64_t partition_start, int64_t 
partition_end, int64_t frame_start,
@@ -169,8 +171,9 @@ public:
 
     void add_batch_range(size_t batch_begin, size_t batch_end, 
AggregateDataPtr place,
                          const IColumn** columns, Arena* arena, bool has_null) 
override {
-        for (size_t i = batch_begin; i <= batch_end; ++i)
+        for (size_t i = batch_begin; i <= batch_end; ++i) {
             static_cast<const Derived*>(this)->add(place, columns, i, arena);
+        }
     }
 };
 
diff --git 
a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
index fc68d85..d61c254 100644
--- 
a/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
+++ 
b/be/src/vec/aggregate_functions/aggregate_function_approx_count_distinct.cpp
@@ -31,7 +31,7 @@ AggregateFunctionPtr 
create_aggregate_function_approx_count_distinct(
                                 : argument_types[0]);
 
     
res.reset(create_class_with_type<AggregateFunctionApproxCountDistinct>(*argument_types[0],
-                                                                     
argument_types));
+                                                                           
argument_types));
 
     if (!res) {
         LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate 
function {}",
diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_avg.cpp
index 61687af..51574b0 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_avg.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_avg.cpp
@@ -45,11 +45,12 @@ AggregateFunctionPtr create_aggregate_function_avg(const 
std::string& name,
 
     AggregateFunctionPtr res;
     DataTypePtr data_type = argument_types[0];
-    if (is_decimal(data_type))
+    if (is_decimal(data_type)) {
         res.reset(
                 create_with_decimal_type<AggregateFuncAvg>(*data_type, 
*data_type, argument_types));
-    else
+    } else {
         res.reset(create_with_numeric_type<AggregateFuncAvg>(*data_type, 
argument_types));
+    }
 
     if (!res) {
         LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate 
function {}",
diff --git a/be/src/vec/aggregate_functions/aggregate_function_avg.h 
b/be/src/vec/aggregate_functions/aggregate_function_avg.h
index 5fd392e..03bb87f 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_avg.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_avg.h
@@ -36,9 +36,11 @@ struct AggregateFunctionAvgData {
 
     template <typename ResultT>
     ResultT result() const {
-        if constexpr (std::is_floating_point_v<ResultT>)
-            if constexpr (std::numeric_limits<ResultT>::is_iec559)
+        if constexpr (std::is_floating_point_v<ResultT>) {
+            if constexpr (std::numeric_limits<ResultT>::is_iec559) {
                 return static_cast<ResultT>(sum) / count; /// allow division 
by zero
+            }
+        }
 
         if (!count) {
             // null is handled in AggregationNode::_get_without_key_result
@@ -93,10 +95,11 @@ public:
     String get_name() const override { return "avg"; }
 
     DataTypePtr get_return_type() const override {
-        if constexpr (IsDecimalNumber<T>)
+        if constexpr (IsDecimalNumber<T>) {
             return 
std::make_shared<ResultDataType>(ResultDataType::max_precision(), scale);
-        else
+        } else {
             return std::make_shared<ResultDataType>();
+        }
     }
 
     void add(AggregateDataPtr __restrict place, const IColumn** columns, 
size_t row_num,
diff --git a/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp
index d110b09..e429e93 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_bitmap.cpp
@@ -28,14 +28,18 @@ static IAggregateFunction* createWithIntDataType(const 
DataTypes& argument_type)
         type = assert_cast<const 
DataTypeNullable*>(type)->get_nested_type().get();
     }
     WhichDataType which(type);
-    if (which.idx == TypeIndex::Int8)
+    if (which.idx == TypeIndex::Int8) {
         return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int8>>(argument_type);
-    if (which.idx == TypeIndex::Int16)
+    }
+    if (which.idx == TypeIndex::Int16) {
         return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int16>>(argument_type);
-    if (which.idx == TypeIndex::Int32)
+    }
+    if (which.idx == TypeIndex::Int32) {
         return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int32>>(argument_type);
-    if (which.idx == TypeIndex::Int64)
+    }
+    if (which.idx == TypeIndex::Int64) {
         return new AggregateFunctionTemplate<nullable, 
ColumnVector<Int64>>(argument_type);
+    }
     return nullptr;
 }
 
diff --git a/be/src/vec/aggregate_functions/aggregate_function_combinator.h 
b/be/src/vec/aggregate_functions/aggregate_function_combinator.h
index d53f3d2..b99b9e1 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_combinator.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_combinator.h
@@ -73,7 +73,7 @@ public:
             const AggregateFunctionPtr& nested_function, const DataTypes& 
arguments,
             const Array& params, const bool result_is_nullable) const = 0;
 
-    virtual ~IAggregateFunctionCombinator() {}
+    virtual ~IAggregateFunctionCombinator() = default;
 };
 
 } // namespace doris::vectorized
diff --git a/be/src/vec/aggregate_functions/aggregate_function_count.h 
b/be/src/vec/aggregate_functions/aggregate_function_count.h
index 3d8ab79..e2ba376 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_count.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_count.h
@@ -50,7 +50,9 @@ public:
         ++data(place).count;
     }
 
-    void reset(AggregateDataPtr place) const override { 
this->data(place).count = 0; }
+    void reset(AggregateDataPtr place) const override {
+        AggregateFunctionCount::data(place).count = 0;
+    }
 
     void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
                Arena*) const override {
diff --git a/be/src/vec/aggregate_functions/aggregate_function_distinct.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_distinct.cpp
index af64a3a..26e9e15 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_distinct.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_distinct.cpp
@@ -18,11 +18,12 @@
 // 
https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionDistinct.cpp
 // and modified by Doris
 
+#include "vec/aggregate_functions/aggregate_function_distinct.h"
+
 #include <algorithm>
 #include <boost/algorithm/string.hpp>
 
 #include "vec/aggregate_functions/aggregate_function_combinator.h"
-#include "vec/aggregate_functions/aggregate_function_distinct.h"
 #include "vec/aggregate_functions/aggregate_function_simple_factory.h"
 #include "vec/aggregate_functions/helpers.h"
 #include "vec/common/typeid_cast.h"
@@ -42,29 +43,33 @@ public:
         return arguments;
     }
 
-    AggregateFunctionPtr transform_aggregate_function(const 
AggregateFunctionPtr& nested_function,
-                                                      const DataTypes& 
arguments,
-                                                      const Array& params,
-                                                      const bool 
result_is_nullable) const override {
+    AggregateFunctionPtr transform_aggregate_function(
+            const AggregateFunctionPtr& nested_function, const DataTypes& 
arguments,
+            const Array& params, const bool result_is_nullable) const override 
{
         DCHECK(nested_function != nullptr);
-        if (nested_function == nullptr) return nullptr;
-        
+        if (nested_function == nullptr) {
+            return nullptr;
+        }
+
         AggregateFunctionPtr res;
         if (arguments.size() == 1) {
             res.reset(create_with_numeric_type<AggregateFunctionDistinct,
                                                
AggregateFunctionDistinctSingleNumericData>(
                     *arguments[0], nested_function, arguments));
 
-            if (res) return res;
+            if (res) {
+                return res;
+            }
 
-            if 
(arguments[0]->is_value_unambiguously_represented_in_contiguous_memory_region())
+            if 
(arguments[0]->is_value_unambiguously_represented_in_contiguous_memory_region())
 {
                 return std::make_shared<AggregateFunctionDistinct<
                         
AggregateFunctionDistinctSingleGenericData<true>>>(nested_function,
                                                                            
arguments);
-            else
+            } else {
                 return std::make_shared<AggregateFunctionDistinct<
                         
AggregateFunctionDistinctSingleGenericData<false>>>(nested_function,
                                                                             
arguments);
+            }
         }
 
         return std::make_shared<
@@ -89,7 +94,8 @@ void 
register_aggregate_function_combinator_distinct(AggregateFunctionSimpleFact
         }
         auto nested_function_name = 
name.substr(DISTINCT_FUNCTION_PREFIX.size());
         auto nested_function = factory.get(nested_function_name, 
transform_arguments, params);
-        return 
function_combinator->transform_aggregate_function(nested_function, types, 
params, result_is_nullable);
+        return 
function_combinator->transform_aggregate_function(nested_function, types, 
params,
+                                                                 
result_is_nullable);
     };
     factory.register_distinct_function_combinator(creator, 
DISTINCT_FUNCTION_PREFIX);
 }
diff --git a/be/src/vec/aggregate_functions/aggregate_function_distinct.h 
b/be/src/vec/aggregate_functions/aggregate_function_distinct.h
index 81f33bd..820759a 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_distinct.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_distinct.h
@@ -53,7 +53,9 @@ struct AggregateFunctionDistinctSingleNumericData {
     MutableColumns get_arguments(const DataTypes& argument_types) const {
         MutableColumns argument_columns;
         argument_columns.emplace_back(argument_types[0]->create_column());
-        for (const auto& elem : set) 
argument_columns[0]->insert(elem.get_value());
+        for (const auto& elem : set) {
+            argument_columns[0]->insert(elem.get_value());
+        }
 
         return argument_columns;
     }
@@ -68,13 +70,16 @@ struct AggregateFunctionDistinctGenericData {
     void merge(const Self& rhs, Arena* arena) {
         Set::LookupResult it;
         bool inserted;
-        for (const auto& elem : rhs.set)
+        for (const auto& elem : rhs.set) {
             set.emplace(ArenaKeyHolder {elem.get_value(), *arena}, it, 
inserted);
+        }
     }
 
     void serialize(BufferWritable& buf) const {
         write_var_uint(set.size(), buf);
-        for (const auto& elem : set) write_string_binary(elem.get_value(), 
buf);
+        for (const auto& elem : set) {
+            write_string_binary(elem.get_value(), buf);
+        }
     }
 
     void deserialize(BufferReadable& buf, Arena* arena) {
@@ -101,8 +106,9 @@ struct AggregateFunctionDistinctSingleGenericData : public 
AggregateFunctionDist
     MutableColumns get_arguments(const DataTypes& argument_types) const {
         MutableColumns argument_columns;
         argument_columns.emplace_back(argument_types[0]->create_column());
-        for (const auto& elem : set)
+        for (const auto& elem : set) {
             deserialize_and_insert<is_plain_column>(elem.get_value(), 
*argument_columns[0]);
+        }
 
         return argument_columns;
     }
@@ -126,13 +132,15 @@ struct AggregateFunctionDistinctMultipleGenericData : 
public AggregateFunctionDi
 
     MutableColumns get_arguments(const DataTypes& argument_types) const {
         MutableColumns argument_columns(argument_types.size());
-        for (size_t i = 0; i < argument_types.size(); ++i)
+        for (size_t i = 0; i < argument_types.size(); ++i) {
             argument_columns[i] = argument_types[i]->create_column();
+        }
 
         for (const auto& elem : set) {
             const char* begin = elem.get_value().data;
-            for (auto& column : argument_columns)
+            for (auto& column : argument_columns) {
                 begin = column->deserialize_and_insert_from_arena(begin);
+            }
         }
 
         return argument_columns;
@@ -189,7 +197,9 @@ public:
         auto place = const_cast<AggregateDataPtr>(targetplace);
         auto arguments = this->data(place).get_arguments(this->argument_types);
         ColumnRawPtrs arguments_raw(arguments.size());
-        for (size_t i = 0; i < arguments.size(); ++i) arguments_raw[i] = 
arguments[i].get();
+        for (size_t i = 0; i < arguments.size(); ++i) {
+            arguments_raw[i] = arguments[i].get();
+        }
 
         assert(!arguments.empty());
         // nested_func->add_batch_single_place(arguments[0]->size(), 
get_nested_place(place), arguments_raw.data(), arena);
diff --git a/be/src/vec/aggregate_functions/aggregate_function_min_max.h 
b/be/src/vec/aggregate_functions/aggregate_function_min_max.h
index 26fd57e..e8371c1 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_min_max.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_min_max.h
@@ -43,10 +43,11 @@ public:
     bool has() const { return has_value; }
 
     void insert_result_into(IColumn& to) const {
-        if (has())
+        if (has()) {
             assert_cast<ColumnVector<T>&>(to).get_data().push_back(value);
-        else
+        } else {
             assert_cast<ColumnVector<T>&>(to).insert_default();
+        }
     }
 
     void reset() {
@@ -57,12 +58,16 @@ public:
 
     void write(BufferWritable& buf) const {
         write_binary(has(), buf);
-        if (has()) write_binary(value, buf);
+        if (has()) {
+            write_binary(value, buf);
+        }
     }
 
     void read(BufferReadable& buf) {
         read_binary(has_value, buf);
-        if (has()) read_binary(value, buf);
+        if (has()) {
+            read_binary(value, buf);
+        }
     }
 
     void change(const IColumn& column, size_t row_num, Arena*) {
@@ -80,32 +85,36 @@ public:
         if (!has() || assert_cast<const 
ColumnVector<T>&>(column).get_data()[row_num] < value) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_less(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.value < value)) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const IColumn& column, size_t row_num, Arena* 
arena) {
         if (!has() || assert_cast<const 
ColumnVector<T>&>(column).get_data()[row_num] > value) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.value > value)) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool is_equal_to(const Self& to) const { return has() && to.value == 
value; }
@@ -132,8 +141,9 @@ public:
         if (has()) {
             DecimalV2Value decimal(value);
             assert_cast<ColumnDecimal<Decimal128>&>(to).insert_data((const 
char*)&decimal, 0);
-        } else
+        } else {
             assert_cast<ColumnDecimal<Decimal128>&>(to).insert_default();
+        }
     }
 
     void reset() {
@@ -144,12 +154,16 @@ public:
 
     void write(BufferWritable& buf) const {
         write_binary(has(), buf);
-        if (has()) write_binary(value, buf);
+        if (has()) {
+            write_binary(value, buf);
+        }
     }
 
     void read(BufferReadable& buf) {
         read_binary(has_value, buf);
-        if (has()) read_binary(value, buf);
+        if (has()) {
+            read_binary(value, buf);
+        }
     }
 
     void change(const IColumn& column, size_t row_num, Arena*) {
@@ -168,16 +182,18 @@ public:
             assert_cast<const 
ColumnDecimal<Decimal128>&>(column).get_data()[row_num] < value) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_less(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.value < value)) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const IColumn& column, size_t row_num, Arena* 
arena) {
@@ -185,16 +201,18 @@ public:
             assert_cast<const 
ColumnDecimal<Decimal128>&>(column).get_data()[row_num] > value) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.value > value)) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool is_equal_to(const Self& to) const { return has() && to.value == 
value; }
@@ -232,10 +250,11 @@ public:
     const char* get_data() const { return size <= MAX_SMALL_STRING_SIZE ? 
small_data : large_data; }
 
     void insert_result_into(IColumn& to) const {
-        if (has())
+        if (has()) {
             assert_cast<ColumnString&>(to).insert_data(get_data(), size);
-        else
+        } else {
             assert_cast<ColumnString&>(to).insert_default();
+        }
     }
 
     void reset() {
@@ -249,7 +268,9 @@ public:
 
     void write(BufferWritable& buf) const {
         write_binary(size, buf);
-        if (has()) buf.write(get_data(), size);
+        if (has()) {
+            buf.write(get_data(), size);
+        }
     }
 
     void read(BufferReadable& buf) {
@@ -262,7 +283,9 @@ public:
 
                 size = rhs_size;
 
-                if (size > 0) buf.read(small_data, size);
+                if (size > 0) {
+                    buf.read(small_data, size);
+                }
             } else {
                 if (capacity < rhs_size) {
                     capacity = 
static_cast<UInt32>(round_up_to_power_of_two_or_zero(rhs_size));
@@ -316,8 +339,9 @@ public:
             assert_cast<const ColumnString&>(column).get_data_at(row_num) < 
get_string_ref()) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const IColumn& column, size_t row_num, Arena* 
arena) {
@@ -325,24 +349,27 @@ public:
             assert_cast<const ColumnString&>(column).get_data_at(row_num) > 
get_string_ref()) {
             change(column, row_num, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_less(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.get_string_ref() < get_string_ref())) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool change_if_greater(const Self& to, Arena* arena) {
         if (to.has() && (!has() || to.get_string_ref() > get_string_ref())) {
             change(to, arena);
             return true;
-        } else
+        } else {
             return false;
+        }
     }
 
     bool is_equal_to(const Self& to) const {
diff --git a/be/src/vec/aggregate_functions/aggregate_function_null.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_null.cpp
index e28287f..495cefc 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_null.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_null.cpp
@@ -39,15 +39,18 @@ public:
     DataTypes transform_arguments(const DataTypes& arguments) const override {
         size_t size = arguments.size();
         DataTypes res(size);
-        for (size_t i = 0; i < size; ++i) res[i] = 
remove_nullable(arguments[i]);
+        for (size_t i = 0; i < size; ++i) {
+            res[i] = remove_nullable(arguments[i]);
+        }
         return res;
     }
 
-    AggregateFunctionPtr transform_aggregate_function(const 
AggregateFunctionPtr& nested_function,
-                                                      const DataTypes& 
arguments,
-                                                      const Array& params,
-                                                      const bool 
result_is_nullable) const override {
-        if (nested_function == nullptr) return nullptr;
+    AggregateFunctionPtr transform_aggregate_function(
+            const AggregateFunctionPtr& nested_function, const DataTypes& 
arguments,
+            const Array& params, const bool result_is_nullable) const override 
{
+        if (nested_function == nullptr) {
+            return nullptr;
+        }
 
         bool has_null_types = false;
         for (const auto& arg_type : arguments) {
@@ -57,22 +60,26 @@ public:
             }
         }
 
-        if (has_null_types) return 
std::make_shared<AggregateFunctionNothing>(arguments, params);
+        if (has_null_types) {
+            return std::make_shared<AggregateFunctionNothing>(arguments, 
params);
+        }
 
         if (arguments.size() == 1) {
-            if (result_is_nullable)
+            if (result_is_nullable) {
                 return 
std::make_shared<AggregateFunctionNullUnary<true>>(nested_function,
                                                                           
arguments, params);
-            else
+            } else {
                 return 
std::make_shared<AggregateFunctionNullUnary<false>>(nested_function,
                                                                            
arguments, params);
+            }
         } else {
-            if (result_is_nullable)
+            if (result_is_nullable) {
                 return 
std::make_shared<AggregateFunctionNullVariadic<true>>(nested_function,
                                                                              
arguments, params);
-            else
+            } else {
                 return 
std::make_shared<AggregateFunctionNullVariadic<false>>(nested_function,
                                                                               
arguments, params);
+            }
         }
     }
 };
@@ -84,7 +91,8 @@ void 
register_aggregate_function_combinator_null(AggregateFunctionSimpleFactory&
         auto function_combinator = 
std::make_shared<AggregateFunctionCombinatorNull>();
         auto transform_arguments = 
function_combinator->transform_arguments(types);
         auto nested_function = factory.get(name, transform_arguments, params);
-        return 
function_combinator->transform_aggregate_function(nested_function, types, 
params, result_is_nullable);
+        return 
function_combinator->transform_aggregate_function(nested_function, types, 
params,
+                                                                 
result_is_nullable);
     };
     factory.register_nullable_function_combinator(creator);
 }
diff --git a/be/src/vec/aggregate_functions/aggregate_function_null.h 
b/be/src/vec/aggregate_functions/aggregate_function_null.h
index 55e9100..5b804b8 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_null.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_null.h
@@ -62,15 +62,19 @@ protected:
     }
 
     static void init_flag(AggregateDataPtr __restrict place) noexcept {
-        if constexpr (result_is_nullable) place[0] = 0;
+        if constexpr (result_is_nullable) {
+            place[0] = false;
+        }
     }
 
     static void set_flag(AggregateDataPtr __restrict place) noexcept {
-        if constexpr (result_is_nullable) place[0] = 1;
+        if constexpr (result_is_nullable) {
+            place[0] = true;
+        }
     }
 
     static bool get_flag(ConstAggregateDataPtr __restrict place) noexcept {
-        return result_is_nullable ? place[0] : 1;
+        return result_is_nullable ? place[0] : true;
     }
 
 public:
@@ -78,10 +82,11 @@ public:
                               const Array& params)
             : IAggregateFunctionHelper<Derived>(arguments, params),
               nested_function {nested_function_} {
-        if (result_is_nullable)
+        if (result_is_nullable) {
             prefix_size = nested_function->align_of_data();
-        else
+        } else {
             prefix_size = 0;
+        }
     }
 
     String get_name() const override {
@@ -117,14 +122,18 @@ public:
 
     void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
                Arena* arena) const override {
-        if (result_is_nullable && get_flag(rhs)) set_flag(place);
+        if (result_is_nullable && get_flag(rhs)) {
+            set_flag(place);
+        }
 
         nested_function->merge(nested_place(place), nested_place(rhs), arena);
     }
 
     void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& 
buf) const override {
         bool flag = get_flag(place);
-        if (result_is_nullable) write_binary(flag, buf);
+        if (result_is_nullable) {
+            write_binary(flag, buf);
+        }
         if (flag) {
             nested_function->serialize(nested_place(place), buf);
         }
@@ -133,7 +142,9 @@ public:
     void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
                      Arena* arena) const override {
         bool flag = true;
-        if (result_is_nullable) read_binary(flag, buf);
+        if (result_is_nullable) {
+            read_binary(flag, buf);
+        }
         if (flag) {
             set_flag(place);
             nested_function->deserialize(nested_place(place), buf, arena);
@@ -248,8 +259,9 @@ public:
                     size_t(MAX_ARGS));
         }
 
-        for (size_t i = 0; i < number_of_arguments; ++i)
+        for (size_t i = 0; i < number_of_arguments; ++i) {
             is_nullable[i] = arguments[i]->is_nullable();
+        }
     }
 
     void add(AggregateDataPtr __restrict place, const IColumn** columns, 
size_t row_num,
@@ -267,8 +279,9 @@ public:
                     return;
                 }
                 nested_columns[i] = &nullable_col.get_nested_column();
-            } else
+            } else {
                 nested_columns[i] = columns[i];
+            }
         }
 
         this->set_flag(place);
diff --git 
a/be/src/vec/aggregate_functions/aggregate_function_percentile_approx.h 
b/be/src/vec/aggregate_functions/aggregate_function_percentile_approx.h
index 3e5576b..cca1767 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_percentile_approx.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_percentile_approx.h
@@ -124,25 +124,28 @@ public:
         return make_nullable(std::make_shared<DataTypeFloat64>());
     }
 
-    void reset(AggregateDataPtr __restrict place) const override { 
this->data(place).reset(); }
+    void reset(AggregateDataPtr __restrict place) const override {
+        AggregateFunctionPercentileApprox::data(place).reset();
+    }
 
     void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
                Arena*) const override {
-        this->data(place).merge(this->data(rhs));
+        AggregateFunctionPercentileApprox::data(place).merge(
+                AggregateFunctionPercentileApprox::data(rhs));
     }
 
     void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& 
buf) const override {
-        this->data(place).write(buf);
+        AggregateFunctionPercentileApprox::data(place).write(buf);
     }
 
     void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
                      Arena*) const override {
-        this->data(place).read(buf);
+        AggregateFunctionPercentileApprox::data(place).read(buf);
     }
 
     void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& 
to) const override {
         ColumnNullable& nullable_column = assert_cast<ColumnNullable&>(to);
-        double result = this->data(place).get();
+        double result = AggregateFunctionPercentileApprox::data(place).get();
 
         if (std::isnan(result)) {
             nullable_column.insert_default();
@@ -305,28 +308,31 @@ public:
         const auto& sources = static_cast<const 
ColumnVector<Int64>&>(*columns[0]);
         const auto& quantile = static_cast<const 
ColumnVector<Float64>&>(*columns[1]);
 
-        this->data(place).add(sources.get_int(row_num), 
quantile.get_float64(row_num));
+        AggregateFunctionPercentile::data(place).add(sources.get_int(row_num),
+                                                     
quantile.get_float64(row_num));
     }
 
-    void reset(AggregateDataPtr __restrict place) const override { 
this->data(place).reset(); }
+    void reset(AggregateDataPtr __restrict place) const override {
+        AggregateFunctionPercentile::data(place).reset();
+    }
 
     void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs,
                Arena*) const override {
-        this->data(place).merge(this->data(rhs));
+        
AggregateFunctionPercentile::data(place).merge(AggregateFunctionPercentile::data(rhs));
     }
 
     void serialize(ConstAggregateDataPtr __restrict place, BufferWritable& 
buf) const override {
-        this->data(place).write(buf);
+        AggregateFunctionPercentile::data(place).write(buf);
     }
 
     void deserialize(AggregateDataPtr __restrict place, BufferReadable& buf,
                      Arena*) const override {
-        this->data(place).read(buf);
+        AggregateFunctionPercentile::data(place).read(buf);
     }
 
     void insert_result_into(ConstAggregateDataPtr __restrict place, IColumn& 
to) const override {
         auto& col = assert_cast<ColumnVector<Float64>&>(to);
-        col.insert_value(this->data(place).get());
+        col.insert_value(AggregateFunctionPercentile::data(place).get());
     }
 };
 
diff --git a/be/src/vec/aggregate_functions/aggregate_function_stddev.h 
b/be/src/vec/aggregate_functions/aggregate_function_stddev.h
index 8821232..d03774b 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_stddev.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_stddev.h
@@ -28,7 +28,7 @@ namespace doris::vectorized {
 template <typename T, bool is_stddev>
 struct BaseData {
     BaseData() : mean(0.0), m2(0.0), count(0) {}
-    virtual ~BaseData() {}
+    virtual ~BaseData() = default;
 
     void write(BufferWritable& buf) const {
         write_binary(mean, buf);
@@ -99,7 +99,7 @@ struct BaseData {
 template <bool is_stddev>
 struct BaseDatadecimal {
     BaseDatadecimal() : mean(0), m2(0), count(0) {}
-    virtual ~BaseDatadecimal() {}
+    virtual ~BaseDatadecimal() = default;
 
     void write(BufferWritable& buf) const {
         write_binary(mean, buf);
@@ -236,10 +236,12 @@ struct SampData : Data {
 
 template <bool is_pop, typename Data, bool is_nullable>
 class AggregateFunctionSampVariance
-        : public IAggregateFunctionDataHelper<Data, 
AggregateFunctionSampVariance<is_pop, Data, is_nullable>> {
+        : public IAggregateFunctionDataHelper<
+                  Data, AggregateFunctionSampVariance<is_pop, Data, 
is_nullable>> {
 public:
     AggregateFunctionSampVariance(const DataTypes& argument_types_)
-            : IAggregateFunctionDataHelper<Data, 
AggregateFunctionSampVariance<is_pop, Data, is_nullable>>(
+            : IAggregateFunctionDataHelper<
+                      Data, AggregateFunctionSampVariance<is_pop, Data, 
is_nullable>>(
                       argument_types_, {}) {}
 
     String get_name() const override { return Data::name(); }
@@ -292,7 +294,7 @@ public:
 //samp function it's always nullables, it's need to handle nullable column
 //so return type and add function should processing null values
 template <typename Data, bool is_nullable>
-class AggregateFunctionSamp final: public AggregateFunctionSampVariance<false, 
Data, is_nullable> {
+class AggregateFunctionSamp final : public 
AggregateFunctionSampVariance<false, Data, is_nullable> {
 public:
     AggregateFunctionSamp(const DataTypes& argument_types_)
             : AggregateFunctionSampVariance<false, Data, 
is_nullable>(argument_types_) {}
@@ -300,7 +302,7 @@ public:
 
 //pop function have use AggregateFunctionNullBase function, so needn't 
processing null values
 template <typename Data, bool is_nullable>
-class AggregateFunctionPop final: public AggregateFunctionSampVariance<true, 
Data, is_nullable> {
+class AggregateFunctionPop final : public AggregateFunctionSampVariance<true, 
Data, is_nullable> {
 public:
     AggregateFunctionPop(const DataTypes& argument_types_)
             : AggregateFunctionSampVariance<true, Data, 
is_nullable>(argument_types_) {}
diff --git a/be/src/vec/aggregate_functions/aggregate_function_sum.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_sum.cpp
index f7127e7..60313f6 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_sum.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_sum.cpp
@@ -50,10 +50,11 @@ AggregateFunctionPtr create_aggregate_function_sum(const 
std::string& name,
 
     AggregateFunctionPtr res;
     DataTypePtr data_type = argument_types[0];
-    if (is_decimal(data_type))
+    if (is_decimal(data_type)) {
         res.reset(create_with_decimal_type<Function>(*data_type, *data_type, 
argument_types));
-    else
+    } else {
         res.reset(create_with_numeric_type<Function>(*data_type, 
argument_types));
+    }
 
     if (!res) {
         LOG(WARNING) << fmt::format("Illegal type {} of argument for aggregate 
function {}",
diff --git a/be/src/vec/aggregate_functions/aggregate_function_sum.h 
b/be/src/vec/aggregate_functions/aggregate_function_sum.h
index eceaf03..9c5bdfc 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_sum.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_sum.h
@@ -67,10 +67,11 @@ public:
               scale(get_decimal_scale(data_type)) {}
 
     DataTypePtr get_return_type() const override {
-        if constexpr (IsDecimalNumber<T>)
+        if constexpr (IsDecimalNumber<T>) {
             return 
std::make_shared<ResultDataType>(ResultDataType::max_precision(), scale);
-        else
+        } else {
             return std::make_shared<ResultDataType>();
+        }
     }
 
     void add(AggregateDataPtr __restrict place, const IColumn** columns, 
size_t row_num,
diff --git a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
index 0258858..f90b4ba 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_uniq.cpp
@@ -48,12 +48,14 @@ AggregateFunctionPtr create_aggregate_function_uniq(const 
std::string& name,
 
         WhichDataType which(argument_type);
         // TODO: DateType
-        if (res)
+        if (res) {
             return res;
-        else if (which.is_decimal())
-            return std::make_shared<AggregateFunctionUniq<Decimal128, 
Data<Int128>>>(argument_types);
-        else if (which.is_string_or_fixed_string())
+        } else if (which.is_decimal()) {
+            return std::make_shared<AggregateFunctionUniq<Decimal128, 
Data<Int128>>>(
+                    argument_types);
+        } else if (which.is_string_or_fixed_string()) {
             return std::make_shared<AggregateFunctionUniq<String, 
Data<String>>>(argument_types);
+        }
     }
 
     return nullptr;
diff --git a/be/src/vec/aggregate_functions/aggregate_function_window.cpp 
b/be/src/vec/aggregate_functions/aggregate_function_window.cpp
index c40f2bc..b96f241 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_window.cpp
+++ b/be/src/vec/aggregate_functions/aggregate_function_window.cpp
@@ -83,9 +83,10 @@ static IAggregateFunction* 
create_function_single_value(const String& name,
         return new AggregateFunctionTemplate<
                 Data<LeadAndLagData<Int64, is_nullable, false, 
StoreType>>>(argument_types);
     }
-    if (which.is_string_or_fixed_string())
+    if (which.is_string_or_fixed_string()) {
         return new AggregateFunctionTemplate<
                 Data<LeadAndLagData<StringRef, is_nullable, true, 
StoreType>>>(argument_types);
+    }
     DCHECK(false) << "with unknowed type, failed in  
create_aggregate_function_leadlag";
     return nullptr;
 }
diff --git a/be/src/vec/aggregate_functions/aggregate_function_window.h 
b/be/src/vec/aggregate_functions/aggregate_function_window.h
index d7e7598..133efe7 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_window.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_window.h
@@ -53,7 +53,9 @@ public:
         ++data(place).count;
     }
 
-    void reset(AggregateDataPtr place) const override { 
this->data(place).count = 0; }
+    void reset(AggregateDataPtr place) const override {
+        WindowFunctionRowNumber::data(place).count = 0;
+    }
 
     void insert_result_into(ConstAggregateDataPtr place, IColumn& to) const 
override {
         assert_cast<ColumnInt64&>(to).get_data().push_back(data(place).count);
@@ -87,17 +89,17 @@ public:
                                 int64_t frame_end, AggregateDataPtr place, 
const IColumn** columns,
                                 Arena* arena) const override {
         int64_t peer_group_count = frame_end - frame_start;
-        if (this->data(place).peer_group_start != frame_start) {
-            this->data(place).peer_group_start = frame_start;
-            this->data(place).rank += this->data(place).count;
+        if (WindowFunctionRank::data(place).peer_group_start != frame_start) {
+            WindowFunctionRank::data(place).peer_group_start = frame_start;
+            WindowFunctionRank::data(place).rank += 
WindowFunctionRank::data(place).count;
         }
-        this->data(place).count = peer_group_count;
+        WindowFunctionRank::data(place).count = peer_group_count;
     }
 
     void reset(AggregateDataPtr place) const override {
-        this->data(place).rank = 0;
-        this->data(place).count = 1;
-        this->data(place).peer_group_start = -1;
+        WindowFunctionRank::data(place).rank = 0;
+        WindowFunctionRank::data(place).count = 1;
+        WindowFunctionRank::data(place).peer_group_start = -1;
     }
 
     void insert_result_into(ConstAggregateDataPtr place, IColumn& to) const 
override {
@@ -130,15 +132,15 @@ public:
     void add_range_single_place(int64_t partition_start, int64_t 
partition_end, int64_t frame_start,
                                 int64_t frame_end, AggregateDataPtr place, 
const IColumn** columns,
                                 Arena* arena) const override {
-        if (this->data(place).peer_group_start != frame_start) {
-            this->data(place).peer_group_start = frame_start;
-            this->data(place).rank++;
+        if (WindowFunctionDenseRank::data(place).peer_group_start != 
frame_start) {
+            WindowFunctionDenseRank::data(place).peer_group_start = 
frame_start;
+            WindowFunctionDenseRank::data(place).rank++;
         }
     }
 
     void reset(AggregateDataPtr place) const override {
-        this->data(place).rank = 0;
-        this->data(place).peer_group_start = -1;
+        WindowFunctionDenseRank::data(place).rank = 0;
+        WindowFunctionDenseRank::data(place).peer_group_start = -1;
     }
 
     void insert_result_into(ConstAggregateDataPtr place, IColumn& to) const 
override {
@@ -357,9 +359,7 @@ struct WindowFunctionLastData : Data {
         frame_end = std::min<int64_t>(frame_end, partition_end);
         this->set_value(columns, frame_end - 1);
     }
-    void add(int64_t row, const IColumn** columns) {
-        this->set_value(columns, row);
-    }
+    void add(int64_t row, const IColumn** columns) { this->set_value(columns, 
row); }
     static const char* name() { return "last_value"; }
 };
 
diff --git a/be/src/vec/aggregate_functions/factory_helpers.h 
b/be/src/vec/aggregate_functions/factory_helpers.h
index 95b5538..b93d422 100644
--- a/be/src/vec/aggregate_functions/factory_helpers.h
+++ b/be/src/vec/aggregate_functions/factory_helpers.h
@@ -42,7 +42,9 @@ inline void assert_binary(const std::string& name, const 
DataTypes& argument_typ
 
 template <std::size_t maximal_arity>
 inline void assert_arity_at_most(const std::string& name, const DataTypes& 
argument_types) {
-    if (argument_types.size() <= maximal_arity) return;
+    if (argument_types.size() <= maximal_arity) {
+        return;
+    }
 
     if constexpr (maximal_arity == 0) {
         LOG(FATAL) << fmt::format("Aggregate function {} cannot have 
arguments", name);
diff --git a/be/src/vec/aggregate_functions/helpers.h 
b/be/src/vec/aggregate_functions/helpers.h
index 02b49a8..fce6e82 100644
--- a/be/src/vec/aggregate_functions/helpers.h
+++ b/be/src/vec/aggregate_functions/helpers.h
@@ -49,10 +49,12 @@ static IAggregateFunction* create_with_numeric_type(const 
IDataType& argument_ty
         return new 
AggregateFunctionTemplate<TYPE>(std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return new 
AggregateFunctionTemplate<Int8>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return new 
AggregateFunctionTemplate<Int16>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -66,10 +68,12 @@ static IAggregateFunction* create_with_numeric_type(const 
IDataType& argument_ty
         return new AggregateFunctionTemplate<TYPE, 
bool_param>(std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return new AggregateFunctionTemplate<Int8, 
bool_param>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return new AggregateFunctionTemplate<Int16, 
bool_param>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -83,10 +87,12 @@ static IAggregateFunction* create_with_numeric_type(const 
IDataType& argument_ty
         return new AggregateFunctionTemplate<TYPE, 
Data>(std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return new AggregateFunctionTemplate<Int8, 
Data>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return new AggregateFunctionTemplate<Int16, 
Data>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -100,10 +106,12 @@ static IAggregateFunction* create_with_numeric_type(const 
IDataType& argument_ty
         return new AggregateFunctionTemplate<TYPE, 
Data<TYPE>>(std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return new AggregateFunctionTemplate<Int8, 
Data<Int8>>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return new AggregateFunctionTemplate<Int16, 
Data<Int16>>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -127,14 +135,18 @@ template <template <typename, typename> class 
AggregateFunctionTemplate,
 static IAggregateFunction* create_with_unsigned_integer_type(const IDataType& 
argument_type,
                                                              TArgs&&... args) {
     WhichDataType which(argument_type);
-    if (which.idx == TypeIndex::UInt8)
+    if (which.idx == TypeIndex::UInt8) {
         return new AggregateFunctionTemplate<UInt8, 
Data<UInt8>>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::UInt16)
+    }
+    if (which.idx == TypeIndex::UInt16) {
         return new AggregateFunctionTemplate<UInt16, 
Data<UInt16>>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::UInt32)
+    }
+    if (which.idx == TypeIndex::UInt32) {
         return new AggregateFunctionTemplate<UInt32, 
Data<UInt32>>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::UInt64)
+    }
+    if (which.idx == TypeIndex::UInt64) {
         return new AggregateFunctionTemplate<UInt64, 
Data<UInt64>>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -143,16 +155,21 @@ static IAggregateFunction* 
create_with_numeric_based_type(const IDataType& argum
                                                           TArgs&&... args) {
     IAggregateFunction* f = 
create_with_numeric_type<AggregateFunctionTemplate>(
             argument_type, std::forward<TArgs>(args)...);
-    if (f) return f;
+    if (f) {
+        return f;
+    }
 
     /// expects that DataTypeDate based on UInt16, DataTypeDateTime based on 
UInt32 and UUID based on UInt128
     WhichDataType which(argument_type);
-    if (which.idx == TypeIndex::Date)
+    if (which.idx == TypeIndex::Date) {
         return new 
AggregateFunctionTemplate<UInt16>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::DateTime)
+    }
+    if (which.idx == TypeIndex::DateTime) {
         return new 
AggregateFunctionTemplate<UInt32>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::UUID)
+    }
+    if (which.idx == TypeIndex::UUID) {
         return new 
AggregateFunctionTemplate<UInt128>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -160,12 +177,15 @@ template <template <typename> class 
AggregateFunctionTemplate, typename... TArgs
 static IAggregateFunction* create_with_decimal_type(const IDataType& 
argument_type,
                                                     TArgs&&... args) {
     WhichDataType which(argument_type);
-    if (which.idx == TypeIndex::Decimal32)
+    if (which.idx == TypeIndex::Decimal32) {
         return new 
AggregateFunctionTemplate<Decimal32>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Decimal64)
+    }
+    if (which.idx == TypeIndex::Decimal64) {
         return new 
AggregateFunctionTemplate<Decimal64>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Decimal128)
+    }
+    if (which.idx == TypeIndex::Decimal128) {
         return new 
AggregateFunctionTemplate<Decimal128>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -174,12 +194,15 @@ template <template <typename, typename> class 
AggregateFunctionTemplate, typenam
 static IAggregateFunction* create_with_decimal_type(const IDataType& 
argument_type,
                                                     TArgs&&... args) {
     WhichDataType which(argument_type);
-    if (which.idx == TypeIndex::Decimal32)
+    if (which.idx == TypeIndex::Decimal32) {
         return new AggregateFunctionTemplate<Decimal32, 
Data>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Decimal64)
+    }
+    if (which.idx == TypeIndex::Decimal64) {
         return new AggregateFunctionTemplate<Decimal64, 
Data>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Decimal128)
+    }
+    if (which.idx == TypeIndex::Decimal128) {
         return new AggregateFunctionTemplate<Decimal128, 
Data>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -195,10 +218,12 @@ static IAggregateFunction* 
create_with_two_numeric_types_second(const IDataType&
         return new AggregateFunctionTemplate<FirstType, 
TYPE>(std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return new AggregateFunctionTemplate<FirstType, 
Int8>(std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return new AggregateFunctionTemplate<FirstType, 
Int16>(std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
@@ -213,12 +238,14 @@ static IAggregateFunction* 
create_with_two_numeric_types(const IDataType& first_
                 second_type, std::forward<TArgs>(args)...);
     FOR_NUMERIC_TYPES(DISPATCH)
 #undef DISPATCH
-    if (which.idx == TypeIndex::Enum8)
+    if (which.idx == TypeIndex::Enum8) {
         return create_with_two_numeric_types_second<Int8, 
AggregateFunctionTemplate>(
                 second_type, std::forward<TArgs>(args)...);
-    if (which.idx == TypeIndex::Enum16)
+    }
+    if (which.idx == TypeIndex::Enum16) {
         return create_with_two_numeric_types_second<Int16, 
AggregateFunctionTemplate>(
                 second_type, std::forward<TArgs>(args)...);
+    }
     return nullptr;
 }
 
diff --git a/be/src/vec/aggregate_functions/key_holder_helpers.h 
b/be/src/vec/aggregate_functions/key_holder_helpers.h
index 10246aa..33fb0c5 100644
--- a/be/src/vec/aggregate_functions/key_holder_helpers.h
+++ b/be/src/vec/aggregate_functions/key_holder_helpers.h
@@ -28,21 +28,22 @@ namespace doris::vectorized {
 template <bool is_plain_column = false>
 static auto get_key_holder(const IColumn& column, size_t row_num, Arena& 
arena) {
     if constexpr (is_plain_column) {
-        return ArenaKeyHolder{column.get_data_at(row_num), arena};
+        return ArenaKeyHolder {column.get_data_at(row_num), arena};
     } else {
         const char* begin = nullptr;
         StringRef serialized = column.serialize_value_into_arena(row_num, 
arena, begin);
         assert(serialized.data != nullptr);
-        return SerializedKeyHolder{serialized, arena};
+        return SerializedKeyHolder {serialized, arena};
     }
 }
 
 template <bool is_plain_column>
 static void deserialize_and_insert(StringRef str, IColumn& data_to) {
-    if constexpr (is_plain_column)
+    if constexpr (is_plain_column) {
         data_to.insert_data(str.data, str.size);
-    else
+    } else {
         data_to.deserialize_and_insert_from_arena(str.data);
+    }
 }
 
 } // namespace doris::vectorized

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to