@@ -53,6 +53,7 @@ OlapScanner::OlapScanner(RuntimeState* runtime_state, OlapScanNode* parent, bool
53
53
_need_agg_finalize(need_agg_finalize),
54
54
_version(-1 ) {
55
55
_mem_tracker = tracker;
56
+ _tablet_schema = std::make_shared<TabletSchema>();
56
57
}
57
58
58
59
Status OlapScanner::prepare (
@@ -79,12 +80,12 @@ Status OlapScanner::prepare(
79
80
LOG (WARNING) << ss.str ();
80
81
return Status::InternalError (ss.str ());
81
82
}
82
- _tablet_schema. copy_from (*_tablet->tablet_schema ());
83
+ _tablet_schema-> copy_from (*_tablet->tablet_schema ());
83
84
if (!_parent->_olap_scan_node .columns_desc .empty () &&
84
85
_parent->_olap_scan_node .columns_desc [0 ].col_unique_id >= 0 ) {
85
- _tablet_schema. clear_columns ();
86
+ _tablet_schema-> clear_columns ();
86
87
for (const auto & column_desc : _parent->_olap_scan_node .columns_desc ) {
87
- _tablet_schema. append_column (TabletColumn (column_desc));
88
+ _tablet_schema-> append_column (TabletColumn (column_desc));
88
89
}
89
90
}
90
91
{
@@ -189,7 +190,7 @@ Status OlapScanner::_init_tablet_reader_params(
189
190
RETURN_IF_ERROR (_init_return_columns (!_tablet_reader_params.direct_mode ));
190
191
191
192
_tablet_reader_params.tablet = _tablet;
192
- _tablet_reader_params.tablet_schema = & _tablet_schema;
193
+ _tablet_reader_params.tablet_schema = _tablet_schema;
193
194
_tablet_reader_params.reader_type = READER_QUERY;
194
195
_tablet_reader_params.aggregation = _aggregation;
195
196
_tablet_reader_params.version = Version (0 , _version);
@@ -234,7 +235,7 @@ Status OlapScanner::_init_tablet_reader_params(
234
235
_tablet_reader_params.return_columns .push_back (i);
235
236
}
236
237
for (auto index : _return_columns) {
237
- if (_tablet_schema. column (index ).is_key ()) {
238
+ if (_tablet_schema-> column (index ).is_key ()) {
238
239
continue ;
239
240
} else {
240
241
_tablet_reader_params.return_columns .push_back (index );
@@ -270,31 +271,31 @@ Status OlapScanner::_init_return_columns(bool need_seq_col) {
270
271
continue ;
271
272
}
272
273
int32_t index = slot->col_unique_id () >= 0
273
- ? _tablet_schema. field_index (slot->col_unique_id ())
274
- : _tablet_schema. field_index (slot->col_name ());
274
+ ? _tablet_schema-> field_index (slot->col_unique_id ())
275
+ : _tablet_schema-> field_index (slot->col_name ());
275
276
if (index < 0 ) {
276
277
std::stringstream ss;
277
278
ss << " field name is invalid. field=" << slot->col_name ();
278
279
LOG (WARNING) << ss.str ();
279
280
return Status::InternalError (ss.str ());
280
281
}
281
282
_return_columns.push_back (index );
282
- if (slot->is_nullable () && !_tablet_schema. column (index ).is_nullable ())
283
+ if (slot->is_nullable () && !_tablet_schema-> column (index ).is_nullable ())
283
284
_tablet_columns_convert_to_null_set.emplace (index );
284
285
_query_slots.push_back (slot);
285
286
}
286
287
287
288
// expand the sequence column
288
- if (_tablet_schema. has_sequence_col () && need_seq_col) {
289
+ if (_tablet_schema-> has_sequence_col () && need_seq_col) {
289
290
bool has_replace_col = false ;
290
291
for (auto col : _return_columns) {
291
- if (_tablet_schema. column (col).aggregation () ==
292
+ if (_tablet_schema-> column (col).aggregation () ==
292
293
FieldAggregationMethod::OLAP_FIELD_AGGREGATION_REPLACE) {
293
294
has_replace_col = true ;
294
295
break ;
295
296
}
296
297
}
297
- if (auto sequence_col_idx = _tablet_schema. sequence_col_idx ();
298
+ if (auto sequence_col_idx = _tablet_schema-> sequence_col_idx ();
298
299
has_replace_col && std::find (_return_columns.begin (), _return_columns.end (),
299
300
sequence_col_idx) == _return_columns.end ()) {
300
301
_return_columns.push_back (sequence_col_idx);
0 commit comments