/root/doris/be/src/exec/rowid_fetcher.h
Line | Count | Source (jump to first uncovered line) |
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 | | #pragma once |
19 | | |
20 | | #include <brpc/controller.h> |
21 | | #include <gen_cpp/DataSinks_types.h> |
22 | | #include <gen_cpp/internal_service.pb.h> |
23 | | |
24 | | #include <memory> |
25 | | #include <vector> |
26 | | |
27 | | #include "common/status.h" |
28 | | #include "exec/tablet_info.h" // DorisNodesInfo |
29 | | #include "vec/core/block.h" |
30 | | #include "vec/data_types/data_type.h" |
31 | | |
32 | | namespace doris { |
33 | | |
34 | | class DorisNodesInfo; |
35 | | class RuntimeState; |
36 | | class TupleDescriptor; |
37 | | |
38 | | namespace vectorized { |
39 | | class ColumnString; |
40 | | class MutableBlock; |
41 | | } // namespace vectorized |
42 | | |
43 | | // fetch rows by global rowid |
44 | | // tablet_id/rowset_name/segment_id/ordinal_id |
45 | | |
46 | | struct FetchOption { |
47 | | TupleDescriptor* desc = nullptr; |
48 | | RuntimeState* runtime_state = nullptr; |
49 | | TFetchOption t_fetch_opt; |
50 | | }; |
51 | | |
52 | | class RowIDFetcher { |
53 | | public: |
54 | 0 | RowIDFetcher(const FetchOption& fetch_opt) : _fetch_option(fetch_opt) {} |
55 | | Status init(); |
56 | | Status fetch(const vectorized::ColumnPtr& row_ids, vectorized::Block* block); |
57 | | |
58 | | private: |
59 | | PMultiGetRequest _init_fetch_request(const vectorized::ColumnString& row_ids) const; |
60 | | Status _merge_rpc_results(const PMultiGetRequest& request, |
61 | | const std::vector<PMultiGetResponse>& rsps, |
62 | | const std::vector<brpc::Controller>& cntls, |
63 | | vectorized::Block* output_block, |
64 | | std::vector<PRowLocation>* rows_id) const; |
65 | | |
66 | | std::vector<std::shared_ptr<PBackendService_Stub>> _stubs; |
67 | | FetchOption _fetch_option; |
68 | | }; |
69 | | |
70 | | } // namespace doris |