This is an automated email from the ASF dual-hosted git repository. eldenmoon pushed a commit to branch cs_opt_version-3.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit bbf47af9df74881251123b2b5fbbd32134c184d6 Author: lihangyu <[email protected]> AuthorDate: Wed Nov 5 17:00:39 2025 +0800 [refactor](variant) remove unused function `same_with_storage_type` (#57730) cherry-pick #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 4fd5f2755f9..d3d368b8fa4 100644 --- a/be/src/olap/rowset/segment_v2/segment.cpp +++ b/be/src/olap/rowset/segment_v2/segment.cpp @@ -934,22 +934,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, OlapReaderStatistics& stats, diff --git a/be/src/olap/rowset/segment_v2/segment.h b/be/src/olap/rowset/segment_v2/segment.h index d6d516b83e8..be74c28f68b 100644 --- a/be/src/olap/rowset/segment_v2/segment.h +++ b/be/src/olap/rowset/segment_v2/segment.h @@ -179,8 +179,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 template <typename Predicate> diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp b/be/src/olap/rowset/segment_v2/segment_iterator.cpp index facfba00027..de9a6ba35a3 100644 --- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp +++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp @@ -1613,12 +1613,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 {}", @@ -1978,11 +1978,10 @@ Status SegmentIterator::_convert_to_expected_type(const std::vector<ColumnId>& c _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]
