be/src/exprs/vinfo_func.cpp
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 | | #include "exprs/vinfo_func.h" |
19 | | |
20 | | #include <gen_cpp/Exprs_types.h> |
21 | | #include <glog/logging.h> |
22 | | |
23 | | #include <algorithm> |
24 | | |
25 | | #include "core/block/block.h" |
26 | | #include "core/data_type/data_type.h" |
27 | | #include "core/data_type/define_primitive_type.h" |
28 | | #include "core/field.h" |
29 | | #include "core/types.h" |
30 | | |
31 | | namespace doris { |
32 | | #include "common/compile_check_begin.h" |
33 | | |
34 | | class VExprContext; |
35 | | |
36 | 0 | VInfoFunc::VInfoFunc(const TExprNode& node) : VExpr(node) { |
37 | 0 | Field field; |
38 | 0 | switch (_data_type->get_primitive_type()) { |
39 | 0 | case TYPE_BIGINT: { |
40 | 0 | field = Field::create_field<TYPE_BIGINT>(Int64(node.info_func.int_value)); |
41 | 0 | break; |
42 | 0 | } |
43 | 0 | case TYPE_STRING: |
44 | 0 | case TYPE_CHAR: |
45 | 0 | case TYPE_VARCHAR: { |
46 | 0 | field = Field::create_field<TYPE_STRING>(node.info_func.str_value); |
47 | 0 | break; |
48 | 0 | } |
49 | 0 | default: { |
50 | 0 | DCHECK(false) << "Invalid type: " << _data_type->get_name(); |
51 | 0 | break; |
52 | 0 | } |
53 | 0 | } |
54 | 0 | this->_column_ptr = _data_type->create_column_const(1, field); |
55 | 0 | } |
56 | | |
57 | | Status VInfoFunc::execute_column(VExprContext* context, const Block* block, Selector* selector, |
58 | 0 | size_t count, ColumnPtr& result_column) const { |
59 | 0 | result_column = _column_ptr->clone_resized(count); |
60 | | DCHECK_EQ(result_column->size(), count); |
61 | 0 | return Status::OK(); |
62 | 0 | } |
63 | | |
64 | | #include "common/compile_check_end.h" |
65 | | } // namespace doris |