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

yiguolei pushed a commit to branch remove_is_decimal_v2
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 60a8ac3d7e6812139c8ce1d9eeeb66bf6749cf3f
Author: yiguolei <yiguo...@gmail.com>
AuthorDate: Sun Oct 8 12:08:43 2023 +0800

    [refactor](columndecimal) is_decimal_v2 member is useless because column 
decimal could detect by itself
---
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 2 --
 be/src/vec/columns/column.h                        | 3 ---
 be/src/vec/columns/column_decimal.cpp              | 5 +----
 be/src/vec/columns/column_nullable.h               | 2 --
 be/src/vec/data_types/data_type_decimal.cpp        | 1 -
 5 files changed, 1 insertion(+), 12 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 51f31010cb3..37d3e77a49f 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -1572,8 +1572,6 @@ void SegmentIterator::_init_current_block(
                 current_columns[cid]->set_date_type();
             } else if (column_desc->type() == 
FieldType::OLAP_FIELD_TYPE_DATETIME) {
                 current_columns[cid]->set_datetime_type();
-            } else if (column_desc->type() == 
FieldType::OLAP_FIELD_TYPE_DECIMAL) {
-                current_columns[cid]->set_decimalv2_type();
             }
             current_columns[cid]->reserve(_opts.block_row_max);
         }
diff --git a/be/src/vec/columns/column.h b/be/src/vec/columns/column.h
index 9a4793a76fc..5d54b9eac11 100644
--- a/be/src/vec/columns/column.h
+++ b/be/src/vec/columns/column.h
@@ -699,11 +699,9 @@ public:
 
     virtual bool is_date_type() const { return is_date; }
     virtual bool is_datetime_type() const { return is_date_time; }
-    virtual bool is_decimalv2_type() const { return is_decimalv2; }
 
     virtual void set_date_type() { is_date = true; }
     virtual void set_datetime_type() { is_date_time = true; }
-    virtual void set_decimalv2_type() { is_decimalv2 = true; }
 
     void copy_date_types(const IColumn& col) {
         if (col.is_date_type()) {
@@ -717,7 +715,6 @@ public:
     // todo(wb): a temporary implemention, need re-abstract here
     bool is_date = false;
     bool is_date_time = false;
-    bool is_decimalv2 = false;
 
 protected:
     /// Template is to devirtualize calls to insert_from method.
diff --git a/be/src/vec/columns/column_decimal.cpp 
b/be/src/vec/columns/column_decimal.cpp
index 7c9a8cf0849..01d8fcf0bb8 100644
--- a/be/src/vec/columns/column_decimal.cpp
+++ b/be/src/vec/columns/column_decimal.cpp
@@ -254,9 +254,6 @@ ColumnPtr ColumnDecimal<T>::permute(const 
IColumn::Permutation& perm, size_t lim
 template <typename T>
 MutableColumnPtr ColumnDecimal<T>::clone_resized(size_t size) const {
     auto res = this->create(0, scale);
-    if (this->is_decimalv2_type()) {
-        res->set_decimalv2_type();
-    }
 
     if (size > 0) {
         auto& new_col = assert_cast<Self&>(*res);
@@ -286,7 +283,7 @@ void ColumnDecimal<T>::insert_many_fix_len_data(const char* 
data_ptr, size_t num
     size_t old_size = data.size();
     data.resize(old_size + num);
 
-    if (this->is_decimalv2_type()) {
+    if constexpr (IsDecimalV2<T>) {
         DecimalV2Value* target = (DecimalV2Value*)(data.data() + old_size);
         for (int i = 0; i < num; i++) {
             const char* cur_ptr = data_ptr + sizeof(decimal12_t) * i;
diff --git a/be/src/vec/columns/column_nullable.h 
b/be/src/vec/columns/column_nullable.h
index dab4c66d63a..9ed0a8e9ad4 100644
--- a/be/src/vec/columns/column_nullable.h
+++ b/be/src/vec/columns/column_nullable.h
@@ -264,10 +264,8 @@ public:
 
     bool is_date_type() const override { return 
get_nested_column().is_date_type(); }
     bool is_datetime_type() const override { return 
get_nested_column().is_datetime_type(); }
-    bool is_decimalv2_type() const override { return 
get_nested_column().is_decimalv2_type(); }
     void set_date_type() override { get_nested_column().set_date_type(); }
     void set_datetime_type() override { 
get_nested_column().set_datetime_type(); }
-    void set_decimalv2_type() override { 
get_nested_column().set_decimalv2_type(); }
 
     bool is_nullable() const override { return true; }
     bool is_bitmap() const override { return get_nested_column().is_bitmap(); }
diff --git a/be/src/vec/data_types/data_type_decimal.cpp 
b/be/src/vec/data_types/data_type_decimal.cpp
index cfc62bfbc2d..2f71ee736c9 100644
--- a/be/src/vec/data_types/data_type_decimal.cpp
+++ b/be/src/vec/data_types/data_type_decimal.cpp
@@ -150,7 +150,6 @@ template <typename T>
 MutableColumnPtr DataTypeDecimal<T>::create_column() const {
     if constexpr (IsDecimalV2<T>) {
         auto col = ColumnDecimal128::create(0, scale);
-        col->set_decimalv2_type();
         return col;
     } else {
         return ColumnType::create(0, scale);


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

Reply via email to