csun5285 commented on code in PR #66472:
URL: https://github.com/apache/doris/pull/66472#discussion_r3763302954
##########
be/src/storage/schema.cpp:
##########
@@ -17,90 +17,143 @@
#include "storage/schema.h"
-#include <glog/logging.h>
-
-#include <boost/iterator/iterator_facade.hpp>
-#include <ostream>
-#include <unordered_set>
#include <utility>
#include "common/config.h"
-#include "core/column/column_array.h"
-#include "core/column/column_decimal.h"
+#include "common/logging.h"
+#include "core/block/block.h"
#include "core/column/column_dictionary.h"
-#include "core/column/column_map.h"
+#include "core/column/column_nothing.h"
#include "core/column/column_nullable.h"
-#include "core/column/column_string.h"
-#include "core/column/column_struct.h"
-#include "core/column/column_vector.h"
-#include "core/data_type/data_type.h"
-#include "core/data_type/data_type_factory.hpp"
-#include "core/data_type/define_primitive_type.h"
-#include "core/types.h"
-#include "storage/olap_common.h"
-#include "util/trace.h"
+#include "storage/binlog.h"
namespace doris {
-Schema::Schema(const Schema& other) {
- _copy_from(other);
+ReadSchema::ReadSchema(std::vector<TabletColumnPtr> columns)
+ : _read_columns(std::move(columns)),
_num_block_columns(_read_columns.size()) {
+ _init_read_types();
+ _init_descriptors();
}
-Schema& Schema::operator=(const Schema& other) {
- if (this != &other) {
- _copy_from(other);
+ReadSchema::ReadSchema(const std::vector<TabletColumnPtr>& columns,
+ const std::vector<ColumnId>& cids)
+ : _num_block_columns(cids.size()) {
+ _read_columns.reserve(cids.size());
+ for (auto cid : cids) {
+ _read_columns.emplace_back(columns[cid]);
}
- return *this;
+ _init_read_types();
+ _init_descriptors();
+}
+
+ReadSchema::ReadSchema(std::vector<TabletColumnPtr> columns,
std::vector<DataTypePtr> read_types)
+ : _read_columns(std::move(columns)),
+ _read_types(std::move(read_types)),
+ _num_block_columns(_read_types.size()) {
+ _init_descriptors();
}
-void Schema::_copy_from(const Schema& other) {
- _col_ids = other._col_ids;
- _column_id_to_index = other._column_id_to_index;
- _num_key_columns = other._num_key_columns;
- _delete_sign_idx = other._delete_sign_idx;
- _has_sequence_col = other._has_sequence_col;
- _rowid_col_idx = other._rowid_col_idx;
- _version_col_idx = other._version_col_idx;
- _commit_tso_col_idx = other._commit_tso_col_idx;
- _tso_col_idx = other._tso_col_idx;
- _lsn_col_idx = other._lsn_col_idx;
- _op_col_idx = other._op_col_idx;
-
- _cols.resize(other._cols.size());
- for (auto cid : _col_ids) {
- _cols[cid] = other._cols[cid];
+void ReadSchema::_init_read_types() {
+ _read_types.reserve(_read_columns.size());
+ for (const auto& column : _read_columns) {
+ auto data_type = column->get_vec_type();
+ DORIS_CHECK(data_type != nullptr);
+ _read_types.emplace_back(std::move(data_type));
}
}
-void Schema::_init(const std::vector<TabletColumnPtr>& cols, const
std::vector<ColumnId>& col_ids,
- size_t num_key_columns) {
- _col_ids = col_ids;
- _num_key_columns = num_key_columns;
+void ReadSchema::_init_before_column_ordinals() {
Review Comment:
v1, v2, before_v1, before_v2 ,这里是在初始化 column 和before_column 之间的映射关系
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]