/root/doris/be/src/vec/exprs/vliteral.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 <memory> |
21 | | #include <string> |
22 | | |
23 | | #include "common/object_pool.h" |
24 | | #include "common/status.h" |
25 | | #include "vec/data_types/data_type.h" |
26 | | #include "vec/exprs/vexpr.h" |
27 | | |
28 | | namespace doris { |
29 | | class TExprNode; |
30 | | |
31 | | namespace vectorized { |
32 | | class Block; |
33 | | class VExprContext; |
34 | | |
35 | | class VLiteral : public VExpr { |
36 | | ENABLE_FACTORY_CREATOR(VLiteral); |
37 | | |
38 | | public: |
39 | | VLiteral(const TExprNode& node, bool should_init = true) |
40 | 14 | : VExpr(node), _expr_name(_data_type->get_name()) { |
41 | 14 | if (should_init) { |
42 | 14 | init(node); |
43 | 14 | } |
44 | 14 | } |
45 | | |
46 | | Status prepare(RuntimeState* state, const RowDescriptor& desc, VExprContext* context) override; |
47 | | Status execute(VExprContext* context, Block* block, int* result_column_id) override; |
48 | | |
49 | 0 | const std::string& expr_name() const override { return _expr_name; } |
50 | | std::string debug_string() const override; |
51 | | |
52 | | std::string value() const; |
53 | | |
54 | 0 | const ColumnPtr& get_column_ptr() const { return _column_ptr; } |
55 | 0 | const DataTypePtr& get_data_type() const { return _data_type; } |
56 | | |
57 | 0 | bool is_literal() const override { return true; } |
58 | | |
59 | | bool equals(const VExpr& other) override; |
60 | | |
61 | | protected: |
62 | | ColumnPtr _column_ptr; |
63 | | std::string _expr_name; |
64 | | |
65 | | private: |
66 | | void init(const TExprNode& node); |
67 | | }; |
68 | | } // namespace vectorized |
69 | | |
70 | | } // namespace doris |