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 | | #include <string> |
20 | | |
21 | | #include "common/object_pool.h" |
22 | | #include "common/status.h" |
23 | | #include "exprs/vexpr.h" |
24 | | |
25 | | namespace doris { |
26 | | class SlotDescriptor; |
27 | | class RowDescriptor; |
28 | | class RuntimeState; |
29 | | class TExprNode; |
30 | | |
31 | | class Block; |
32 | | class VExprContext; |
33 | | |
34 | | class VSlotRef MOCK_REMOVE(final) : public VExpr { |
35 | | ENABLE_FACTORY_CREATOR(VSlotRef); |
36 | | |
37 | | public: |
38 | | VSlotRef(const TExprNode& node); |
39 | | VSlotRef(const SlotDescriptor* desc); |
40 | | #ifdef BE_TEST |
41 | | VSlotRef() = default; |
42 | | void set_column_id(int column_id) { _column_id = column_id; } |
43 | | void set_slot_id(int slot_id) { _slot_id = slot_id; } |
44 | | #endif |
45 | | Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override; |
46 | | Status open(RuntimeState* state, VExprContext* context, |
47 | | FunctionContext::FunctionStateScope scope) override; |
48 | | Status execute(VExprContext* context, Block* block, int* result_column_id) const override; |
49 | | Status execute_column(VExprContext* context, const Block* block, Selector* selector, |
50 | | size_t count, ColumnPtr& result_column) const override; |
51 | | DataTypePtr execute_type(const Block* block) const override; |
52 | | |
53 | | const std::string& expr_name() const override; |
54 | | std::string expr_label() override; |
55 | | std::string debug_string() const override; |
56 | 2.99M | bool is_constant() const override { return false; } |
57 | | |
58 | 162k | int column_id() const { return _column_id; } |
59 | | |
60 | 725k | MOCK_FUNCTION int slot_id() const { return _slot_id; } |
61 | | |
62 | | bool equals(const VExpr& other) override; |
63 | | |
64 | 420 | size_t estimate_memory(const size_t rows) override { return 0; } |
65 | | |
66 | 24 | void collect_slot_column_ids(std::set<int>& column_ids) const override { |
67 | 24 | column_ids.insert(_column_id); |
68 | 24 | } |
69 | | |
70 | 0 | MOCK_FUNCTION const std::string& column_name() const { return *_column_name; } |
71 | | |
72 | | uint64_t get_digest(uint64_t seed) const override; |
73 | | |
74 | 570k | double execute_cost() const override { return 0.0; } |
75 | | |
76 | | private: |
77 | | int _slot_id; |
78 | | int _column_id; |
79 | | int _column_uniq_id = -1; |
80 | | const std::string* _column_name = nullptr; |
81 | | const std::string _column_label; |
82 | | }; |
83 | | } // namespace doris |