eldenmoon commented on code in PR #26749: URL: https://github.com/apache/doris/pull/26749#discussion_r1393619371
########## be/src/olap/rowset/segment_v2/segment_iterator.cpp: ########## @@ -1891,6 +1960,49 @@ Status SegmentIterator::next_batch(vectorized::Block* block) { return status; } +Status SegmentIterator::_convert_to_expected_type(const std::vector<ColumnId>& col_ids) { + for (ColumnId i : col_ids) { + if (_current_return_columns[i] == nullptr || _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; + vectorized::ColumnPtr expected; + vectorized::ColumnPtr original = + _current_return_columns[i]->assume_mutable()->get_ptr(); + RETURN_IF_ERROR(vectorized::schema_util::cast_column({original, file_column_type, ""}, + expected_type, &expected)); + _current_return_columns[i] = expected->assume_mutable(); + _converted_column_ids[i] = 1; + VLOG_DEBUG << fmt::format("Convert {} fom file column type {} to {}, num_rows {}", + field_type->path().get_path(), file_column_type->get_name(), + expected_type->get_name(), + _current_return_columns[i]->size()); + } + } + return Status::OK(); +} + +Status SegmentIterator::copy_column_data_by_selector(vectorized::IColumn* input_col_ptr, + vectorized::MutableColumnPtr& output_col, Review Comment: The Block interface should remain oblivious to storage details, making the use of args within it somewhat peculiar. Considering that copy_column_data_to_block is exclusively utilized in the segment iterator, its removal might be a viable option -- 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