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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new a032979133f branch-4.0: [refactor](variant) remove unused function 
`same_with_storage_type` #57624 (#57718)
a032979133f is described below

commit a032979133f0be46ebf503f738349bedd40514d6
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Nov 6 10:54:37 2025 +0800

    branch-4.0: [refactor](variant) remove unused function 
`same_with_storage_type` #57624 (#57718)
    
    Cherry-picked from #57624
    
    Co-authored-by: Sun Chenyang <[email protected]>
---
 be/src/olap/rowset/segment_v2/segment.cpp          | 16 ----------------
 be/src/olap/rowset/segment_v2/segment.h            |  2 --
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 17 ++++++++---------
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment.cpp 
b/be/src/olap/rowset/segment_v2/segment.cpp
index 0e2f97a15da..885e581510f 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -985,22 +985,6 @@ Status Segment::read_key_by_rowid(uint32_t row_id, 
std::string* key) {
     return Status::OK();
 }
 
-bool Segment::same_with_storage_type(int32_t cid, const Schema& schema, bool 
read_flat_leaves) {
-    const auto* col = schema.column(cid);
-    auto file_column_type = get_data_type_of(col->get_desc(), 
read_flat_leaves);
-    auto expected_type = Schema::get_data_type_ptr(*col);
-#ifndef NDEBUG
-    if (file_column_type && !file_column_type->equals(*expected_type)) {
-        VLOG_DEBUG << fmt::format("Get column {}, file column type {}, 
exepected type {}",
-                                  col->name(), file_column_type->get_name(),
-                                  expected_type->get_name());
-    }
-#endif
-    bool same =
-            (!file_column_type) || (file_column_type && 
file_column_type->equals(*expected_type));
-    return same;
-}
-
 Status Segment::seek_and_read_by_rowid(const TabletSchema& schema, 
SlotDescriptor* slot,
                                        uint32_t row_id, 
vectorized::MutableColumnPtr& result,
                                        StorageReadOptions& 
storage_read_options,
diff --git a/be/src/olap/rowset/segment_v2/segment.h 
b/be/src/olap/rowset/segment_v2/segment.h
index b2e3e29ec6b..5f3c9f1f7e5 100644
--- a/be/src/olap/rowset/segment_v2/segment.h
+++ b/be/src/olap/rowset/segment_v2/segment.h
@@ -177,8 +177,6 @@ public:
     // nullptr will returned if storage type does not contains such column
     std::shared_ptr<const vectorized::IDataType> get_data_type_of(const 
TabletColumn& column,
                                                                   bool 
read_flat_leaves);
-    // Check is schema read type equals storage column type
-    bool same_with_storage_type(int32_t cid, const Schema& schema, bool 
read_flat_leaves);
 
     // If column in segment is the same type in schema, then it is safe to 
apply predicate
     bool can_apply_predicate_safely(
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index 40ac9397f6a..09438e87c81 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -1960,12 +1960,12 @@ Status SegmentIterator::_init_current_block(
     for (size_t i = 0; i < _schema->num_column_ids(); i++) {
         auto cid = _schema->column_id(i);
         const auto* column_desc = _schema->column(cid);
-        if (!_is_pred_column[cid] &&
-            !_segment->same_with_storage_type(
-                    cid, *_schema, _opts.io_ctx.reader_type != 
ReaderType::READER_QUERY)) {
+
+        auto file_column_type = _storage_name_and_type[cid].second;
+        auto expected_type = Schema::get_data_type_ptr(*column_desc);
+        if (!_is_pred_column[cid] && 
!file_column_type->equals(*expected_type)) {
             // The storage layer type is different from schema needed type, so 
we use storage
             // type to read columns instead of schema type for safety
-            auto file_column_type = _storage_name_and_type[cid].second;
             VLOG_DEBUG << fmt::format(
                     "Recreate column with expected type {}, file column type 
{}, col_name {}, "
                     "col_path {}",
@@ -2378,11 +2378,10 @@ Status SegmentIterator::_convert_to_expected_type(const 
std::vector<ColumnId>& c
         if (!_current_return_columns[i] || _converted_column_ids[i] || 
_is_pred_column[i]) {
             continue;
         }
-        if (!_segment->same_with_storage_type(
-                    i, *_schema, _opts.io_ctx.reader_type != 
ReaderType::READER_QUERY)) {
-            const Field* field_type = _schema->column(i);
-            vectorized::DataTypePtr expected_type = 
Schema::get_data_type_ptr(*field_type);
-            vectorized::DataTypePtr file_column_type = 
_storage_name_and_type[i].second;
+        const Field* field_type = _schema->column(i);
+        vectorized::DataTypePtr expected_type = 
Schema::get_data_type_ptr(*field_type);
+        vectorized::DataTypePtr file_column_type = 
_storage_name_and_type[i].second;
+        if (!file_column_type->equals(*expected_type)) {
             vectorized::ColumnPtr expected;
             vectorized::ColumnPtr original =
                     _current_return_columns[i]->assume_mutable()->get_ptr();


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

Reply via email to