31
31
#include " olap/schema_change.h"
32
32
#include " olap/storage_engine.h"
33
33
#include " olap/tablet.h"
34
+ #include " olap/tablet_schema.h"
34
35
#include " runtime/exec_env.h"
35
36
36
37
namespace doris {
@@ -115,7 +116,8 @@ Status PushHandler::_do_streaming_ingestion(TabletSharedPtr tablet, const TPushR
115
116
}
116
117
117
118
DeletePredicatePB del_pred;
118
- auto tablet_schema = tablet_var.tablet ->tablet_schema ();
119
+ TabletSchema tablet_schema;
120
+ tablet_schema.copy_from (*tablet_var.tablet ->tablet_schema ());
119
121
if (!request.columns_desc .empty () && request.columns_desc [0 ].col_unique_id >= 0 ) {
120
122
tablet_schema.clear_columns ();
121
123
for (const auto & column_desc : request.columns_desc ) {
@@ -141,25 +143,25 @@ Status PushHandler::_do_streaming_ingestion(TabletSharedPtr tablet, const TPushR
141
143
<< " . tablet: " << tablet_vars->at (0 ).tablet ->full_name ();
142
144
return Status::OLAPInternalError (OLAP_ERR_TOO_MANY_VERSION);
143
145
}
144
-
145
- auto tablet_schema = tablet_vars->at (0 ).tablet ->tablet_schema ();
146
+ auto tablet_schema = std::make_shared<TabletSchema>();
147
+ tablet_schema-> copy_from (* tablet_vars->at (0 ).tablet ->tablet_schema () );
146
148
if (!request.columns_desc .empty () && request.columns_desc [0 ].col_unique_id >= 0 ) {
147
- tablet_schema. clear_columns ();
149
+ tablet_schema-> clear_columns ();
148
150
for (const auto & column_desc : request.columns_desc ) {
149
- tablet_schema. append_column (TabletColumn (column_desc));
151
+ tablet_schema-> append_column (TabletColumn (column_desc));
150
152
}
151
153
}
152
154
153
155
// writes
154
156
if (push_type == PUSH_NORMAL_V2) {
155
157
res = _convert_v2 (tablet_vars->at (0 ).tablet , tablet_vars->at (1 ).tablet ,
156
158
&(tablet_vars->at (0 ).rowset_to_add ), &(tablet_vars->at (1 ).rowset_to_add ),
157
- & tablet_schema);
159
+ tablet_schema);
158
160
159
161
} else {
160
162
res = _convert (tablet_vars->at (0 ).tablet , tablet_vars->at (1 ).tablet ,
161
163
&(tablet_vars->at (0 ).rowset_to_add ), &(tablet_vars->at (1 ).rowset_to_add ),
162
- & tablet_schema);
164
+ tablet_schema);
163
165
}
164
166
if (!res.ok ()) {
165
167
LOG (WARNING) << " fail to convert tmp file when realtime push. res=" << res
@@ -219,7 +221,7 @@ void PushHandler::_get_tablet_infos(const std::vector<TabletVars>& tablet_vars,
219
221
220
222
Status PushHandler::_convert_v2 (TabletSharedPtr cur_tablet, TabletSharedPtr new_tablet,
221
223
RowsetSharedPtr* cur_rowset, RowsetSharedPtr* new_rowset,
222
- const TabletSchema* tablet_schema) {
224
+ TabletSchemaSPtr tablet_schema) {
223
225
Status res = Status::OK ();
224
226
uint32_t num_rows = 0 ;
225
227
PUniqueId load_id;
@@ -344,7 +346,7 @@ Status PushHandler::_convert_v2(TabletSharedPtr cur_tablet, TabletSharedPtr new_
344
346
345
347
Status PushHandler::_convert (TabletSharedPtr cur_tablet, TabletSharedPtr new_tablet,
346
348
RowsetSharedPtr* cur_rowset, RowsetSharedPtr* new_rowset,
347
- const TabletSchema* tablet_schema) {
349
+ TabletSchemaSPtr tablet_schema) {
348
350
Status res = Status::OK ();
349
351
RowCursor row;
350
352
BinaryFile raw_file;
@@ -515,7 +517,7 @@ IBinaryReader* IBinaryReader::create(bool need_decompress) {
515
517
516
518
BinaryReader::BinaryReader () : _row_buf(nullptr ), _row_buf_size(0 ) {}
517
519
518
- Status BinaryReader::init (const TabletSchema* tablet_schema, BinaryFile* file) {
520
+ Status BinaryReader::init (TabletSchemaSPtr tablet_schema, BinaryFile* file) {
519
521
Status res = Status::OK ();
520
522
521
523
do {
@@ -657,7 +659,7 @@ LzoBinaryReader::LzoBinaryReader()
657
659
_row_num(0 ),
658
660
_next_row_start(0 ) {}
659
661
660
- Status LzoBinaryReader::init (const TabletSchema* tablet_schema, BinaryFile* file) {
662
+ Status LzoBinaryReader::init (TabletSchemaSPtr tablet_schema, BinaryFile* file) {
661
663
Status res = Status::OK ();
662
664
663
665
do {
0 commit comments