be/src/runtime/fold_constant_executor.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 <gen_cpp/Types_types.h> |
21 | | #include <stddef.h> |
22 | | |
23 | | #include <memory> |
24 | | #include <string> |
25 | | |
26 | | #include "common/object_pool.h" |
27 | | #include "common/status.h" |
28 | | #include "core/data_type/data_type.h" |
29 | | #include "core/data_type_serde/data_type_serde.h" |
30 | | #include "exprs/aggregate/aggregate_function.h" |
31 | | #include "runtime/memory/mem_tracker.h" |
32 | | #include "runtime/runtime_state.h" |
33 | | |
34 | | namespace doris { |
35 | | |
36 | | class TFoldConstantParams; |
37 | | class TQueryGlobals; |
38 | | class PConstantExprResult; |
39 | | class RuntimeProfile; |
40 | | class TQueryOptions; |
41 | | |
42 | | // This class used to fold constant expr from fe |
43 | | class FoldConstantExecutor { |
44 | | public: |
45 | | // fold constant vexpr |
46 | | Status fold_constant_vexpr(const TFoldConstantParams& params, PConstantExprResult* response); |
47 | 0 | std::string query_id_string() { return print_id(_query_id); } |
48 | | |
49 | | private: |
50 | | // init runtime_state and mem_tracker |
51 | | Status _init(const TQueryGlobals& query_globals, const TQueryOptions& query_options); |
52 | | // prepare expr |
53 | | template <typename Context> |
54 | | Status _prepare_and_open(Context* ctx); |
55 | | |
56 | | Status _get_result(void* src, size_t size, const DataTypePtr& type, ColumnPtr column_ptr, |
57 | | DataTypePtr column_type, std::string& result, |
58 | | const DataTypeSerDe::FormatOptions& options); |
59 | | |
60 | | std::unique_ptr<RuntimeState> _runtime_state; |
61 | | std::shared_ptr<MemTrackerLimiter> _mem_tracker; |
62 | | RuntimeProfile* _runtime_profile = nullptr; |
63 | | ObjectPool _pool; |
64 | | TUniqueId _query_id; |
65 | | }; |
66 | | } // namespace doris |