github-actions[bot] commented on code in PR #42269:
URL: https://github.com/apache/doris/pull/42269#discussion_r1817894691


##########
be/test/vec/columns/common_column_test.cpp:
##########
@@ -0,0 +1,153 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/columns/common_column_test.h"
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+namespace doris::vectorized {
+
+// MOCK SITUATION TEST -- here ut will test the common column function for 
column type, this function called in mocked situation to test multiple column 
type.
+TEST_F(CommonColumnTest, SeDeserializeWithArena) {
+    MutableColumns columns(4);
+    columns[0] = col_str->clone();
+    columns[1] = col_int->clone();
+    columns[2] = col_arr->clone();
+    columns[3] = col_map->clone();
+    DataTypes data_types = {std::make_shared<DataTypeString>(), 
std::make_shared<DataTypeInt64>(),
+                            
std::make_shared<DataTypeArray>(std::make_shared<DataTypeInt64>()),
+                            
std::make_shared<DataTypeMap>(std::make_shared<DataTypeString>(),
+                                                          
std::make_shared<DataTypeInt64>())};
+    ser_deserialize_with_arena_impl(columns, data_types);
+}
+
+TEST_F(CommonColumnTest, SeDeserializeVec) {
+    MutableColumns columns(2);
+    columns[0] = col_str->clone();
+    columns[1] = col_int->clone();
+    // array | map | struct get_max_row_byte_size does not implement
+    //    columns[2] = col_arr->clone();
+    //    columns[3] = col_map->clone();
+    ser_deser_vec(columns, {std::make_shared<DataTypeString>(), 
std::make_shared<DataTypeInt64>()});
+}
+
+TEST_F(CommonColumnTest, FilterBySelector) {
+    // make a PredictColumn
+    auto ptr = 
Schema::get_predicate_column_ptr(FieldType::OLAP_FIELD_TYPE_BIGINT, false,
+                                                ReaderType::READER_QUERY);
+    auto dt = std::make_shared<DataTypeInt64>();
+    // 1. 空选择器
+    std::vector<uint16_t> selector_empty = {};
+    filterBySelectorAssert(ptr->get_ptr(), selector_empty, *dt, 
col_int->get_ptr(), 0);
+
+    // 2. 全选
+    std::vector<uint16_t> selector_all = {1, 1, 1, 1, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_all, *dt, 
col_int->get_ptr(), 0);
+
+    // 3. 全不选
+    std::vector<uint16_t> select_none = {0, 0, 0, 0, 0};
+    filterBySelectorAssert(ptr->get_ptr(), select_none, *dt, 
col_int->get_ptr(), 0);
+
+    // 4. 部分选择
+    std::vector<uint16_t> selector_partial = {1, 0, 1, 0, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_partial, *dt, 
col_int->get_ptr(), 0);
+
+    // 5. 选择器长度
+    // 不匹配
+    std::vector<uint16_t> selector_invalid = {1, 1, 1, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_invalid, *dt, 
col_int->get_ptr(), 0);
+}
+
+TEST_F(CommonColumnTest, Permute) {
+    // 1. generate same rows of columns
+    auto columnInt64ValueGetter = [](size_t range_index, size_t 
index_in_range) {
+        return Field(static_cast<Int64>(range_index * index_in_range));
+    };
+
+    auto columnFloat64ValueGetter = [](size_t range_index, size_t 
index_in_range) -> Field {
+        if (range_index % 2 == 0 && index_in_range % 4 == 0) {
+            // quiet_NaN 初始化浮点数,以表明该值当前无效或者尚未定义,
+            // 并且不会在传递该值时触发错误。程序可以在之后检查这些值是否为 NaN 来决定下一步的操作。
+            return std::numeric_limits<Float64>::quiet_NaN();
+        } else if (range_index % 2 == 0 && index_in_range % 5 == 0) {
+            // 负无穷大
+            return -std::numeric_limits<Float64>::infinity();
+        } else if (range_index % 2 == 0 && index_in_range % 6 == 0) {
+            // 正无穷大
+            return std::numeric_limits<Float64>::infinity();
+        }
+        Float64 value = static_cast<Float64>(range_index * index_in_range);
+        return Field(value);
+    };
+
+    auto columnDecimal64ValueGetter = [](size_t range_index, size_t 
index_in_range) -> Field {
+        Decimal64 val = static_cast<Decimal64>(range_index * index_in_range);
+        return DecimalField(val, 2);
+    };
+
+    auto columnStringGetter = [](size_t range_index, size_t index_in_range) -> 
Field {
+        return Field(std::to_string(range_index * index_in_range));
+    };
+    ColumnString::MutablePtr col_s = ColumnString::create();
+    ColumnInt64::MutablePtr col_i = ColumnInt64::create();
+    ColumnFloat64::MutablePtr col_f = ColumnFloat64::create();
+    ColumnDecimal64::MutablePtr col_d = ColumnDecimal64::create(0, 2);
+    MutableColumns columns;
+    columns.emplace_back(col_s->get_ptr());
+    columns.emplace_back(col_i->get_ptr());
+    columns.emplace_back(col_f->get_ptr());
+    columns.emplace_back(col_d->get_ptr());
+
+    vectorized::IColumn::Permutation permutation;
+
+    size_t num_rows = 10;
+    for (size_t i = 0; i < num_rows; ++i) permutation.emplace_back(num_rows - 
1 - i);
+
+    std::cout << "permutation size:" << permutation.size() << std::endl;
+
+    std::vector<std::vector<Field>> ranges(num_rows);
+    generateRanges(ranges, num_rows, columnStringGetter);

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
   rows; ++i) { permutation.emplace_back(num_rows - 1 - i);
   }
   ```
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>

Review Comment:
   warning: 'gtest/gtest-message.h' file not found [clang-diagnostic-error]
   ```cpp
   #include <gtest/gtest-message.h>
            ^
   ```
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,

Review Comment:
   warning: function 'checkColumn' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
            ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/vec/columns/common_column_test.h:94:** 118 lines including 
whitespace and comments (threshold 80)
   ```cpp
       void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
            ^
   ```
   
   </details>
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:

Review Comment:
   warning: redundant access specifier has the same accessibility as the 
previous access specifier [readability-redundant-access-specifiers]
   
   ```suggestion
   
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/vec/columns/common_column_test.h:44:** previously declared here
   ```cpp
   public:
   ^
   ```
   
   </details>
   



##########
be/test/vec/columns/common_column_test.cpp:
##########
@@ -0,0 +1,153 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "vec/columns/common_column_test.h"
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+namespace doris::vectorized {
+
+// MOCK SITUATION TEST -- here ut will test the common column function for 
column type, this function called in mocked situation to test multiple column 
type.
+TEST_F(CommonColumnTest, SeDeserializeWithArena) {
+    MutableColumns columns(4);
+    columns[0] = col_str->clone();
+    columns[1] = col_int->clone();
+    columns[2] = col_arr->clone();
+    columns[3] = col_map->clone();
+    DataTypes data_types = {std::make_shared<DataTypeString>(), 
std::make_shared<DataTypeInt64>(),
+                            
std::make_shared<DataTypeArray>(std::make_shared<DataTypeInt64>()),
+                            
std::make_shared<DataTypeMap>(std::make_shared<DataTypeString>(),
+                                                          
std::make_shared<DataTypeInt64>())};
+    ser_deserialize_with_arena_impl(columns, data_types);
+}
+
+TEST_F(CommonColumnTest, SeDeserializeVec) {
+    MutableColumns columns(2);
+    columns[0] = col_str->clone();
+    columns[1] = col_int->clone();
+    // array | map | struct get_max_row_byte_size does not implement
+    //    columns[2] = col_arr->clone();
+    //    columns[3] = col_map->clone();
+    ser_deser_vec(columns, {std::make_shared<DataTypeString>(), 
std::make_shared<DataTypeInt64>()});
+}
+
+TEST_F(CommonColumnTest, FilterBySelector) {
+    // make a PredictColumn
+    auto ptr = 
Schema::get_predicate_column_ptr(FieldType::OLAP_FIELD_TYPE_BIGINT, false,
+                                                ReaderType::READER_QUERY);
+    auto dt = std::make_shared<DataTypeInt64>();
+    // 1. 空选择器
+    std::vector<uint16_t> selector_empty = {};
+    filterBySelectorAssert(ptr->get_ptr(), selector_empty, *dt, 
col_int->get_ptr(), 0);
+
+    // 2. 全选
+    std::vector<uint16_t> selector_all = {1, 1, 1, 1, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_all, *dt, 
col_int->get_ptr(), 0);
+
+    // 3. 全不选
+    std::vector<uint16_t> select_none = {0, 0, 0, 0, 0};
+    filterBySelectorAssert(ptr->get_ptr(), select_none, *dt, 
col_int->get_ptr(), 0);
+
+    // 4. 部分选择
+    std::vector<uint16_t> selector_partial = {1, 0, 1, 0, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_partial, *dt, 
col_int->get_ptr(), 0);
+
+    // 5. 选择器长度
+    // 不匹配
+    std::vector<uint16_t> selector_invalid = {1, 1, 1, 1};
+    filterBySelectorAssert(ptr->get_ptr(), selector_invalid, *dt, 
col_int->get_ptr(), 0);
+}
+
+TEST_F(CommonColumnTest, Permute) {
+    // 1. generate same rows of columns
+    auto columnInt64ValueGetter = [](size_t range_index, size_t 
index_in_range) {
+        return Field(static_cast<Int64>(range_index * index_in_range));
+    };
+
+    auto columnFloat64ValueGetter = [](size_t range_index, size_t 
index_in_range) -> Field {
+        if (range_index % 2 == 0 && index_in_range % 4 == 0) {
+            // quiet_NaN 初始化浮点数,以表明该值当前无效或者尚未定义,
+            // 并且不会在传递该值时触发错误。程序可以在之后检查这些值是否为 NaN 来决定下一步的操作。
+            return std::numeric_limits<Float64>::quiet_NaN();
+        } else if (range_index % 2 == 0 && index_in_range % 5 == 0) {
+            // 负无穷大
+            return -std::numeric_limits<Float64>::infinity();
+        } else if (range_index % 2 == 0 && index_in_range % 6 == 0) {
+            // 正无穷大
+            return std::numeric_limits<Float64>::infinity();
+        }
+        Float64 value = static_cast<Float64>(range_index * index_in_range);
+        return Field(value);
+    };
+
+    auto columnDecimal64ValueGetter = [](size_t range_index, size_t 
index_in_range) -> Field {
+        Decimal64 val = static_cast<Decimal64>(range_index * index_in_range);
+        return DecimalField(val, 2);
+    };
+
+    auto columnStringGetter = [](size_t range_index, size_t index_in_range) -> 
Field {
+        return Field(std::to_string(range_index * index_in_range));
+    };
+    ColumnString::MutablePtr col_s = ColumnString::create();
+    ColumnInt64::MutablePtr col_i = ColumnInt64::create();
+    ColumnFloat64::MutablePtr col_f = ColumnFloat64::create();
+    ColumnDecimal64::MutablePtr col_d = ColumnDecimal64::create(0, 2);
+    MutableColumns columns;
+    columns.emplace_back(col_s->get_ptr());
+    columns.emplace_back(col_i->get_ptr());
+    columns.emplace_back(col_f->get_ptr());
+    columns.emplace_back(col_d->get_ptr());
+
+    vectorized::IColumn::Permutation permutation;
+
+    size_t num_rows = 10;
+    for (size_t i = 0; i < num_rows; ++i) permutation.emplace_back(num_rows - 
1 - i);
+
+    std::cout << "permutation size:" << permutation.size() << std::endl;
+
+    std::vector<std::vector<Field>> ranges(num_rows);
+    generateRanges(ranges, num_rows, columnStringGetter);
+    insertRangesIntoColumn(ranges, permutation, *col_s);
+    generateRanges(ranges, num_rows, columnInt64ValueGetter);
+    insertRangesIntoColumn(ranges, permutation, *col_i);
+    generateRanges(ranges, num_rows, columnFloat64ValueGetter);
+    insertRangesIntoColumn(ranges, permutation, *col_f);
+    generateRanges(ranges, num_rows, columnDecimal64ValueGetter);
+    insertRangesIntoColumn(ranges, permutation, *col_d);
+    assertPermute(columns, permutation, num_rows);
+}
+
+TEST_F(CommonColumnTest, SortColumnDescription) {
+    ColumnString::MutablePtr col_s = ColumnString::create();
+
+    auto columnStringGetter = [](size_t range_index, size_t index_in_range) -> 
Field {
+        return Field(std::to_string(range_index * index_in_range));
+    };
+    size_t num_rows = 10;
+    std::vector<std::vector<Field>> ranges(num_rows);
+    IColumn::Permutation permutation;
+
+    for (size_t i = 0; i < num_rows; ++i) permutation.emplace_back(num_rows - 
1 - i);
+    generateRanges(ranges, num_rows, columnStringGetter);
+    insertRangesIntoColumn(ranges, permutation, *col_s);
+
+    assertSortColumn(*col_s, permutation, num_rows);

Review Comment:
   warning: statement should be inside braces 
[readability-braces-around-statements]
   
   ```suggestion
   = 0; i < num_rows; ++i) { permutation.emplace_back(num_rows - 1 - i);
   ```
   
   be/test/vec/columns/common_column_test.cpp:152:
   ```diff
   - s - 1 - i);
   + s - 1 - i);
   + }
   ```
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
+                     size_t column_size) {
+        if (WhichDataType(dataType).is_map()) {
+            auto map1 = check_and_get_column<ColumnMap>(col1);
+            auto map2 = check_and_get_column<ColumnMap>(col2);
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);
+            checkColumn(map1->get_keys(), map2->get_keys(), 
*rhs_map.get_key_type(),
+                        map1->get_keys().size());
+            checkColumn(map2->get_values(), map2->get_values(), 
*rhs_map.get_value_type(),
+                        map1->get_values().size());
+        } else {
+            if (WhichDataType(dataType).is_int8()) {
+                auto c1 = check_and_get_column<ColumnInt8>(col1);
+                auto c2 = check_and_get_column<ColumnInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int16()) {
+                auto c1 = check_and_get_column<ColumnInt16>(col1);
+                auto c2 = check_and_get_column<ColumnInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int32()) {
+                auto c1 = check_and_get_column<ColumnInt32>(col1);
+                auto c2 = check_and_get_column<ColumnInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int64()) {
+                auto c1 = check_and_get_column<ColumnInt64>(col1);
+                auto c2 = check_and_get_column<ColumnInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int128()) {
+                auto c1 = check_and_get_column<ColumnInt128>(col1);
+                auto c2 = check_and_get_column<ColumnInt128>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float32()) {
+                auto c1 = check_and_get_column<ColumnFloat32>(col1);
+                auto c2 = check_and_get_column<ColumnFloat32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float64()) {
+                auto c1 = check_and_get_column<ColumnFloat64>(col1);
+                auto c2 = check_and_get_column<ColumnFloat64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint8()) {
+                auto c1 = check_and_get_column<ColumnUInt8>(col1);
+                auto c2 = check_and_get_column<ColumnUInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint16()) {
+                auto c1 = check_and_get_column<ColumnUInt16>(col1);
+                auto c2 = check_and_get_column<ColumnUInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint32()) {
+                auto c1 = check_and_get_column<ColumnUInt32>(col1);
+                auto c2 = check_and_get_column<ColumnUInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint64()) {
+                auto c1 = check_and_get_column<ColumnUInt64>(col1);
+                auto c2 = check_and_get_column<ColumnUInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal32()) {
+                auto c1 = check_and_get_column<ColumnDecimal32>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal64()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v2()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V2>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V2>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v3()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V3>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V3>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal256()) {
+                auto c1 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                auto c2 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else {
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(col1.get_data_at(i), col2.get_data_at(i));
+                }
+            }
+        }
+    }
+
+    void printColumn(const IColumn& column, const IDataType& dataType) {

Review Comment:
   warning: function 'printColumn' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       void printColumn(const IColumn& column, const IDataType& dataType) {
            ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/vec/columns/common_column_test.h:215:** 135 lines including 
whitespace and comments (threshold 80)
   ```cpp
       void printColumn(const IColumn& column, const IDataType& dataType) {
            ^
   ```
   
   </details>
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
+                     size_t column_size) {
+        if (WhichDataType(dataType).is_map()) {
+            auto map1 = check_and_get_column<ColumnMap>(col1);
+            auto map2 = check_and_get_column<ColumnMap>(col2);
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);

Review Comment:
   warning: use auto when initializing with a cast to avoid duplicating the 
type name [modernize-use-auto]
   
   ```suggestion
               const auto& rhs_map = static_cast<const DataTypeMap&>(dataType);
   ```
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,

Review Comment:
   warning: function 'checkColumn' has cognitive complexity of 75 (threshold 
50) [readability-function-cognitive-complexity]
   ```cpp
       void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
            ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/vec/columns/common_column_test.h:96:** +1, including nesting 
penalty of 0, nesting level increased to 1
   ```cpp
           if (WhichDataType(dataType).is_map()) {
           ^
   ```
   **be/test/vec/columns/common_column_test.h:104:** +1, nesting level 
increased to 1
   ```cpp
           } else {
             ^
   ```
   **be/test/vec/columns/common_column_test.h:105:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (WhichDataType(dataType).is_int8()) {
               ^
   ```
   **be/test/vec/columns/common_column_test.h:108:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:111:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int16()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:114:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:117:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:120:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:123:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:126:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:129:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int128()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:132:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:135:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_float32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:138:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:141:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_float64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:144:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:147:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint8()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:150:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:153:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint16()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:156:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:159:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:162:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:165:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:168:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:171:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:174:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:177:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:180:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:183:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:186:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:189:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal128v2()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:192:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:195:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal128v3()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:198:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:201:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal256()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:204:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:207:** +1, nesting level 
increased to 2
   ```cpp
               } else {
                 ^
   ```
   **be/test/vec/columns/common_column_test.h:208:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   
   </details>
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
+                     size_t column_size) {
+        if (WhichDataType(dataType).is_map()) {
+            auto map1 = check_and_get_column<ColumnMap>(col1);
+            auto map2 = check_and_get_column<ColumnMap>(col2);
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);
+            checkColumn(map1->get_keys(), map2->get_keys(), 
*rhs_map.get_key_type(),
+                        map1->get_keys().size());
+            checkColumn(map2->get_values(), map2->get_values(), 
*rhs_map.get_value_type(),
+                        map1->get_values().size());
+        } else {
+            if (WhichDataType(dataType).is_int8()) {
+                auto c1 = check_and_get_column<ColumnInt8>(col1);
+                auto c2 = check_and_get_column<ColumnInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int16()) {
+                auto c1 = check_and_get_column<ColumnInt16>(col1);
+                auto c2 = check_and_get_column<ColumnInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int32()) {
+                auto c1 = check_and_get_column<ColumnInt32>(col1);
+                auto c2 = check_and_get_column<ColumnInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int64()) {
+                auto c1 = check_and_get_column<ColumnInt64>(col1);
+                auto c2 = check_and_get_column<ColumnInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int128()) {
+                auto c1 = check_and_get_column<ColumnInt128>(col1);
+                auto c2 = check_and_get_column<ColumnInt128>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float32()) {
+                auto c1 = check_and_get_column<ColumnFloat32>(col1);
+                auto c2 = check_and_get_column<ColumnFloat32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float64()) {
+                auto c1 = check_and_get_column<ColumnFloat64>(col1);
+                auto c2 = check_and_get_column<ColumnFloat64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint8()) {
+                auto c1 = check_and_get_column<ColumnUInt8>(col1);
+                auto c2 = check_and_get_column<ColumnUInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint16()) {
+                auto c1 = check_and_get_column<ColumnUInt16>(col1);
+                auto c2 = check_and_get_column<ColumnUInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint32()) {
+                auto c1 = check_and_get_column<ColumnUInt32>(col1);
+                auto c2 = check_and_get_column<ColumnUInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint64()) {
+                auto c1 = check_and_get_column<ColumnUInt64>(col1);
+                auto c2 = check_and_get_column<ColumnUInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal32()) {
+                auto c1 = check_and_get_column<ColumnDecimal32>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal64()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v2()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V2>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V2>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v3()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V3>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V3>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal256()) {
+                auto c1 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                auto c2 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else {
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(col1.get_data_at(i), col2.get_data_at(i));
+                }
+            }
+        }
+    }
+
+    void printColumn(const IColumn& column, const IDataType& dataType) {

Review Comment:
   warning: function 'printColumn' has cognitive complexity of 96 (threshold 
50) [readability-function-cognitive-complexity]
   ```cpp
       void printColumn(const IColumn& column, const IDataType& dataType) {
            ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/vec/columns/common_column_test.h:217:** +1, including nesting 
penalty of 0, nesting level increased to 1
   ```cpp
           if (WhichDataType(dataType).is_map()) {
           ^
   ```
   **be/test/vec/columns/common_column_test.h:223:** +1, nesting level 
increased to 1
   ```cpp
           } else if (WhichDataType(dataType).is_array()) {
                  ^
   ```
   **be/test/vec/columns/common_column_test.h:228:** +1, nesting level 
increased to 1
   ```cpp
           } else {
             ^
   ```
   **be/test/vec/columns/common_column_test.h:231:** +2, including nesting 
penalty of 1, nesting level increased to 2
   ```cpp
               if (WhichDataType(dataType).is_int8()) {
               ^
   ```
   **be/test/vec/columns/common_column_test.h:233:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:236:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int16()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:238:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:241:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:243:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:246:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:248:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:251:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_int128()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:253:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:256:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_float32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:258:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:261:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_float64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:263:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:266:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint8()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:268:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:271:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint16()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:273:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:276:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:278:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:281:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:283:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:286:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_uint128()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:288:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:291:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:293:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:296:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal32()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:298:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:301:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal64()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:303:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:306:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal128v2()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:308:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:311:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal128v3()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:313:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:316:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_decimal256()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:318:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:321:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_date()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:323:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:326:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_date_time()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:328:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:331:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_date_v2()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:333:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:336:** +1, nesting level 
increased to 2
   ```cpp
               } else if (WhichDataType(dataType).is_date_time_v2()) {
                      ^
   ```
   **be/test/vec/columns/common_column_test.h:338:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   **be/test/vec/columns/common_column_test.h:341:** +1, nesting level 
increased to 2
   ```cpp
               } else {
                 ^
   ```
   **be/test/vec/columns/common_column_test.h:344:** +3, including nesting 
penalty of 2, nesting level increased to 3
   ```cpp
                   for (size_t i = 0; i < column_size; ++i) {
                   ^
   ```
   
   </details>
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
+                     size_t column_size) {
+        if (WhichDataType(dataType).is_map()) {
+            auto map1 = check_and_get_column<ColumnMap>(col1);
+            auto map2 = check_and_get_column<ColumnMap>(col2);
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);
+            checkColumn(map1->get_keys(), map2->get_keys(), 
*rhs_map.get_key_type(),
+                        map1->get_keys().size());
+            checkColumn(map2->get_values(), map2->get_values(), 
*rhs_map.get_value_type(),
+                        map1->get_values().size());
+        } else {
+            if (WhichDataType(dataType).is_int8()) {
+                auto c1 = check_and_get_column<ColumnInt8>(col1);
+                auto c2 = check_and_get_column<ColumnInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int16()) {
+                auto c1 = check_and_get_column<ColumnInt16>(col1);
+                auto c2 = check_and_get_column<ColumnInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int32()) {
+                auto c1 = check_and_get_column<ColumnInt32>(col1);
+                auto c2 = check_and_get_column<ColumnInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int64()) {
+                auto c1 = check_and_get_column<ColumnInt64>(col1);
+                auto c2 = check_and_get_column<ColumnInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int128()) {
+                auto c1 = check_and_get_column<ColumnInt128>(col1);
+                auto c2 = check_and_get_column<ColumnInt128>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float32()) {
+                auto c1 = check_and_get_column<ColumnFloat32>(col1);
+                auto c2 = check_and_get_column<ColumnFloat32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float64()) {
+                auto c1 = check_and_get_column<ColumnFloat64>(col1);
+                auto c2 = check_and_get_column<ColumnFloat64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint8()) {
+                auto c1 = check_and_get_column<ColumnUInt8>(col1);
+                auto c2 = check_and_get_column<ColumnUInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint16()) {
+                auto c1 = check_and_get_column<ColumnUInt16>(col1);
+                auto c2 = check_and_get_column<ColumnUInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint32()) {
+                auto c1 = check_and_get_column<ColumnUInt32>(col1);
+                auto c2 = check_and_get_column<ColumnUInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint64()) {
+                auto c1 = check_and_get_column<ColumnUInt64>(col1);
+                auto c2 = check_and_get_column<ColumnUInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal32()) {
+                auto c1 = check_and_get_column<ColumnDecimal32>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal64()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v2()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V2>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V2>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v3()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V3>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V3>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal256()) {
+                auto c1 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                auto c2 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else {
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(col1.get_data_at(i), col2.get_data_at(i));
+                }
+            }
+        }
+    }
+
+    void printColumn(const IColumn& column, const IDataType& dataType) {
+        std::cout << "column total size: " << column.size() << std::endl;
+        if (WhichDataType(dataType).is_map()) {
+            auto map = check_and_get_column<ColumnMap>(column);
+            std::cout << "map {keys, values}" << std::endl;
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);
+            printColumn(map->get_keys(), *rhs_map.get_key_type());
+            printColumn(map->get_values(), *rhs_map.get_value_type());
+        } else if (WhichDataType(dataType).is_array()) {
+            auto array = check_and_get_column<ColumnArray>(column);
+            std::cout << "array: " << std::endl;
+            const DataTypeArray& rhs_array = static_cast<const 
DataTypeArray&>(dataType);

Review Comment:
   warning: use auto when initializing with a cast to avoid duplicating the 
type name [modernize-use-auto]
   
   ```suggestion
               const auto& rhs_array = static_cast<const 
DataTypeArray&>(dataType);
   ```
   



##########
be/test/vec/columns/common_column_test.h:
##########
@@ -0,0 +1,770 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <gtest/gtest.h>
+
+#include "olap/schema.h"
+#include "vec/columns/column.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_map.h"
+#include "vec/columns/columns_number.h"
+#include "vec/core/field.h"
+#include "vec/core/sort_block.h"
+#include "vec/core/sort_description.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_map.h"
+#include "vec/data_types/data_type_number.h"
+#include "vec/data_types/data_type_string.h"
+
+// this test is gonna to be a column test template for all column which should 
make ut test to coverage the function defined in column
+// for example column_array should test this function:
+// size, reserve, resize, empty, byte_size, allocated_bytes, clone_resized,
+// get_shrinked_column, filter, filter_by_selector, serialize_vec, 
deserialize_vec, get_max_row_byte_size
+//
+namespace doris::vectorized {
+
+class CommonColumnTest : public ::testing::Test {
+public:
+    void SetUp() override {
+        col_str = ColumnString::create();
+        col_str->insert_data("aaa", 3);
+        col_str->insert_data("bb", 2);
+        col_str->insert_data("cccc", 4);
+
+        col_int = ColumnInt64::create();
+        col_int->insert_value(1);
+        col_int->insert_value(2);
+        col_int->insert_value(3);
+
+        col_dcm = ColumnDecimal64::create(0, 3);
+        col_dcm->insert_value(1.23);
+        col_dcm->insert_value(4.56);
+        col_dcm->insert_value(7.89);
+
+        col_arr = ColumnArray::create(ColumnInt64::create(), 
ColumnArray::ColumnOffsets::create());
+        Array array1 = {1, 2, 3};
+        Array array2 = {4};
+        col_arr->insert(array1);
+        col_arr->insert(Array());
+        col_arr->insert(array2);
+
+        col_map = ColumnMap::create(ColumnString::create(), 
ColumnInt64::create(),
+                                    ColumnArray::ColumnOffsets::create());
+        Array k1 = {"a", "b", "c"};
+        Array v1 = {1, 2, 3};
+        Array k2 = {"d"};
+        Array v2 = {4};
+        Array a = Array();
+        Map map1, map2, map3;
+        map1.push_back(k1);
+        map1.push_back(v1);
+        col_map->insert(map1);
+        map3.push_back(a);
+        map3.push_back(a);
+        col_map->insert(map3);
+        map2.push_back(k2);
+        map2.push_back(v2);
+        col_map->insert(map2);
+    }
+
+public:
+    ColumnString::MutablePtr col_str;
+    ColumnInt64::MutablePtr col_int;
+    ColumnDecimal64::MutablePtr col_dcm;
+    ColumnArray::MutablePtr col_arr;
+    ColumnMap::MutablePtr col_map;
+
+    void checkColumn(const IColumn& col1, const IColumn& col2, const 
IDataType& dataType,
+                     size_t column_size) {
+        if (WhichDataType(dataType).is_map()) {
+            auto map1 = check_and_get_column<ColumnMap>(col1);
+            auto map2 = check_and_get_column<ColumnMap>(col2);
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);
+            checkColumn(map1->get_keys(), map2->get_keys(), 
*rhs_map.get_key_type(),
+                        map1->get_keys().size());
+            checkColumn(map2->get_values(), map2->get_values(), 
*rhs_map.get_value_type(),
+                        map1->get_values().size());
+        } else {
+            if (WhichDataType(dataType).is_int8()) {
+                auto c1 = check_and_get_column<ColumnInt8>(col1);
+                auto c2 = check_and_get_column<ColumnInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int16()) {
+                auto c1 = check_and_get_column<ColumnInt16>(col1);
+                auto c2 = check_and_get_column<ColumnInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int32()) {
+                auto c1 = check_and_get_column<ColumnInt32>(col1);
+                auto c2 = check_and_get_column<ColumnInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int64()) {
+                auto c1 = check_and_get_column<ColumnInt64>(col1);
+                auto c2 = check_and_get_column<ColumnInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_int128()) {
+                auto c1 = check_and_get_column<ColumnInt128>(col1);
+                auto c2 = check_and_get_column<ColumnInt128>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float32()) {
+                auto c1 = check_and_get_column<ColumnFloat32>(col1);
+                auto c2 = check_and_get_column<ColumnFloat32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_float64()) {
+                auto c1 = check_and_get_column<ColumnFloat64>(col1);
+                auto c2 = check_and_get_column<ColumnFloat64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint8()) {
+                auto c1 = check_and_get_column<ColumnUInt8>(col1);
+                auto c2 = check_and_get_column<ColumnUInt8>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint16()) {
+                auto c1 = check_and_get_column<ColumnUInt16>(col1);
+                auto c2 = check_and_get_column<ColumnUInt16>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint32()) {
+                auto c1 = check_and_get_column<ColumnUInt32>(col1);
+                auto c2 = check_and_get_column<ColumnUInt32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_uint64()) {
+                auto c1 = check_and_get_column<ColumnUInt64>(col1);
+                auto c2 = check_and_get_column<ColumnUInt64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal32()) {
+                auto c1 = check_and_get_column<ColumnDecimal32>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal32>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal64()) {
+                auto c1 = check_and_get_column<ColumnDecimal64>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal64>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v2()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V2>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V2>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal128v3()) {
+                auto c1 = check_and_get_column<ColumnDecimal128V3>(col1);
+                auto c2 = check_and_get_column<ColumnDecimal128V3>(col2);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else if (WhichDataType(dataType).is_decimal256()) {
+                auto c1 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                auto c2 = 
check_and_get_column<ColumnDecimal<Decimal256>>(col1);
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(c1->get_element(i), c2->get_element(i));
+                }
+            } else {
+                for (size_t i = 0; i < column_size; ++i) {
+                    EXPECT_EQ(col1.get_data_at(i), col2.get_data_at(i));
+                }
+            }
+        }
+    }
+
+    void printColumn(const IColumn& column, const IDataType& dataType) {
+        std::cout << "column total size: " << column.size() << std::endl;
+        if (WhichDataType(dataType).is_map()) {
+            auto map = check_and_get_column<ColumnMap>(column);
+            std::cout << "map {keys, values}" << std::endl;
+            const DataTypeMap& rhs_map = static_cast<const 
DataTypeMap&>(dataType);

Review Comment:
   warning: use auto when initializing with a cast to avoid duplicating the 
type name [modernize-use-auto]
   
   ```suggestion
               const auto& rhs_map = static_cast<const DataTypeMap&>(dataType);
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org


Reply via email to