Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #include "exec/rowid_fetcher.h" |
19 | | |
20 | | #include <brpc/callback.h> |
21 | | #include <butil/endpoint.h> |
22 | | #include <fmt/format.h> |
23 | | #include <gen_cpp/data.pb.h> |
24 | | #include <gen_cpp/internal_service.pb.h> |
25 | | #include <gen_cpp/olap_file.pb.h> |
26 | | #include <gen_cpp/types.pb.h> |
27 | | #include <glog/logging.h> |
28 | | #include <stddef.h> |
29 | | #include <stdint.h> |
30 | | |
31 | | #include <algorithm> |
32 | | #include <cstdint> |
33 | | #include <memory> |
34 | | #include <ostream> |
35 | | #include <string> |
36 | | #include <unordered_map> |
37 | | #include <utility> |
38 | | #include <vector> |
39 | | |
40 | | #include "bthread/countdown_event.h" |
41 | | #include "common/config.h" |
42 | | #include "common/consts.h" |
43 | | #include "common/exception.h" |
44 | | #include "common/signal_handler.h" |
45 | | #include "core/assert_cast.h" |
46 | | #include "core/block/block.h" // Block |
47 | | #include "core/column/column.h" |
48 | | #include "core/column/column_nullable.h" |
49 | | #include "core/column/column_string.h" |
50 | | #include "core/data_type/data_type_struct.h" |
51 | | #include "core/data_type/primitive_type.h" |
52 | | #include "core/data_type_serde/data_type_serde.h" |
53 | | #include "core/string_ref.h" |
54 | | #include "exec/scan/file_scanner.h" |
55 | | #include "format/orc/vorc_reader.h" |
56 | | #include "format/parquet/vparquet_reader.h" |
57 | | #include "runtime/descriptors.h" |
58 | | #include "runtime/exec_env.h" // ExecEnv |
59 | | #include "runtime/fragment_mgr.h" // FragmentMgr |
60 | | #include "runtime/runtime_state.h" // RuntimeState |
61 | | #include "runtime/workload_group/workload_group_manager.h" |
62 | | #include "semaphore" |
63 | | #include "storage/olap_common.h" |
64 | | #include "storage/rowset/beta_rowset.h" |
65 | | #include "storage/segment/column_reader.h" |
66 | | #include "storage/storage_engine.h" |
67 | | #include "storage/tablet/tablet_fwd.h" |
68 | | #include "storage/tablet/tablet_schema.h" |
69 | | #include "storage/tablet_info.h" // DorisNodesInfo |
70 | | #include "storage/utils.h" |
71 | | #include "util/brpc_client_cache.h" // BrpcClientCache |
72 | | #include "util/defer_op.h" |
73 | | #include "util/jsonb/serialize.h" |
74 | | |
75 | | namespace doris { |
76 | | |
77 | | static bool has_nested_access_paths(const SlotDescriptor& slot); |
78 | | static bool has_complex_type(const SlotDescriptor& slot); |
79 | | |
80 | 0 | Status RowIDFetcher::init() { |
81 | 0 | DorisNodesInfo nodes_info; |
82 | 0 | nodes_info.setNodes(_fetch_option.t_fetch_opt.nodes_info); |
83 | 0 | for (auto [node_id, node_info] : nodes_info.nodes_info()) { |
84 | 0 | auto client = ExecEnv::GetInstance()->brpc_internal_client_cache()->get_client( |
85 | 0 | node_info.host, node_info.brpc_port); |
86 | 0 | if (!client) { |
87 | 0 | LOG(WARNING) << "Get rpc stub failed, host=" << node_info.host |
88 | 0 | << ", port=" << node_info.brpc_port; |
89 | 0 | return Status::InternalError("RowIDFetcher failed to init rpc client, host={}, port={}", |
90 | 0 | node_info.host, node_info.brpc_port); |
91 | 0 | } |
92 | 0 | _stubs.push_back(client); |
93 | 0 | } |
94 | 0 | return Status::OK(); |
95 | 0 | } |
96 | | |
97 | 0 | PMultiGetRequest RowIDFetcher::_init_fetch_request(const ColumnString& row_locs) const { |
98 | 0 | PMultiGetRequest mget_req; |
99 | 0 | _fetch_option.desc->to_protobuf(mget_req.mutable_desc()); |
100 | 0 | for (SlotDescriptor* slot : _fetch_option.desc->slots()) { |
101 | | // ignore rowid |
102 | 0 | if (slot->col_name() == BeConsts::ROWID_COL) { |
103 | 0 | continue; |
104 | 0 | } |
105 | 0 | slot->to_protobuf(mget_req.add_slots()); |
106 | 0 | } |
107 | 0 | bool fetch_row_store = _fetch_option.t_fetch_opt.fetch_row_store; |
108 | 0 | if (fetch_row_store) { |
109 | 0 | for (SlotDescriptor* slot : _fetch_option.desc->slots()) { |
110 | 0 | if (slot->col_name() != BeConsts::ROWID_COL && |
111 | 0 | (has_nested_access_paths(*slot) || has_complex_type(*slot))) { |
112 | 0 | fetch_row_store = false; |
113 | 0 | break; |
114 | 0 | } |
115 | 0 | } |
116 | 0 | } |
117 | 0 | for (size_t i = 0; i < row_locs.size(); ++i) { |
118 | 0 | PRowLocation row_loc; |
119 | 0 | StringRef row_id_rep = row_locs.get_data_at(i); |
120 | | // TODO: When transferring data between machines with different byte orders (endianness), |
121 | | // not performing proper handling may lead to issues in parsing and exchanging the data. |
122 | 0 | auto location = reinterpret_cast<const GlobalRowLoacation*>(row_id_rep.data); |
123 | 0 | row_loc.set_tablet_id(location->tablet_id); |
124 | 0 | row_loc.set_rowset_id(location->row_location.rowset_id.to_string()); |
125 | 0 | row_loc.set_segment_id(location->row_location.segment_id); |
126 | 0 | row_loc.set_ordinal_id(location->row_location.row_id); |
127 | 0 | *mget_req.add_row_locs() = std::move(row_loc); |
128 | 0 | } |
129 | | // Set column desc |
130 | 0 | for (const TColumn& tcolumn : _fetch_option.t_fetch_opt.column_desc) { |
131 | 0 | TabletColumn column(tcolumn); |
132 | 0 | column.to_schema_pb(mget_req.add_column_desc()); |
133 | 0 | } |
134 | 0 | PUniqueId& query_id = *mget_req.mutable_query_id(); |
135 | 0 | query_id.set_hi(_fetch_option.runtime_state->query_id().hi); |
136 | 0 | query_id.set_lo(_fetch_option.runtime_state->query_id().lo); |
137 | 0 | mget_req.set_be_exec_version(_fetch_option.runtime_state->be_exec_version()); |
138 | 0 | mget_req.set_fetch_row_store(fetch_row_store); |
139 | 0 | return mget_req; |
140 | 0 | } |
141 | | |
142 | | Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request, |
143 | | const std::vector<PMultiGetResponse>& rsps, |
144 | | const std::vector<brpc::Controller>& cntls, |
145 | | Block* output_block, |
146 | 0 | std::vector<PRowLocation>* rows_id) const { |
147 | 0 | output_block->clear(); |
148 | 0 | for (const auto& cntl : cntls) { |
149 | 0 | if (cntl.Failed()) { |
150 | 0 | LOG(WARNING) << "Failed to fetch meet rpc error:" << cntl.ErrorText() |
151 | 0 | << ", host:" << cntl.remote_side(); |
152 | 0 | return Status::InternalError(cntl.ErrorText()); |
153 | 0 | } |
154 | 0 | } |
155 | 0 | DataTypeSerDeSPtrs serdes; |
156 | 0 | std::unordered_map<uint32_t, uint32_t> col_uid_to_idx; |
157 | 0 | std::vector<std::string> default_values; |
158 | 0 | default_values.resize(_fetch_option.desc->slots().size()); |
159 | 0 | auto merge_function = [&](const PMultiGetResponse& resp) { |
160 | 0 | Status st(Status::create(resp.status())); |
161 | 0 | if (!st.ok()) { |
162 | 0 | LOG(WARNING) << "Failed to fetch " << st.to_string(); |
163 | 0 | return st; |
164 | 0 | } |
165 | 0 | for (const PRowLocation& row_id : resp.row_locs()) { |
166 | 0 | rows_id->push_back(row_id); |
167 | 0 | } |
168 | | // Merge binary rows |
169 | 0 | if (request.fetch_row_store()) { |
170 | 0 | CHECK(resp.row_locs().size() == resp.binary_row_data_size()); |
171 | 0 | if (output_block->is_empty_column()) { |
172 | 0 | *output_block = Block(_fetch_option.desc->slots(), 1); |
173 | 0 | } |
174 | 0 | if (serdes.empty() && col_uid_to_idx.empty()) { |
175 | 0 | serdes = create_data_type_serdes(_fetch_option.desc->slots()); |
176 | 0 | for (int i = 0; i < _fetch_option.desc->slots().size(); ++i) { |
177 | 0 | col_uid_to_idx[_fetch_option.desc->slots()[i]->col_unique_id()] = i; |
178 | 0 | default_values[i] = _fetch_option.desc->slots()[i]->col_default_value(); |
179 | 0 | } |
180 | 0 | } |
181 | 0 | auto output_columns_guard = output_block->mutate_columns_scoped(); |
182 | 0 | MutableColumns& output_columns = output_columns_guard.mutable_columns(); |
183 | 0 | for (int i = 0; i < resp.binary_row_data_size(); ++i) { |
184 | 0 | RETURN_IF_ERROR(JsonbSerializeUtil::jsonb_to_columns( |
185 | 0 | serdes, resp.binary_row_data(i).data(), resp.binary_row_data(i).size(), |
186 | 0 | col_uid_to_idx, output_columns, default_values, {})); |
187 | 0 | } |
188 | 0 | return Status::OK(); |
189 | 0 | } |
190 | | // Merge partial blocks |
191 | 0 | Block partial_block; |
192 | 0 | [[maybe_unused]] size_t uncompressed_size = 0; |
193 | 0 | [[maybe_unused]] int64_t uncompressed_time = 0; |
194 | |
|
195 | 0 | RETURN_IF_ERROR( |
196 | 0 | partial_block.deserialize(resp.block(), &uncompressed_size, &uncompressed_time)); |
197 | 0 | if (partial_block.is_empty_column()) { |
198 | 0 | return Status::OK(); |
199 | 0 | } |
200 | 0 | CHECK(resp.row_locs().size() == partial_block.rows()); |
201 | 0 | if (output_block->is_empty_column()) { |
202 | 0 | output_block->swap(partial_block); |
203 | 0 | } else if (partial_block.columns() != output_block->columns()) { |
204 | 0 | return Status::Error<ErrorCode::INTERNAL_ERROR>( |
205 | 0 | "Merge block not match, self:[{}], input:[{}], ", output_block->dump_types(), |
206 | 0 | partial_block.dump_types()); |
207 | 0 | } else { |
208 | 0 | for (int i = 0; i < output_block->columns(); ++i) { |
209 | 0 | auto column_guard = output_block->mutate_column_scoped(i); |
210 | 0 | MutableColumnPtr& column = column_guard.mutable_column(); |
211 | 0 | column->insert_range_from( |
212 | 0 | *partial_block.get_by_position(i).column->convert_to_full_column_if_const(), |
213 | 0 | 0, partial_block.rows()); |
214 | 0 | } |
215 | 0 | } |
216 | 0 | return Status::OK(); |
217 | 0 | }; |
218 | |
|
219 | 0 | for (const auto& resp : rsps) { |
220 | 0 | RETURN_IF_ERROR(merge_function(resp)); |
221 | 0 | } |
222 | 0 | return Status::OK(); |
223 | 0 | } |
224 | | |
225 | 0 | Status RowIDFetcher::fetch(const ColumnPtr& column_row_ids, Block* res_block) { |
226 | 0 | CHECK(!_stubs.empty()); |
227 | 0 | PMultiGetRequest mget_req = _init_fetch_request( |
228 | 0 | assert_cast<const ColumnString&>(*remove_nullable(column_row_ids).get())); |
229 | 0 | std::vector<PMultiGetResponse> resps(_stubs.size()); |
230 | 0 | std::vector<brpc::Controller> cntls(_stubs.size()); |
231 | 0 | bthread::CountdownEvent counter(cast_set<int>(_stubs.size())); |
232 | 0 | for (size_t i = 0; i < _stubs.size(); ++i) { |
233 | 0 | cntls[i].set_timeout_ms(_fetch_option.runtime_state->execution_timeout() * 1000); |
234 | 0 | auto callback = brpc::NewCallback(fetch_callback, &counter); |
235 | 0 | _stubs[i]->multiget_data(&cntls[i], &mget_req, &resps[i], callback); |
236 | 0 | } |
237 | 0 | counter.wait(); |
238 | | |
239 | | // Merge |
240 | 0 | std::vector<PRowLocation> rows_locs; |
241 | 0 | rows_locs.reserve(rows_locs.size()); |
242 | 0 | RETURN_IF_ERROR(_merge_rpc_results(mget_req, resps, cntls, res_block, &rows_locs)); |
243 | 0 | if (rows_locs.size() < column_row_ids->size()) { |
244 | 0 | return Status::InternalError("Miss matched return row loc count {}, expected {}, input {}", |
245 | 0 | rows_locs.size(), res_block->rows(), column_row_ids->size()); |
246 | 0 | } |
247 | | // Final sort by row_ids sequence, since row_ids is already sorted if need |
248 | 0 | std::map<GlobalRowLoacation, size_t> positions; |
249 | 0 | for (size_t i = 0; i < rows_locs.size(); ++i) { |
250 | 0 | RowsetId rowset_id; |
251 | 0 | rowset_id.init(rows_locs[i].rowset_id()); |
252 | 0 | GlobalRowLoacation grl(rows_locs[i].tablet_id(), rowset_id, |
253 | 0 | cast_set<uint32_t>(rows_locs[i].segment_id()), |
254 | 0 | cast_set<uint32_t>(rows_locs[i].ordinal_id())); |
255 | 0 | positions[grl] = i; |
256 | 0 | }; |
257 | | // TODO remove this warning code |
258 | 0 | if (positions.size() < rows_locs.size()) { |
259 | 0 | LOG(WARNING) << "cwntains duplicated row entry"; |
260 | 0 | } |
261 | 0 | IColumn::Permutation permutation; |
262 | 0 | permutation.reserve(column_row_ids->size()); |
263 | 0 | for (size_t i = 0; i < column_row_ids->size(); ++i) { |
264 | 0 | auto location = |
265 | 0 | reinterpret_cast<const GlobalRowLoacation*>(column_row_ids->get_data_at(i).data); |
266 | 0 | permutation.push_back(positions[*location]); |
267 | 0 | } |
268 | 0 | for (size_t i = 0; i < res_block->columns(); ++i) { |
269 | 0 | res_block->get_by_position(i).column = |
270 | 0 | res_block->get_by_position(i).column->permute(permutation, permutation.size()); |
271 | 0 | } |
272 | | // Check row consistency |
273 | 0 | RETURN_IF_CATCH_EXCEPTION(res_block->check_number_of_rows()); |
274 | 0 | VLOG_DEBUG << "dump block:" << res_block->dump_data(0, 10); |
275 | 0 | return Status::OK(); |
276 | 0 | } |
277 | | |
278 | | struct IteratorKey { |
279 | | int64_t tablet_id; |
280 | | RowsetId rowset_id; |
281 | | uint64_t segment_id; |
282 | | int slot_id; |
283 | | |
284 | | // unordered map std::equal_to |
285 | 12.3k | bool operator==(const IteratorKey& rhs) const { |
286 | 12.3k | return tablet_id == rhs.tablet_id && rowset_id == rhs.rowset_id && |
287 | 12.3k | segment_id == rhs.segment_id && slot_id == rhs.slot_id; |
288 | 12.3k | } |
289 | | }; |
290 | | |
291 | | struct SegKey { |
292 | | int64_t tablet_id; |
293 | | RowsetId rowset_id; |
294 | | uint64_t segment_id; |
295 | | |
296 | | // unordered map std::equal_to |
297 | 5.99k | bool operator==(const SegKey& rhs) const { |
298 | 5.99k | return tablet_id == rhs.tablet_id && rowset_id == rhs.rowset_id && |
299 | 5.99k | segment_id == rhs.segment_id; |
300 | 5.99k | } |
301 | | }; |
302 | | |
303 | | struct HashOfSegKey { |
304 | 15.7k | size_t operator()(const SegKey& key) const { |
305 | 15.7k | size_t seed = 0; |
306 | 15.7k | seed = HashUtil::hash64(&key.tablet_id, sizeof(key.tablet_id), seed); |
307 | 15.7k | seed = HashUtil::hash64(&key.rowset_id.hi, sizeof(key.rowset_id.hi), seed); |
308 | 15.7k | seed = HashUtil::hash64(&key.rowset_id.mi, sizeof(key.rowset_id.mi), seed); |
309 | 15.7k | seed = HashUtil::hash64(&key.rowset_id.lo, sizeof(key.rowset_id.lo), seed); |
310 | 15.7k | seed = HashUtil::hash64(&key.segment_id, sizeof(key.segment_id), seed); |
311 | 15.7k | return seed; |
312 | 15.7k | } |
313 | | }; |
314 | | |
315 | | struct HashOfIteratorKey { |
316 | 24.7k | size_t operator()(const IteratorKey& key) const { |
317 | 24.7k | size_t seed = 0; |
318 | 24.7k | seed = HashUtil::hash64(&key.tablet_id, sizeof(key.tablet_id), seed); |
319 | 24.7k | seed = HashUtil::hash64(&key.rowset_id.hi, sizeof(key.rowset_id.hi), seed); |
320 | 24.7k | seed = HashUtil::hash64(&key.rowset_id.mi, sizeof(key.rowset_id.mi), seed); |
321 | 24.7k | seed = HashUtil::hash64(&key.rowset_id.lo, sizeof(key.rowset_id.lo), seed); |
322 | 24.7k | seed = HashUtil::hash64(&key.segment_id, sizeof(key.segment_id), seed); |
323 | 24.7k | seed = HashUtil::hash64(&key.slot_id, sizeof(key.slot_id), seed); |
324 | 24.7k | return seed; |
325 | 24.7k | } |
326 | | }; |
327 | | |
328 | | struct IteratorItem { |
329 | | std::unique_ptr<ColumnIterator> iterator; |
330 | | SegmentSharedPtr segment; |
331 | | // for holding the reference of storage read options to avoid use after release |
332 | | StorageReadOptions storage_read_options; |
333 | | }; |
334 | | |
335 | | static void set_slot_access_paths(const SlotDescriptor& slot, const TabletSchema& schema, |
336 | 12.3k | StorageReadOptions& storage_read_options) { |
337 | 12.3k | int32_t unique_id = slot.col_unique_id(); |
338 | 12.3k | const int field_index = |
339 | 12.3k | unique_id >= 0 ? schema.field_index(unique_id) : schema.field_index(slot.col_name()); |
340 | 12.3k | if (field_index >= 0) { |
341 | 12.3k | const auto& column = schema.column(field_index); |
342 | 12.3k | unique_id = column.unique_id() >= 0 ? column.unique_id() : column.parent_unique_id(); |
343 | 12.3k | } |
344 | 12.3k | if (unique_id < 0) { |
345 | 0 | return; |
346 | 0 | } |
347 | | |
348 | 12.3k | if (!slot.all_access_paths().empty()) { |
349 | 937 | storage_read_options.all_access_paths[unique_id] = slot.all_access_paths(); |
350 | 11.4k | } else { |
351 | 11.4k | storage_read_options.all_access_paths.erase(unique_id); |
352 | 11.4k | } |
353 | | |
354 | 12.3k | if (!slot.predicate_access_paths().empty()) { |
355 | 0 | storage_read_options.predicate_access_paths[unique_id] = slot.predicate_access_paths(); |
356 | 12.3k | } else { |
357 | 12.3k | storage_read_options.predicate_access_paths.erase(unique_id); |
358 | 12.3k | } |
359 | 12.3k | } |
360 | | |
361 | 15.5k | static bool has_nested_access_paths(const SlotDescriptor& slot) { |
362 | 15.5k | return !slot.all_access_paths().empty() || !slot.predicate_access_paths().empty(); |
363 | 15.5k | } |
364 | | |
365 | 217 | static bool has_nested_access_paths(const std::vector<SlotDescriptor>& slots) { |
366 | 217 | return std::ranges::any_of( |
367 | 3.14k | slots, [](const SlotDescriptor& slot) { return has_nested_access_paths(slot); }); |
368 | 217 | } |
369 | | |
370 | 14.5k | static bool has_complex_type(const SlotDescriptor& slot) { |
371 | 14.5k | return is_complex_type(slot.type()->get_primitive_type()); |
372 | 14.5k | } |
373 | | |
374 | 217 | static bool has_complex_type(const std::vector<SlotDescriptor>& slots) { |
375 | 217 | return std::ranges::any_of(slots, |
376 | 3.14k | [](const SlotDescriptor& slot) { return has_complex_type(slot); }); |
377 | 217 | } |
378 | | |
379 | 12.3k | static ReaderType rowid_fetch_reader_type(const SlotDescriptor& slot) { |
380 | 12.3k | return has_nested_access_paths(slot) || has_complex_type(slot) ? ReaderType::READER_ALTER_TABLE |
381 | 12.3k | : ReaderType::READER_QUERY; |
382 | 12.3k | } |
383 | | |
384 | | struct SegItem { |
385 | | BaseTabletSPtr tablet; |
386 | | BetaRowsetSharedPtr rowset; |
387 | | // for holding the reference of segment to avoid use after release |
388 | | SegmentSharedPtr segment; |
389 | | }; |
390 | | |
391 | | // Groups all row_ids belonging to the same segment for batched reading. |
392 | | // Position index tracks where each row_id originated in the original request, |
393 | | // so results can be scattered back to the correct output positions. |
394 | | struct DorisFormatReadBatch { |
395 | | std::shared_ptr<FileMapping> file_mapping; |
396 | | // (row_id, index_in_request) pairs for all rows in this segment. |
397 | | std::vector<std::pair<segment_v2::rowid_t, size_t>> row_ids_with_positions; |
398 | | }; |
399 | | |
400 | | static void scatter_scan_blocks_to_result_block( |
401 | | const std::vector<std::pair<size_t, size_t>>& row_id_block_idx, |
402 | 937 | const std::vector<Block>& scan_blocks, Block& result_block) { |
403 | 7.13k | for (size_t column_id = 0; column_id < result_block.columns(); ++column_id) { |
404 | 6.20k | auto dst_col_guard = result_block.mutate_column_scoped(column_id); |
405 | 6.20k | MutableColumnPtr& dst_col = dst_col_guard.mutable_column(); |
406 | | |
407 | 6.20k | std::vector<const IColumn*> scan_src_columns; |
408 | 6.20k | scan_src_columns.reserve(row_id_block_idx.size()); |
409 | 6.20k | std::vector<size_t> scan_positions; |
410 | 6.20k | scan_positions.reserve(row_id_block_idx.size()); |
411 | 96.7k | for (const auto& [pos_block, block_idx] : row_id_block_idx) { |
412 | 96.7k | DCHECK(scan_blocks.size() > pos_block); |
413 | 96.7k | DCHECK(scan_blocks[pos_block].columns() > column_id); |
414 | 96.7k | scan_src_columns.emplace_back( |
415 | 96.7k | scan_blocks[pos_block].get_by_position(column_id).column.get()); |
416 | 96.7k | scan_positions.emplace_back(block_idx); |
417 | 96.7k | } |
418 | 6.20k | dst_col->insert_from_multi_column(scan_src_columns, scan_positions); |
419 | 6.20k | } |
420 | 937 | } |
421 | | |
422 | | Status RowIdStorageReader::read_by_rowids(const PMultiGetRequest& request, |
423 | 0 | PMultiGetResponse* response) { |
424 | | // read from storage engine row id by row id |
425 | 0 | OlapReaderStatistics stats; |
426 | 0 | Block result_block; |
427 | 0 | int64_t acquire_tablet_ms = 0; |
428 | 0 | int64_t acquire_rowsets_ms = 0; |
429 | 0 | int64_t acquire_segments_ms = 0; |
430 | 0 | int64_t lookup_row_data_ms = 0; |
431 | | |
432 | | // init desc |
433 | 0 | std::vector<SlotDescriptor> slots; |
434 | 0 | slots.reserve(request.slots().size()); |
435 | 0 | for (const auto& pslot : request.slots()) { |
436 | 0 | slots.push_back(SlotDescriptor(pslot)); |
437 | 0 | } |
438 | | |
439 | | // init read schema |
440 | 0 | TabletSchema full_read_schema; |
441 | 0 | for (const ColumnPB& column_pb : request.column_desc()) { |
442 | 0 | full_read_schema.append_column(TabletColumn(column_pb)); |
443 | 0 | } |
444 | |
|
445 | 0 | std::unordered_map<IteratorKey, IteratorItem, HashOfIteratorKey> iterator_map; |
446 | | // read row by row |
447 | 0 | for (int i = 0; i < request.row_locs_size(); ++i) { |
448 | 0 | const auto& row_loc = request.row_locs(i); |
449 | 0 | MonotonicStopWatch watch; |
450 | 0 | watch.start(); |
451 | 0 | BaseTabletSPtr tablet = scope_timer_run( |
452 | 0 | [&]() { |
453 | 0 | auto res = ExecEnv::get_tablet(row_loc.tablet_id(), nullptr, true); |
454 | 0 | return !res.has_value() ? nullptr |
455 | 0 | : std::dynamic_pointer_cast<BaseTablet>(res.value()); |
456 | 0 | }, |
457 | 0 | &acquire_tablet_ms); |
458 | 0 | RowsetId rowset_id; |
459 | 0 | rowset_id.init(row_loc.rowset_id()); |
460 | 0 | if (!tablet) { |
461 | 0 | continue; |
462 | 0 | } |
463 | | // We ensured it's rowset is not released when init Tablet reader param, rowset->update_delayed_expired_timestamp(); |
464 | 0 | BetaRowsetSharedPtr rowset = std::static_pointer_cast<BetaRowset>(scope_timer_run( |
465 | 0 | [&]() { |
466 | 0 | return ExecEnv::GetInstance()->storage_engine().get_quering_rowset(rowset_id); |
467 | 0 | }, |
468 | 0 | &acquire_rowsets_ms)); |
469 | 0 | if (!rowset) { |
470 | 0 | LOG(INFO) << "no such rowset " << rowset_id; |
471 | 0 | continue; |
472 | 0 | } |
473 | 0 | size_t row_size = 0; |
474 | 0 | Defer _defer([&]() { |
475 | 0 | LOG_EVERY_N(INFO, 100) |
476 | 0 | << "multiget_data single_row, cost(us):" << watch.elapsed_time() / 1000 |
477 | 0 | << ", row_size:" << row_size; |
478 | 0 | *response->add_row_locs() = row_loc; |
479 | 0 | }); |
480 | | // TODO: supoort session variable enable_page_cache and disable_file_cache if necessary. |
481 | 0 | SegmentCacheHandle segment_cache; |
482 | 0 | RETURN_IF_ERROR(scope_timer_run( |
483 | 0 | [&]() { |
484 | 0 | return SegmentLoader::instance()->load_segments(rowset, &segment_cache, true); |
485 | 0 | }, |
486 | 0 | &acquire_segments_ms)); |
487 | | // find segment |
488 | 0 | auto it = std::find_if(segment_cache.get_segments().cbegin(), |
489 | 0 | segment_cache.get_segments().cend(), |
490 | 0 | [&row_loc](const segment_v2::SegmentSharedPtr& seg) { |
491 | 0 | return seg->id() == row_loc.segment_id(); |
492 | 0 | }); |
493 | 0 | if (it == segment_cache.get_segments().end()) { |
494 | 0 | continue; |
495 | 0 | } |
496 | 0 | segment_v2::SegmentSharedPtr segment = *it; |
497 | 0 | GlobalRowLoacation row_location(row_loc.tablet_id(), rowset->rowset_id(), |
498 | 0 | cast_set<uint32_t>(row_loc.segment_id()), |
499 | 0 | cast_set<uint32_t>(row_loc.ordinal_id())); |
500 | | // fetch by row store, more effcient way |
501 | 0 | if (request.fetch_row_store()) { |
502 | 0 | if (!tablet->tablet_schema()->has_row_store_for_all_columns()) { |
503 | 0 | return Status::InternalError("Tablet {} does not have row store for all columns", |
504 | 0 | tablet->tablet_id()); |
505 | 0 | } |
506 | 0 | RowLocation loc(rowset_id, segment->id(), cast_set<uint32_t>(row_loc.ordinal_id())); |
507 | 0 | std::string* value = response->add_binary_row_data(); |
508 | 0 | RETURN_IF_ERROR(scope_timer_run( |
509 | 0 | [&]() { return tablet->lookup_row_data({}, loc, rowset, stats, *value); }, |
510 | 0 | &lookup_row_data_ms)); |
511 | 0 | row_size = value->size(); |
512 | 0 | continue; |
513 | 0 | } |
514 | | |
515 | | // fetch by column store |
516 | 0 | if (result_block.is_empty_column()) { |
517 | 0 | result_block = Block(slots, request.row_locs().size()); |
518 | 0 | } |
519 | 0 | VLOG_DEBUG << "Read row location " |
520 | 0 | << fmt::format("{}, {}, {}, {}", row_location.tablet_id, |
521 | 0 | row_location.row_location.rowset_id.to_string(), |
522 | 0 | row_location.row_location.segment_id, |
523 | 0 | row_location.row_location.row_id); |
524 | 0 | for (int x = 0; x < slots.size(); ++x) { |
525 | 0 | std::vector<segment_v2::rowid_t> row_ids { |
526 | 0 | static_cast<segment_v2::rowid_t>(row_loc.ordinal_id())}; |
527 | 0 | MutableColumnPtr column = result_block.get_by_position(x).column->assert_mutable(); |
528 | 0 | IteratorKey iterator_key {.tablet_id = tablet->tablet_id(), |
529 | 0 | .rowset_id = rowset_id, |
530 | 0 | .segment_id = row_loc.segment_id(), |
531 | 0 | .slot_id = slots[x].id()}; |
532 | 0 | IteratorItem& iterator_item = iterator_map[iterator_key]; |
533 | 0 | if (iterator_item.segment == nullptr) { |
534 | | // hold the reference |
535 | 0 | iterator_map[iterator_key].segment = segment; |
536 | 0 | iterator_item.storage_read_options.stats = &stats; |
537 | 0 | iterator_item.storage_read_options.io_ctx.reader_type = |
538 | 0 | rowid_fetch_reader_type(slots[x]); |
539 | 0 | } |
540 | 0 | segment = iterator_item.segment; |
541 | 0 | set_slot_access_paths(slots[x], full_read_schema, iterator_item.storage_read_options); |
542 | 0 | RETURN_IF_ERROR(segment->seek_and_read_by_rowid( |
543 | 0 | full_read_schema, &slots[x], row_ids, column, |
544 | 0 | iterator_item.storage_read_options, iterator_item.iterator)); |
545 | 0 | } |
546 | 0 | } |
547 | | // serialize block if not empty |
548 | 0 | if (!result_block.is_empty_column()) { |
549 | 0 | VLOG_DEBUG << "dump block:" << result_block.dump_data(0, 10) |
550 | 0 | << ", be_exec_version:" << request.be_exec_version(); |
551 | 0 | [[maybe_unused]] size_t compressed_size = 0; |
552 | 0 | [[maybe_unused]] size_t uncompressed_size = 0; |
553 | 0 | [[maybe_unused]] int64_t compress_time = 0; |
554 | 0 | int be_exec_version = request.has_be_exec_version() ? request.be_exec_version() : 0; |
555 | 0 | RETURN_IF_ERROR(result_block.serialize(be_exec_version, response->mutable_block(), |
556 | 0 | &uncompressed_size, &compressed_size, &compress_time, |
557 | 0 | segment_v2::CompressionTypePB::LZ4)); |
558 | 0 | } |
559 | | |
560 | 0 | LOG(INFO) << "Query stats: " |
561 | 0 | << fmt::format( |
562 | 0 | "query_id:{}, " |
563 | 0 | "hit_cached_pages:{}, total_pages_read:{}, compressed_bytes_read:{}, " |
564 | 0 | "io_latency:{}ns, " |
565 | 0 | "uncompressed_bytes_read:{}," |
566 | 0 | "bytes_read:{}," |
567 | 0 | "acquire_tablet_ms:{}, acquire_rowsets_ms:{}, acquire_segments_ms:{}, " |
568 | 0 | "lookup_row_data_ms:{}", |
569 | 0 | print_id(request.query_id()), stats.cached_pages_num, |
570 | 0 | stats.total_pages_num, stats.compressed_bytes_read, stats.io_ns, |
571 | 0 | stats.uncompressed_bytes_read, stats.bytes_read, acquire_tablet_ms, |
572 | 0 | acquire_rowsets_ms, acquire_segments_ms, lookup_row_data_ms); |
573 | 0 | return Status::OK(); |
574 | 0 | } |
575 | | |
576 | | Status RowIdStorageReader::read_by_rowids(const PMultiGetRequestV2& request, |
577 | 1.10k | PMultiGetResponseV2* response) { |
578 | 1.10k | if (request.request_block_descs_size()) { |
579 | 1.10k | auto tquery_id = ((UniqueId)request.query_id()).to_thrift(); |
580 | | // todo: use mutableBlock instead of block |
581 | 1.10k | std::vector<Block> result_blocks(request.request_block_descs_size()); |
582 | | |
583 | 1.10k | OlapReaderStatistics stats; |
584 | 1.10k | int64_t acquire_tablet_ms = 0; |
585 | 1.10k | int64_t acquire_rowsets_ms = 0; |
586 | 1.10k | int64_t acquire_segments_ms = 0; |
587 | 1.10k | int64_t lookup_row_data_ms = 0; |
588 | | |
589 | 1.10k | int64_t external_init_reader_avg_ms = 0; |
590 | 1.10k | int64_t external_get_block_avg_ms = 0; |
591 | 1.10k | size_t external_scan_range_cnt = 0; |
592 | | |
593 | | // Add counters for different file mapping types |
594 | 1.10k | std::unordered_map<FileMappingType, int64_t> file_type_counts; |
595 | | |
596 | 1.10k | auto id_file_map = |
597 | 1.10k | ExecEnv::GetInstance()->get_id_manager()->get_id_file_map(request.query_id()); |
598 | | // if id_file_map is null, means the BE not have scan range, just return ok |
599 | 1.10k | if (!id_file_map) { |
600 | | // padding empty block to response |
601 | 0 | LOG(INFO) << "id_file_map not found for query_id: " << print_id(request.query_id()); |
602 | 0 | for (int i = 0; i < request.request_block_descs_size(); ++i) { |
603 | 0 | response->add_blocks(); |
604 | 0 | } |
605 | 0 | return Status::OK(); |
606 | 0 | } |
607 | | |
608 | 2.23k | for (int i = 0; i < request.request_block_descs_size(); ++i) { |
609 | 1.12k | const auto& request_block_desc = request.request_block_descs(i); |
610 | 1.12k | PMultiGetBlockV2* pblock = response->add_blocks(); |
611 | 1.12k | if (request_block_desc.row_id_size() >= 1) { |
612 | | // Since this block belongs to the same table, we only need to take the first type for judgment. |
613 | 937 | auto first_file_id = request_block_desc.file_id(0); |
614 | 937 | auto first_file_mapping = id_file_map->get_file_mapping(first_file_id); |
615 | 937 | if (!first_file_mapping) { |
616 | 0 | return Status::InternalError( |
617 | 0 | "Backend:{} file_mapping not found, query_id: {}, file_id: {}", |
618 | 0 | BackendOptions::get_localhost(), print_id(request.query_id()), |
619 | 0 | first_file_id); |
620 | 0 | } |
621 | 937 | file_type_counts[first_file_mapping->type] += request_block_desc.row_id_size(); |
622 | | |
623 | | // prepare slots to build block |
624 | 937 | std::vector<SlotDescriptor> slots; |
625 | 937 | slots.reserve(request_block_desc.slots_size()); |
626 | 6.20k | for (const auto& pslot : request_block_desc.slots()) { |
627 | 6.20k | slots.push_back(SlotDescriptor(pslot)); |
628 | 6.20k | } |
629 | 937 | try { |
630 | 937 | if (first_file_mapping->type == FileMappingType::INTERNAL) { |
631 | 923 | RETURN_IF_ERROR(read_batch_doris_format_row( |
632 | 923 | request_block_desc, id_file_map, slots, tquery_id, result_blocks[i], |
633 | 923 | stats, &acquire_tablet_ms, &acquire_rowsets_ms, |
634 | 923 | &acquire_segments_ms, &lookup_row_data_ms)); |
635 | 923 | } else { |
636 | 14 | RETURN_IF_ERROR(read_batch_external_row( |
637 | 14 | request.wg_id(), request_block_desc, id_file_map, slots, |
638 | 14 | first_file_mapping, tquery_id, result_blocks[i], |
639 | 14 | pblock->mutable_profile(), &external_init_reader_avg_ms, |
640 | 14 | &external_get_block_avg_ms, &external_scan_range_cnt)); |
641 | 14 | } |
642 | 937 | } catch (const Exception& e) { |
643 | 0 | return Status::Error<false>(e.code(), "Row id fetch failed because {}", |
644 | 0 | e.what()); |
645 | 0 | } |
646 | 937 | } |
647 | | |
648 | 1.12k | [[maybe_unused]] size_t compressed_size = 0; |
649 | 1.12k | [[maybe_unused]] size_t uncompressed_size = 0; |
650 | 1.12k | [[maybe_unused]] int64_t compress_time = 0; |
651 | 1.12k | int be_exec_version = request.has_be_exec_version() ? request.be_exec_version() : 0; |
652 | 1.12k | RETURN_IF_ERROR(result_blocks[i].serialize( |
653 | 1.12k | be_exec_version, pblock->mutable_block(), &uncompressed_size, &compressed_size, |
654 | 1.12k | &compress_time, segment_v2::CompressionTypePB::LZ4)); |
655 | 1.12k | } |
656 | | |
657 | | // Build file type statistics string |
658 | 1.10k | std::string file_type_stats; |
659 | 1.10k | for (const auto& [type, count] : file_type_counts) { |
660 | 921 | if (!file_type_stats.empty()) { |
661 | 0 | file_type_stats += ", "; |
662 | 0 | } |
663 | 921 | file_type_stats += fmt::format("{}:{}", type, count); |
664 | 921 | } |
665 | | |
666 | 1.10k | LOG(INFO) << "Query stats: " |
667 | 1.10k | << fmt::format( |
668 | 1.10k | "query_id:{}, " |
669 | 1.10k | "Internal table:" |
670 | 1.10k | "hit_cached_pages:{}, total_pages_read:{}, compressed_bytes_read:{}, " |
671 | 1.10k | "io_latency:{}ns, uncompressed_bytes_read:{}, bytes_read:{}, " |
672 | 1.10k | "acquire_tablet_ms:{}, acquire_rowsets_ms:{}, acquire_segments_ms:{}, " |
673 | 1.10k | "lookup_row_data_ms:{}, file_types:[{}]; " |
674 | 1.10k | "External table : init_reader_ms:{}, get_block_ms:{}, " |
675 | 1.10k | "external_scan_range_cnt:{}", |
676 | 1.10k | print_id(request.query_id()), stats.cached_pages_num, |
677 | 1.10k | stats.total_pages_num, stats.compressed_bytes_read, stats.io_ns, |
678 | 1.10k | stats.uncompressed_bytes_read, stats.bytes_read, acquire_tablet_ms, |
679 | 1.10k | acquire_rowsets_ms, acquire_segments_ms, lookup_row_data_ms, |
680 | 1.10k | file_type_stats, external_init_reader_avg_ms, |
681 | 1.10k | external_get_block_avg_ms, external_scan_range_cnt); |
682 | 1.10k | } |
683 | | |
684 | 1.10k | return Status::OK(); |
685 | 1.10k | } |
686 | | |
687 | | Status RowIdStorageReader::read_batch_doris_format_row( |
688 | | const PRequestBlockDesc& request_block_desc, std::shared_ptr<IdFileMap> id_file_map, |
689 | | std::vector<SlotDescriptor>& slots, const TUniqueId& query_id, Block& result_block, |
690 | | OlapReaderStatistics& stats, int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, |
691 | 923 | int64_t* acquire_segments_ms, int64_t* lookup_row_data_ms) { |
692 | 923 | if (result_block.is_empty_column()) [[likely]] { |
693 | 923 | result_block = Block(slots, request_block_desc.row_id_size()); |
694 | 923 | } |
695 | 923 | TabletSchema full_read_schema; |
696 | 6.05k | for (const ColumnPB& column_pb : request_block_desc.column_descs()) { |
697 | 6.05k | full_read_schema.append_column(TabletColumn(column_pb)); |
698 | 6.05k | } |
699 | | |
700 | 923 | std::unordered_map<IteratorKey, IteratorItem, HashOfIteratorKey> iterator_map; |
701 | 923 | std::unordered_map<SegKey, SegItem, HashOfSegKey> seg_map; |
702 | 923 | std::string row_store_buffer; |
703 | 923 | RowStoreReadStruct row_store_read_struct(row_store_buffer); |
704 | 923 | if (request_block_desc.fetch_row_store() && !has_nested_access_paths(slots) && |
705 | 923 | !has_complex_type(slots)) { |
706 | 3.36k | for (int i = 0; i < request_block_desc.slots_size(); ++i) { |
707 | 3.14k | row_store_read_struct.serdes.emplace_back(slots[i].get_data_type_ptr()->get_serde()); |
708 | 3.14k | row_store_read_struct.col_uid_to_idx[slots[i].col_unique_id()] = i; |
709 | 3.14k | row_store_read_struct.default_values.emplace_back(slots[i].col_default_value()); |
710 | 3.14k | } |
711 | 217 | } |
712 | | |
713 | | // Phase 1: Group all row_ids by their (tablet_id, rowset_id, segment_id) key. |
714 | | // Unlike the old code which only batched adjacent rows with the same file_id, |
715 | | // this merges non-contiguous same-segment requests into a single batch, |
716 | | // maximizing the number of rows read per seek_and_read_by_rowid call. |
717 | 923 | std::vector<DorisFormatReadBatch> scan_batches; |
718 | 923 | std::unordered_map<SegKey, size_t, HashOfSegKey> batch_idx_by_seg; |
719 | | // (batch_idx, position_in_batch) for each row in the original request. |
720 | 923 | std::vector<std::pair<size_t, size_t>> row_id_block_idx(request_block_desc.row_id_size()); |
721 | 10.1k | for (int j = 0; j < request_block_desc.row_id_size(); ++j) { |
722 | 9.24k | auto file_id = request_block_desc.file_id(j); |
723 | 9.24k | auto file_mapping = id_file_map->get_file_mapping(file_id); |
724 | 9.24k | if (!file_mapping) { |
725 | 0 | return Status::InternalError( |
726 | 0 | "Backend:{} file_mapping not found, query_id: {}, file_id: {}", |
727 | 0 | BackendOptions::get_localhost(), print_id(query_id), file_id); |
728 | 0 | } |
729 | | |
730 | | // Derive segment key and group by it — rows from the same segment are batched together |
731 | | // even if they are interleaved with rows from other segments in the request. |
732 | 9.24k | auto [tablet_id, rowset_id, segment_id] = file_mapping->get_doris_format_info(); |
733 | 9.24k | SegKey seg_key {.tablet_id = tablet_id, .rowset_id = rowset_id, .segment_id = segment_id}; |
734 | 9.24k | auto [it, inserted] = batch_idx_by_seg.emplace(seg_key, scan_batches.size()); |
735 | 9.24k | if (inserted) { |
736 | | // First time seeing this segment, create a new batch for it. |
737 | 3.24k | scan_batches.emplace_back(); |
738 | 3.24k | scan_batches.back().file_mapping = file_mapping; |
739 | 3.24k | } |
740 | | // Record (row_id, original_request_index) for later sorting and scattering. |
741 | 9.24k | scan_batches[it->second].row_ids_with_positions.emplace_back(request_block_desc.row_id(j), |
742 | 9.24k | j); |
743 | 9.24k | } |
744 | | |
745 | | // Phase 2: For each segment, sort row_ids ascending (required by ColumnIterator), |
746 | | // deduplicate, then read all rows in a single batch call. |
747 | 923 | std::vector<Block> scan_blocks(scan_batches.size()); |
748 | 4.17k | for (size_t batch_idx = 0; batch_idx < scan_batches.size(); ++batch_idx) { |
749 | 3.24k | auto& scan_batch = scan_batches[batch_idx]; |
750 | 3.24k | auto& row_ids_with_positions = scan_batch.row_ids_with_positions; |
751 | 3.24k | std::sort(row_ids_with_positions.begin(), row_ids_with_positions.end(), |
752 | 18.9k | [](const auto& lhs, const auto& rhs) { return lhs.first < rhs.first; }); |
753 | | |
754 | | // Column iterators read rowids monotonically. Deduplicate consecutive identical row_ids |
755 | | // (different file_ids may map to the same row), then scatter rows back to their original |
756 | | // request positions. |
757 | 3.24k | std::vector<uint32_t> row_ids; |
758 | 3.24k | row_ids.reserve(row_ids_with_positions.size()); |
759 | | |
760 | | // Also builds the scatter map: row_id_block_idx[original_request_idx] -> |
761 | | // (batch_idx, deduplicated_position_in_batch). |
762 | 9.24k | for (const auto& [row_id, result_idx] : row_ids_with_positions) { |
763 | 9.24k | if (row_ids.empty() || row_ids.back() != row_id) { |
764 | 9.04k | row_ids.emplace_back(row_id); |
765 | 9.04k | } |
766 | 9.24k | row_id_block_idx[result_idx] = std::make_pair(batch_idx, row_ids.size() - 1); |
767 | 9.24k | } |
768 | | |
769 | 3.24k | scan_blocks[batch_idx] = Block(slots, row_ids.size()); |
770 | 3.24k | RETURN_IF_ERROR(read_doris_format_row(id_file_map, scan_batch.file_mapping, row_ids, slots, |
771 | 3.24k | full_read_schema, row_store_read_struct, stats, |
772 | 3.24k | acquire_tablet_ms, acquire_rowsets_ms, |
773 | 3.24k | acquire_segments_ms, lookup_row_data_ms, seg_map, |
774 | 3.24k | iterator_map, scan_blocks[batch_idx])); |
775 | 3.24k | } |
776 | | |
777 | 923 | scatter_scan_blocks_to_result_block(row_id_block_idx, scan_blocks, result_block); |
778 | | |
779 | 923 | return Status::OK(); |
780 | 923 | } |
781 | | |
782 | | const std::string RowIdStorageReader::ScannersRunningTimeProfile = "ScannersRunningTime"; |
783 | | const std::string RowIdStorageReader::InitReaderAvgTimeProfile = "InitReaderAvgTime"; |
784 | | const std::string RowIdStorageReader::GetBlockAvgTimeProfile = "GetBlockAvgTime"; |
785 | | const std::string RowIdStorageReader::FileReadLinesProfile = "FileReadLines"; |
786 | | |
787 | | Status RowIdStorageReader::read_external_row_from_file_mapping( |
788 | | size_t idx, const std::multimap<segment_v2::rowid_t, size_t>& row_ids, |
789 | | const std::shared_ptr<FileMapping>& file_mapping, const std::vector<SlotDescriptor>& slots, |
790 | | const TUniqueId& query_id, const std::shared_ptr<RuntimeState>& runtime_state, |
791 | | std::vector<Block>& scan_blocks, std::vector<std::pair<size_t, size_t>>& row_id_block_idx, |
792 | | std::vector<RowIdStorageReader::ExternalFetchStatistics>& fetch_statistics, |
793 | | const TFileScanRangeParams& rpc_scan_params, |
794 | | const std::unordered_map<std::string, int>& colname_to_slot_id, |
795 | | std::atomic<int>& producer_count, size_t scan_rows_count, |
796 | | std::counting_semaphore<>& semaphore, std::condition_variable& cv, std::mutex& mtx, |
797 | 14 | TupleDescriptor& tuple_desc) { |
798 | 14 | SCOPED_ATTACH_TASK(ExecEnv::GetInstance()->rowid_storage_reader_tracker()); |
799 | 14 | signal::set_signal_task_id(query_id); |
800 | | |
801 | 14 | std::list<int64_t> read_ids; |
802 | | //Generate an ordered list with the help of the orderliness of the map. |
803 | 32 | for (const auto& [row_id, result_block_idx] : row_ids) { |
804 | 32 | if (read_ids.empty() || read_ids.back() != row_id) { |
805 | 32 | read_ids.emplace_back(row_id); |
806 | 32 | } |
807 | 32 | row_id_block_idx[result_block_idx] = std::make_pair(idx, read_ids.size() - 1); |
808 | 32 | } |
809 | | |
810 | 14 | scan_blocks[idx] = Block(slots, read_ids.size()); |
811 | | |
812 | 14 | auto& external_info = file_mapping->get_external_file_info(); |
813 | 14 | auto& scan_range_desc = external_info.scan_range_desc; |
814 | | |
815 | | // Clear to avoid reading iceberg position delete file... |
816 | 14 | scan_range_desc.table_format_params.iceberg_params = TIcebergFileDesc {}; |
817 | | |
818 | | // Clear to avoid reading hive transactional delete delta file... |
819 | 14 | scan_range_desc.table_format_params.transactional_hive_params = TTransactionalHiveDesc {}; |
820 | | |
821 | 14 | std::unique_ptr<RuntimeProfile> sub_runtime_profile = |
822 | 14 | std::make_unique<RuntimeProfile>("ExternalRowIDFetcher"); |
823 | 14 | { |
824 | 14 | std::unique_ptr<FileScanner> vfile_scanner_ptr = |
825 | 14 | FileScanner::create_unique(runtime_state.get(), sub_runtime_profile.get(), |
826 | 14 | &rpc_scan_params, &colname_to_slot_id, &tuple_desc); |
827 | | |
828 | 14 | RETURN_IF_ERROR(vfile_scanner_ptr->prepare_for_read_lines(scan_range_desc)); |
829 | 14 | RETURN_IF_ERROR(vfile_scanner_ptr->read_lines_from_range( |
830 | 14 | scan_range_desc, read_ids, &scan_blocks[idx], external_info, |
831 | 14 | &fetch_statistics[idx].init_reader_ms, &fetch_statistics[idx].get_block_ms)); |
832 | 14 | } |
833 | | |
834 | 14 | auto file_read_bytes_counter = |
835 | 14 | sub_runtime_profile->get_counter(FileScanner::FileReadBytesProfile); |
836 | | |
837 | 14 | if (file_read_bytes_counter != nullptr) { |
838 | 14 | fetch_statistics[idx].file_read_bytes = PrettyPrinter::print( |
839 | 14 | file_read_bytes_counter->value(), file_read_bytes_counter->type()); |
840 | 14 | } |
841 | | |
842 | 14 | auto file_read_times_counter = |
843 | 14 | sub_runtime_profile->get_counter(FileScanner::FileReadTimeProfile); |
844 | 14 | if (file_read_times_counter != nullptr) { |
845 | 14 | fetch_statistics[idx].file_read_times = PrettyPrinter::print( |
846 | 14 | file_read_times_counter->value(), file_read_times_counter->type()); |
847 | 14 | } |
848 | | |
849 | 14 | semaphore.release(); |
850 | 14 | if (++producer_count == scan_rows_count) { |
851 | 14 | std::lock_guard<std::mutex> lock(mtx); |
852 | 14 | cv.notify_one(); |
853 | 14 | } |
854 | 14 | return Status::OK(); |
855 | 14 | } |
856 | | |
857 | | Status RowIdStorageReader::read_batch_external_row( |
858 | | const uint64_t workload_group_id, const PRequestBlockDesc& request_block_desc, |
859 | | std::shared_ptr<IdFileMap> id_file_map, std::vector<SlotDescriptor>& slots, |
860 | | std::shared_ptr<FileMapping> first_file_mapping, const TUniqueId& query_id, |
861 | | Block& result_block, PRuntimeProfileTree* pprofile, int64_t* init_reader_avg_ms, |
862 | 14 | int64_t* get_block_avg_ms, size_t* scan_range_cnt) { |
863 | 14 | TFileScanRangeParams rpc_scan_params; |
864 | 14 | TupleDescriptor tuple_desc(request_block_desc.desc(), false); |
865 | 14 | std::unordered_map<std::string, int> colname_to_slot_id; |
866 | 14 | std::shared_ptr<RuntimeState> runtime_state = nullptr; |
867 | | |
868 | 14 | int max_file_scanners = 0; |
869 | 14 | { |
870 | 14 | if (result_block.is_empty_column()) [[likely]] { |
871 | 14 | result_block = Block(slots, request_block_desc.row_id_size()); |
872 | 14 | } |
873 | | |
874 | 14 | auto& external_info = first_file_mapping->get_external_file_info(); |
875 | 14 | int plan_node_id = external_info.plan_node_id; |
876 | 14 | const auto& first_scan_range_desc = external_info.scan_range_desc; |
877 | | |
878 | 14 | DCHECK(id_file_map->get_external_scan_params().contains(plan_node_id)); |
879 | 14 | const auto* old_scan_params = &(id_file_map->get_external_scan_params().at(plan_node_id)); |
880 | 14 | rpc_scan_params = *old_scan_params; |
881 | | |
882 | 14 | rpc_scan_params.required_slots.clear(); |
883 | 14 | rpc_scan_params.column_idxs.clear(); |
884 | 14 | rpc_scan_params.slot_name_to_schema_pos.clear(); |
885 | | |
886 | 14 | std::set partition_name_set(first_scan_range_desc.columns_from_path_keys.begin(), |
887 | 14 | first_scan_range_desc.columns_from_path_keys.end()); |
888 | 161 | for (auto slot_idx = 0; slot_idx < slots.size(); ++slot_idx) { |
889 | 147 | auto& slot = slots[slot_idx]; |
890 | 147 | tuple_desc.add_slot(&slot); |
891 | 147 | colname_to_slot_id.emplace(slot.col_name(), slot.id()); |
892 | 147 | TFileScanSlotInfo slot_info; |
893 | 147 | slot_info.slot_id = slot.id(); |
894 | 147 | auto column_idx = request_block_desc.column_idxs(slot_idx); |
895 | 147 | if (partition_name_set.contains(slot.col_name())) { |
896 | | //This is partition column. |
897 | 0 | slot_info.is_file_slot = false; |
898 | 147 | } else { |
899 | 147 | rpc_scan_params.column_idxs.emplace_back(column_idx); |
900 | 147 | slot_info.is_file_slot = true; |
901 | 147 | } |
902 | 147 | rpc_scan_params.default_value_of_src_slot.emplace(slot.id(), TExpr {}); |
903 | 147 | rpc_scan_params.required_slots.emplace_back(slot_info); |
904 | 147 | rpc_scan_params.slot_name_to_schema_pos.emplace(slot.col_name(), column_idx); |
905 | 147 | } |
906 | | |
907 | 14 | const auto& query_options = id_file_map->get_query_options(); |
908 | 14 | const auto& query_globals = id_file_map->get_query_globals(); |
909 | | /* |
910 | | * The scan stage needs the information in query_options to generate different behaviors according to the specific variables: |
911 | | * query_options.hive_parquet_use_column_names, query_options.truncate_char_or_varchar_columns,query_globals.time_zone ... |
912 | | * |
913 | | * To ensure the same behavior as the scan stage, I get query_options query_globals from id_file_map, then create runtime_state |
914 | | * and pass it to vfile_scanner so that the runtime_state information is the same as the scan stage and the behavior is also consistent. |
915 | | */ |
916 | 14 | runtime_state = RuntimeState::create_shared( |
917 | 14 | query_id, -1, query_options, query_globals, ExecEnv::GetInstance(), |
918 | 14 | ExecEnv::GetInstance()->rowid_storage_reader_tracker()); |
919 | | |
920 | 14 | max_file_scanners = id_file_map->get_max_file_scanners(); |
921 | 14 | } |
922 | | |
923 | | // Hash(TFileRangeDesc) => { all the rows that need to be read and their positions in the result block. } + file mapping |
924 | | // std::multimap<segment_v2::rowid_t, size_t> : The reason for using multimap is: may need the same row of data multiple times. |
925 | 14 | std::map<std::string, |
926 | 14 | std::pair<std::multimap<segment_v2::rowid_t, size_t>, std::shared_ptr<FileMapping>>> |
927 | 14 | scan_rows; |
928 | | |
929 | | // Block corresponding to the order of `scan_rows` map. |
930 | 14 | std::vector<Block> scan_blocks; |
931 | | |
932 | | // row_id (Indexing of vectors) => < In which block, which line in the block > |
933 | 14 | std::vector<std::pair<size_t, size_t>> row_id_block_idx; |
934 | | |
935 | | // Count the time/bytes it takes to read each TFileRangeDesc. (for profile) |
936 | 14 | std::vector<ExternalFetchStatistics> fetch_statistics; |
937 | | |
938 | 32 | auto hash_file_range = [](const TFileRangeDesc& file_range_desc) { |
939 | 32 | std::string value; |
940 | 32 | value.resize(file_range_desc.path.size() + sizeof(file_range_desc.start_offset)); |
941 | 32 | auto* ptr = value.data(); |
942 | | |
943 | 32 | memcpy(ptr, &file_range_desc.start_offset, sizeof(file_range_desc.start_offset)); |
944 | 32 | ptr += sizeof(file_range_desc.start_offset); |
945 | 32 | memcpy(ptr, file_range_desc.path.data(), file_range_desc.path.size()); |
946 | 32 | return value; |
947 | 32 | }; |
948 | | |
949 | 46 | for (int j = 0; j < request_block_desc.row_id_size(); ++j) { |
950 | 32 | auto file_id = request_block_desc.file_id(j); |
951 | 32 | auto file_mapping = id_file_map->get_file_mapping(file_id); |
952 | 32 | if (!file_mapping) { |
953 | 0 | return Status::InternalError( |
954 | 0 | "Backend:{} file_mapping not found, query_id: {}, file_id: {}", |
955 | 0 | BackendOptions::get_localhost(), print_id(query_id), file_id); |
956 | 0 | } |
957 | | |
958 | 32 | const auto& external_info = file_mapping->get_external_file_info(); |
959 | 32 | const auto& scan_range_desc = external_info.scan_range_desc; |
960 | | |
961 | 32 | auto scan_range_hash = hash_file_range(scan_range_desc); |
962 | 32 | if (scan_rows.contains(scan_range_hash)) { |
963 | 18 | scan_rows.at(scan_range_hash).first.emplace(request_block_desc.row_id(j), j); |
964 | 18 | } else { |
965 | 14 | std::multimap<segment_v2::rowid_t, size_t> tmp {{request_block_desc.row_id(j), j}}; |
966 | 14 | scan_rows.emplace(scan_range_hash, std::make_pair(tmp, file_mapping)); |
967 | 14 | } |
968 | 32 | } |
969 | | |
970 | 14 | scan_blocks.resize(scan_rows.size()); |
971 | 14 | row_id_block_idx.resize(request_block_desc.row_id_size()); |
972 | 14 | fetch_statistics.resize(scan_rows.size()); |
973 | | |
974 | | // Get the workload group for subsequent scan task submission. |
975 | 14 | std::vector<uint64_t> workload_group_ids; |
976 | 14 | workload_group_ids.emplace_back(workload_group_id); |
977 | 14 | auto wg = ExecEnv::GetInstance()->workload_group_mgr()->get_group(workload_group_ids); |
978 | 14 | doris::TaskScheduler* exec_sched = nullptr; |
979 | 14 | ScannerScheduler* scan_sched = nullptr; |
980 | 14 | ScannerScheduler* remote_scan_sched = nullptr; |
981 | 14 | wg->get_query_scheduler(&exec_sched, &scan_sched, &remote_scan_sched); |
982 | 14 | DCHECK(remote_scan_sched); |
983 | | |
984 | 14 | int64_t scan_running_time = 0; |
985 | 14 | RETURN_IF_ERROR(scope_timer_run( |
986 | 14 | [&]() -> Status { |
987 | | // Make sure to insert data into result_block only after all scan tasks have been executed. |
988 | 14 | std::atomic<int> producer_count {0}; |
989 | 14 | std::condition_variable cv; |
990 | 14 | std::mutex mtx; |
991 | | |
992 | | //semaphore: Limit the number of scan tasks submitted at one time |
993 | 14 | std::counting_semaphore semaphore {max_file_scanners}; |
994 | | |
995 | 14 | size_t idx = 0; |
996 | 14 | for (const auto& [_, scan_info] : scan_rows) { |
997 | 14 | semaphore.acquire(); |
998 | 14 | RETURN_IF_ERROR(remote_scan_sched->submit_scan_task( |
999 | 14 | SimplifiedScanTask( |
1000 | 14 | [&, idx, scan_info]() -> Status { |
1001 | 14 | const auto& [row_ids, file_mapping] = scan_info; |
1002 | 14 | return read_external_row_from_file_mapping( |
1003 | 14 | idx, row_ids, file_mapping, slots, query_id, |
1004 | 14 | runtime_state, scan_blocks, row_id_block_idx, |
1005 | 14 | fetch_statistics, rpc_scan_params, |
1006 | 14 | colname_to_slot_id, producer_count, |
1007 | 14 | scan_rows.size(), semaphore, cv, mtx, tuple_desc); |
1008 | 14 | }, |
1009 | 14 | nullptr, nullptr), |
1010 | 14 | fmt::format("{}-read_batch_external_row-{}", print_id(query_id), idx))); |
1011 | 14 | idx++; |
1012 | 14 | } |
1013 | | |
1014 | 14 | { |
1015 | 14 | std::unique_lock<std::mutex> lock(mtx); |
1016 | 14 | cv.wait(lock, [&] { return producer_count == scan_rows.size(); }); |
1017 | 14 | } |
1018 | 14 | return Status::OK(); |
1019 | 14 | }, |
1020 | 14 | &scan_running_time)); |
1021 | | |
1022 | 14 | scatter_scan_blocks_to_result_block(row_id_block_idx, scan_blocks, result_block); |
1023 | | |
1024 | | // Statistical runtime profile information. |
1025 | 14 | std::unique_ptr<RuntimeProfile> runtime_profile = |
1026 | 14 | std::make_unique<RuntimeProfile>("ExternalRowIDFetcher"); |
1027 | 14 | { |
1028 | 14 | runtime_profile->add_info_string(ScannersRunningTimeProfile, |
1029 | 14 | std::to_string(scan_running_time) + "ms"); |
1030 | 14 | fmt::memory_buffer file_read_lines_buffer; |
1031 | 14 | format_to(file_read_lines_buffer, "["); |
1032 | 14 | fmt::memory_buffer file_read_bytes_buffer; |
1033 | 14 | format_to(file_read_bytes_buffer, "["); |
1034 | 14 | fmt::memory_buffer file_read_times_buffer; |
1035 | 14 | format_to(file_read_times_buffer, "["); |
1036 | | |
1037 | 14 | size_t idx = 0; |
1038 | 14 | for (const auto& [_, scan_info] : scan_rows) { |
1039 | 14 | format_to(file_read_lines_buffer, "{}, ", scan_info.first.size()); |
1040 | 14 | *init_reader_avg_ms = fetch_statistics[idx].init_reader_ms; |
1041 | 14 | *get_block_avg_ms += fetch_statistics[idx].get_block_ms; |
1042 | 14 | format_to(file_read_bytes_buffer, "{}, ", fetch_statistics[idx].file_read_bytes); |
1043 | 14 | format_to(file_read_times_buffer, "{}, ", fetch_statistics[idx].file_read_times); |
1044 | 14 | idx++; |
1045 | 14 | } |
1046 | | |
1047 | 14 | format_to(file_read_lines_buffer, "]"); |
1048 | 14 | format_to(file_read_bytes_buffer, "]"); |
1049 | 14 | format_to(file_read_times_buffer, "]"); |
1050 | | |
1051 | 14 | *init_reader_avg_ms /= fetch_statistics.size(); |
1052 | 14 | *get_block_avg_ms /= fetch_statistics.size(); |
1053 | 14 | runtime_profile->add_info_string(InitReaderAvgTimeProfile, |
1054 | 14 | std::to_string(*init_reader_avg_ms) + "ms"); |
1055 | 14 | runtime_profile->add_info_string(GetBlockAvgTimeProfile, |
1056 | 14 | std::to_string(*init_reader_avg_ms) + "ms"); |
1057 | 14 | runtime_profile->add_info_string(FileReadLinesProfile, |
1058 | 14 | fmt::to_string(file_read_lines_buffer)); |
1059 | 14 | runtime_profile->add_info_string(FileScanner::FileReadBytesProfile, |
1060 | 14 | fmt::to_string(file_read_bytes_buffer)); |
1061 | 14 | runtime_profile->add_info_string(FileScanner::FileReadTimeProfile, |
1062 | 14 | fmt::to_string(file_read_times_buffer)); |
1063 | 14 | } |
1064 | | |
1065 | 14 | runtime_profile->to_proto(pprofile, 2); |
1066 | | |
1067 | 14 | *scan_range_cnt = scan_rows.size(); |
1068 | | |
1069 | 14 | return Status::OK(); |
1070 | 14 | } |
1071 | | |
1072 | | Status RowIdStorageReader::read_doris_format_row( |
1073 | | const std::shared_ptr<IdFileMap>& id_file_map, |
1074 | | const std::shared_ptr<FileMapping>& file_mapping, const std::vector<uint32_t>& row_ids, |
1075 | | std::vector<SlotDescriptor>& slots, const TabletSchema& full_read_schema, |
1076 | | RowStoreReadStruct& row_store_read_struct, OlapReaderStatistics& stats, |
1077 | | int64_t* acquire_tablet_ms, int64_t* acquire_rowsets_ms, int64_t* acquire_segments_ms, |
1078 | | int64_t* lookup_row_data_ms, std::unordered_map<SegKey, SegItem, HashOfSegKey>& seg_map, |
1079 | | std::unordered_map<IteratorKey, IteratorItem, HashOfIteratorKey>& iterator_map, |
1080 | 3.24k | Block& result_block) { |
1081 | 3.24k | auto [tablet_id, rowset_id, segment_id] = file_mapping->get_doris_format_info(); |
1082 | 3.24k | SegKey seg_key {.tablet_id = tablet_id, .rowset_id = rowset_id, .segment_id = segment_id}; |
1083 | | |
1084 | 3.24k | BaseTabletSPtr tablet; |
1085 | 3.24k | BetaRowsetSharedPtr rowset; |
1086 | 3.24k | SegmentSharedPtr segment; |
1087 | 3.24k | if (seg_map.find(seg_key) == seg_map.end()) { |
1088 | 3.24k | tablet = scope_timer_run( |
1089 | 3.24k | [&]() { |
1090 | 3.24k | auto res = ExecEnv::get_tablet(tablet_id); |
1091 | 3.24k | return !res.has_value() ? nullptr |
1092 | 3.24k | : std::dynamic_pointer_cast<BaseTablet>(res.value()); |
1093 | 3.24k | }, |
1094 | 3.24k | acquire_tablet_ms); |
1095 | 3.24k | if (!tablet) { |
1096 | 0 | return Status::InternalError( |
1097 | 0 | "Backend:{} tablet not found, tablet_id: {}, rowset_id: {}, segment_id: {}, " |
1098 | 0 | "row_id: {}", |
1099 | 0 | BackendOptions::get_localhost(), tablet_id, rowset_id.to_string(), segment_id, |
1100 | 0 | row_ids[0]); |
1101 | 0 | } |
1102 | | |
1103 | 3.24k | rowset = std::static_pointer_cast<BetaRowset>(scope_timer_run( |
1104 | 3.24k | [&]() { return id_file_map->get_temp_rowset(tablet_id, rowset_id); }, |
1105 | 3.24k | acquire_rowsets_ms)); |
1106 | 3.24k | if (!rowset) { |
1107 | 0 | return Status::InternalError( |
1108 | 0 | "Backend:{} rowset_id not found, tablet_id: {}, rowset_id: {}, segment_id: {}, " |
1109 | 0 | "row_id: {}", |
1110 | 0 | BackendOptions::get_localhost(), tablet_id, rowset_id.to_string(), segment_id, |
1111 | 0 | row_ids[0]); |
1112 | 0 | } |
1113 | | |
1114 | 3.24k | SegmentCacheHandle segment_cache; |
1115 | 3.24k | RETURN_IF_ERROR(scope_timer_run( |
1116 | 3.24k | [&]() { |
1117 | 3.24k | return SegmentLoader::instance()->load_segments(rowset, &segment_cache, true); |
1118 | 3.24k | }, |
1119 | 3.24k | acquire_segments_ms)); |
1120 | | |
1121 | 3.24k | auto it = std::find_if(segment_cache.get_segments().cbegin(), |
1122 | 3.24k | segment_cache.get_segments().cend(), |
1123 | 3.24k | [segment_id](const segment_v2::SegmentSharedPtr& seg) { |
1124 | 3.24k | return seg->id() == segment_id; |
1125 | 3.24k | }); |
1126 | 3.24k | if (it == segment_cache.get_segments().end()) { |
1127 | 0 | return Status::InternalError( |
1128 | 0 | "Backend:{} segment not found, tablet_id: {}, rowset_id: {}, segment_id: {}, " |
1129 | 0 | "row_id: {}", |
1130 | 0 | BackendOptions::get_localhost(), tablet_id, rowset_id.to_string(), segment_id, |
1131 | 0 | row_ids[0]); |
1132 | 0 | } |
1133 | 3.24k | segment = *it; |
1134 | 3.24k | seg_map[seg_key] = SegItem {.tablet = tablet, .rowset = rowset, .segment = segment}; |
1135 | 3.24k | } else { |
1136 | 0 | auto& seg_item = seg_map[seg_key]; |
1137 | 0 | tablet = seg_item.tablet; |
1138 | 0 | rowset = seg_item.rowset; |
1139 | 0 | segment = seg_item.segment; |
1140 | 0 | } |
1141 | | |
1142 | | // if row_store_read_struct not empty, means the line we should read from row_store |
1143 | 3.24k | if (!row_store_read_struct.default_values.empty()) { |
1144 | 1.32k | if (!tablet->tablet_schema()->has_row_store_for_all_columns()) { |
1145 | 0 | return Status::InternalError("Tablet {} does not have row store for all columns", |
1146 | 0 | tablet->tablet_id()); |
1147 | 0 | } |
1148 | 1.32k | auto result_columns_guard = result_block.mutate_columns_scoped(); |
1149 | 1.32k | MutableColumns& result_columns = result_columns_guard.mutable_columns(); |
1150 | 4.42k | for (auto row_id : row_ids) { |
1151 | 4.42k | RowLocation loc(rowset_id, segment->id(), cast_set<uint32_t>(row_id)); |
1152 | 4.42k | row_store_read_struct.row_store_buffer.clear(); |
1153 | 4.42k | RETURN_IF_ERROR(scope_timer_run( |
1154 | 4.42k | [&]() { |
1155 | 4.42k | return tablet->lookup_row_data({}, loc, rowset, stats, |
1156 | 4.42k | row_store_read_struct.row_store_buffer); |
1157 | 4.42k | }, |
1158 | 4.42k | lookup_row_data_ms)); |
1159 | | |
1160 | 4.42k | RETURN_IF_ERROR(JsonbSerializeUtil::jsonb_to_columns( |
1161 | 4.42k | row_store_read_struct.serdes, row_store_read_struct.row_store_buffer.data(), |
1162 | 4.42k | row_store_read_struct.row_store_buffer.size(), |
1163 | 4.42k | row_store_read_struct.col_uid_to_idx, result_columns, |
1164 | 4.42k | row_store_read_struct.default_values, {})); |
1165 | 4.42k | } |
1166 | 1.92k | } else { |
1167 | 14.3k | for (int x = 0; x < slots.size(); ++x) { |
1168 | 12.3k | auto column_guard = result_block.mutate_column_scoped(x); |
1169 | 12.3k | MutableColumnPtr& column = column_guard.mutable_column(); |
1170 | 12.3k | IteratorKey iterator_key {.tablet_id = tablet_id, |
1171 | 12.3k | .rowset_id = rowset_id, |
1172 | 12.3k | .segment_id = segment_id, |
1173 | 12.3k | .slot_id = slots[x].id()}; |
1174 | 12.3k | IteratorItem& iterator_item = iterator_map[iterator_key]; |
1175 | 12.3k | if (iterator_item.segment == nullptr) { |
1176 | 12.3k | iterator_map[iterator_key].segment = segment; |
1177 | 12.3k | iterator_item.storage_read_options.stats = &stats; |
1178 | 12.3k | iterator_item.storage_read_options.io_ctx.reader_type = |
1179 | 12.3k | rowid_fetch_reader_type(slots[x]); |
1180 | 12.3k | } |
1181 | 12.3k | set_slot_access_paths(slots[x], full_read_schema, iterator_item.storage_read_options); |
1182 | 12.3k | RETURN_IF_ERROR(segment->seek_and_read_by_rowid( |
1183 | 12.3k | full_read_schema, &slots[x], row_ids, column, |
1184 | 12.3k | iterator_item.storage_read_options, iterator_item.iterator)); |
1185 | 12.3k | } |
1186 | 1.92k | } |
1187 | 3.24k | return Status::OK(); |
1188 | 3.24k | } |
1189 | | |
1190 | | } // namespace doris |