This is an automated email from the ASF dual-hosted git repository.
eldenmoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 925b7e70b82 [refactor](variant) remove unused function
`same_with_storage_type` (#57624)
925b7e70b82 is described below
commit 925b7e70b8250507426859ba7bd8f27306d342bb
Author: Sun Chenyang <[email protected]>
AuthorDate: Wed Nov 5 13:40:20 2025 +0800
[refactor](variant) remove unused function `same_with_storage_type` (#57624)
---
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 44081990751..d95d049c7cf 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -994,22 +994,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 6a88e2ff731..7a0ff550e0a 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 85b92a51e4d..3419e1d5e5c 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -2010,12 +2010,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 {}",
@@ -2446,11 +2446,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]