be/src/exec/pipeline/rec_cte_shared_state.h
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 | | #pragma once |
19 | | |
20 | | #include "exec/pipeline/dependency.h" |
21 | | |
22 | | namespace doris { |
23 | | |
24 | | struct DistinctDataVariants; |
25 | | |
26 | | struct RecCTESharedState : public BasicSharedState { |
27 | | // Defined in rec_cte_shared_state.cpp: DistinctDataVariants carries the |
28 | | // full hash-table variant machinery. |
29 | | RecCTESharedState(); |
30 | | ~RecCTESharedState() override; |
31 | | |
32 | | std::vector<TRecCTETarget> targets; |
33 | | std::vector<Block> blocks; |
34 | | IColumn::Selector distinct_row; |
35 | | Dependency* source_dep = nullptr; |
36 | | Dependency* anchor_dep = nullptr; |
37 | | Arena arena; |
38 | | RuntimeProfile::Counter* hash_table_compute_timer = nullptr; |
39 | | RuntimeProfile::Counter* hash_table_emplace_timer = nullptr; |
40 | | RuntimeProfile::Counter* hash_table_input_counter = nullptr; |
41 | | |
42 | | // No `= nullptr` initializer: a default member initializer makes GCC |
43 | | // instantiate ~unique_ptr<DistinctDataVariants> in every TU that merely sees |
44 | | // this class, which needs the complete type. The defaulted constructor in |
45 | | // rec_cte_shared_state.cpp already leaves this null. |
46 | | std::unique_ptr<DistinctDataVariants> agg_data; |
47 | | |
48 | | int current_round = 0; |
49 | | int last_round_offset = 0; |
50 | | int max_recursion_depth = 0; |
51 | | bool ready_to_return = false; |
52 | | |
53 | 0 | void update_ready_to_return() { |
54 | 0 | if (last_round_offset == blocks.size()) { |
55 | 0 | ready_to_return = true; |
56 | 0 | } |
57 | 0 | } |
58 | | |
59 | | // Bodies live in rec_cte_shared_state.cpp: they touch the distinct hash |
60 | | // table variant machinery and the brpc client stack. |
61 | | Status emplace_block(RuntimeState* state, Block&& block); |
62 | | |
63 | | PTransmitRecCTEBlockParams build_basic_param(RuntimeState* state, |
64 | | const TRecCTETarget& target) const; |
65 | | |
66 | | Status send_data_to_targets(RuntimeState* state, size_t round_offset) const; |
67 | | }; |
68 | | |
69 | | } // namespace doris |