/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 <utility> |
26 | | #include <vector> |
27 | | |
28 | | #include "common/status.h" |
29 | | #include "exec/tablet_info.h" // DorisNodesInfo |
30 | | #include "vec/core/block.h" |
31 | | #include "vec/data_types/data_type.h" |
32 | | |
33 | | namespace doris { |
34 | | |
35 | | class DorisNodesInfo; |
36 | | class RuntimeState; |
37 | | class TupleDescriptor; |
38 | | |
39 | | namespace vectorized { |
40 | | template <typename T> |
41 | | class ColumnStr; |
42 | | using ColumnString = ColumnStr<UInt32>; |
43 | | class MutableBlock; |
44 | | } // namespace vectorized |
45 | | |
46 | | // fetch rows by global rowid |
47 | | // tablet_id/rowset_name/segment_id/ordinal_id |
48 | | |
49 | | struct FetchOption { |
50 | | TupleDescriptor* desc = nullptr; |
51 | | RuntimeState* runtime_state = nullptr; |
52 | | TFetchOption t_fetch_opt; |
53 | | }; |
54 | | |
55 | | class RowIDFetcher { |
56 | | public: |
57 | 0 | RowIDFetcher(FetchOption fetch_opt) : _fetch_option(std::move(fetch_opt)) {} |
58 | | Status init(); |
59 | | Status fetch(const vectorized::ColumnPtr& row_ids, vectorized::Block* block); |
60 | | |
61 | | private: |
62 | | PMultiGetRequest _init_fetch_request(const vectorized::ColumnString& row_ids) const; |
63 | | Status _merge_rpc_results(const PMultiGetRequest& request, |
64 | | const std::vector<PMultiGetResponse>& rsps, |
65 | | const std::vector<brpc::Controller>& cntls, |
66 | | vectorized::Block* output_block, |
67 | | std::vector<PRowLocation>* rows_id) const; |
68 | | |
69 | | std::vector<std::shared_ptr<PBackendService_Stub>> _stubs; |
70 | | FetchOption _fetch_option; |
71 | | }; |
72 | | |
73 | | class RowIdStorageReader { |
74 | | public: |
75 | | static Status read_by_rowids(const PMultiGetRequest& request, PMultiGetResponse* response); |
76 | | }; |
77 | | |
78 | | } // namespace doris |