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 | | // This file is copied from |
18 | | // https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Field.h |
19 | | // and modified by Doris |
20 | | |
21 | | #pragma once |
22 | | |
23 | | #include <fmt/format.h> |
24 | | #include <glog/logging.h> |
25 | | |
26 | | #include <algorithm> |
27 | | #include <cassert> |
28 | | #include <cstring> |
29 | | #include <string> |
30 | | #include <string_view> |
31 | | #include <type_traits> |
32 | | #include <utility> |
33 | | #include <vector> |
34 | | |
35 | | #include "common/compiler_util.h" // IWYU pragma: keep |
36 | | #include "common/exception.h" |
37 | | #include "core/data_type/primitive_type.h" |
38 | | #include "core/string_view.h" |
39 | | #include "core/types.h" |
40 | | #include "core/uint128.h" |
41 | | #include "core/value/bitmap_value.h" |
42 | | #include "core/value/hll.h" |
43 | | #include "core/value/quantile_state.h" |
44 | | #include "core/value/variant/variant_field.h" |
45 | | |
46 | | namespace doris { |
47 | | template <PrimitiveType type> |
48 | | struct PrimitiveTypeTraits; |
49 | | template <typename T> |
50 | | struct TypeName; |
51 | | struct PackedInt128; |
52 | | } // namespace doris |
53 | | |
54 | | namespace doris { |
55 | | |
56 | | class Field; |
57 | | |
58 | | using FieldVector = std::vector<Field>; |
59 | | |
60 | | /// Array and Struct use the same storage type -- FieldVector, but we declare |
61 | | /// distinct types for them, so that the caller can choose whether it wants to |
62 | | /// construct a Field of Array or a Struct type. An alternative approach would be |
63 | | /// to construct both of these types from FieldVector, and have the caller |
64 | | /// specify the desired Field type explicitly. |
65 | | struct Array : public FieldVector { |
66 | | using FieldVector::FieldVector; |
67 | | }; |
68 | | |
69 | | struct Struct : public FieldVector { |
70 | | using FieldVector::FieldVector; |
71 | | }; |
72 | | |
73 | | struct Map : public FieldVector { |
74 | | using FieldVector::FieldVector; |
75 | | }; |
76 | | |
77 | | //TODO: rethink if we really need this? it only save one pointer from std::string |
78 | | // not POD type so could only use read/write_json_binary instead of read/write_binary |
79 | | class JsonbField { |
80 | | public: |
81 | 192k | JsonbField() = default; |
82 | 7.25M | ~JsonbField() = default; // unique_ptr will handle cleanup automatically |
83 | | |
84 | 1.60M | JsonbField(const char* ptr, size_t len) : size(len) { |
85 | 1.60M | data = std::make_unique<char[]>(size); |
86 | 1.60M | if (!data) { |
87 | 0 | throw Exception(Status::FatalError("new data buffer failed, size: {}", size)); |
88 | 0 | } |
89 | 1.60M | if (size > 0) { |
90 | 1.60M | memcpy(data.get(), ptr, size); |
91 | 1.60M | } |
92 | 1.60M | } |
93 | | |
94 | 1.67M | JsonbField(const JsonbField& x) : size(x.size) { |
95 | 1.67M | data = std::make_unique<char[]>(size); |
96 | 1.67M | if (!data) { |
97 | 0 | throw Exception(Status::FatalError("new data buffer failed, size: {}", size)); |
98 | 0 | } |
99 | 1.67M | if (size > 0) { |
100 | 1.67M | memcpy(data.get(), x.data.get(), size); |
101 | 1.67M | } |
102 | 1.67M | } |
103 | | |
104 | 3.78M | JsonbField(JsonbField&& x) noexcept : data(std::move(x.data)), size(x.size) { x.size = 0; } |
105 | | |
106 | | // dispatch for all type of storage. so need this. but not really used now. |
107 | 2 | JsonbField& operator=(const JsonbField& x) { |
108 | 2 | if (this != &x) { |
109 | 2 | data = std::make_unique<char[]>(x.size); |
110 | 2 | if (!data) { |
111 | 0 | throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size)); |
112 | 0 | } |
113 | 2 | if (x.size > 0) { |
114 | 1 | memcpy(data.get(), x.data.get(), x.size); |
115 | 1 | } |
116 | 2 | size = x.size; |
117 | 2 | } |
118 | 2 | return *this; |
119 | 2 | } |
120 | | |
121 | 191k | JsonbField& operator=(JsonbField&& x) noexcept { |
122 | 191k | if (this != &x) { |
123 | 191k | data = std::move(x.data); |
124 | 191k | size = x.size; |
125 | 191k | x.size = 0; |
126 | 191k | } |
127 | 191k | return *this; |
128 | 191k | } |
129 | | |
130 | 1.20M | const char* get_value() const { return data.get(); } |
131 | 1.20M | size_t get_size() const { return size; } |
132 | | |
133 | 0 | bool operator<(const JsonbField& r) const { |
134 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
135 | 0 | } |
136 | 0 | bool operator<=(const JsonbField& r) const { |
137 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
138 | 0 | } |
139 | 0 | bool operator==(const JsonbField& r) const { |
140 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
141 | 0 | } |
142 | 0 | bool operator>(const JsonbField& r) const { |
143 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
144 | 0 | } |
145 | 0 | bool operator>=(const JsonbField& r) const { |
146 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
147 | 0 | } |
148 | 0 | bool operator!=(const JsonbField& r) const { |
149 | 0 | throw Exception(Status::FatalError("comparing between JsonbField is not supported")); |
150 | 0 | } |
151 | | |
152 | 0 | const JsonbField& operator+=(const JsonbField& r) { |
153 | 0 | throw Exception(Status::FatalError("Not support plus opration on JsonbField")); |
154 | 0 | } |
155 | | |
156 | 0 | const JsonbField& operator-=(const JsonbField& r) { |
157 | 0 | throw Exception(Status::FatalError("Not support minus opration on JsonbField")); |
158 | 0 | } |
159 | | |
160 | | private: |
161 | | std::unique_ptr<char[]> data = nullptr; |
162 | | size_t size = 0; |
163 | | }; |
164 | | |
165 | | template <typename T> |
166 | | bool decimal_equal(T x, T y, UInt32 x_scale, UInt32 y_scale); |
167 | | template <typename T> |
168 | | bool decimal_less(T x, T y, UInt32 x_scale, UInt32 y_scale); |
169 | | template <typename T> |
170 | | bool decimal_less_or_equal(T x, T y, UInt32 x_scale, UInt32 y_scale); |
171 | | |
172 | | /** 32 is enough. Round number is used for alignment and for better arithmetic inside std::vector. |
173 | | * NOTE: Actually, sizeof(std::string) is 32 when using libc++, so Field is 40 bytes. |
174 | | */ |
175 | | constexpr size_t DBMS_MIN_FIELD_SIZE = 32; |
176 | | |
177 | | /** Discriminated union of several types. |
178 | | * Made for replacement of `boost::variant` |
179 | | * is not generalized, |
180 | | * but somewhat more efficient, and simpler. |
181 | | * |
182 | | * Used to represent a single value of one of several types in memory. |
183 | | * Warning! Prefer to use chunks of columns instead of single values. See Column.h |
184 | | */ |
185 | | class Field { |
186 | | public: |
187 | | static const int MIN_NON_POD = 16; |
188 | 48.0M | Field() : type(PrimitiveType::TYPE_NULL) {} |
189 | | // set Types::Null explictly and avoid other types |
190 | 86.3M | Field(PrimitiveType w) : type(w) {} |
191 | | template <PrimitiveType T> |
192 | 23.9M | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { |
193 | 23.9M | auto f = Field(T); |
194 | 23.9M | f.template create_concrete<T>(data); |
195 | 23.9M | return f; |
196 | 23.9M | } _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 312k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 312k | auto f = Field(T); | 194 | 312k | f.template create_concrete<T>(data); | 195 | 312k | return f; | 196 | 312k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 21.8k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 21.8k | auto f = Field(T); | 194 | 21.8k | f.template create_concrete<T>(data); | 195 | 21.8k | return f; | 196 | 21.8k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 16 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 16 | auto f = Field(T); | 194 | 16 | f.template create_concrete<T>(data); | 195 | 16 | return f; | 196 | 16 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 23.1M | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 23.1M | auto f = Field(T); | 194 | 23.1M | f.template create_concrete<T>(data); | 195 | 23.1M | return f; | 196 | 23.1M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 2.42k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 2.42k | auto f = Field(T); | 194 | 2.42k | f.template create_concrete<T>(data); | 195 | 2.42k | return f; | 196 | 2.42k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 22.3k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 22.3k | auto f = Field(T); | 194 | 22.3k | f.template create_concrete<T>(data); | 195 | 22.3k | return f; | 196 | 22.3k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 404 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 404 | auto f = Field(T); | 194 | 404 | f.template create_concrete<T>(data); | 195 | 404 | return f; | 196 | 404 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 44.6k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 44.6k | auto f = Field(T); | 194 | 44.6k | f.template create_concrete<T>(data); | 195 | 44.6k | return f; | 196 | 44.6k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 825 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 825 | auto f = Field(T); | 194 | 825 | f.template create_concrete<T>(data); | 195 | 825 | return f; | 196 | 825 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 26 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 26 | auto f = Field(T); | 194 | 26 | f.template create_concrete<T>(data); | 195 | 26 | return f; | 196 | 26 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 32.6k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 32.6k | auto f = Field(T); | 194 | 32.6k | f.template create_concrete<T>(data); | 195 | 32.6k | return f; | 196 | 32.6k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 47.0k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 47.0k | auto f = Field(T); | 194 | 47.0k | f.template create_concrete<T>(data); | 195 | 47.0k | return f; | 196 | 47.0k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 6.52k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 6.52k | auto f = Field(T); | 194 | 6.52k | f.template create_concrete<T>(data); | 195 | 6.52k | return f; | 196 | 6.52k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 4 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 4 | auto f = Field(T); | 194 | 4 | f.template create_concrete<T>(data); | 195 | 4 | return f; | 196 | 4 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 50.9k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 50.9k | auto f = Field(T); | 194 | 50.9k | f.template create_concrete<T>(data); | 195 | 50.9k | return f; | 196 | 50.9k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 26.2k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 26.2k | auto f = Field(T); | 194 | 26.2k | f.template create_concrete<T>(data); | 195 | 26.2k | return f; | 196 | 26.2k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 24.5k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 24.5k | auto f = Field(T); | 194 | 24.5k | f.template create_concrete<T>(data); | 195 | 24.5k | return f; | 196 | 24.5k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 18.1k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 18.1k | auto f = Field(T); | 194 | 18.1k | f.template create_concrete<T>(data); | 195 | 18.1k | return f; | 196 | 18.1k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 21.1k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 21.1k | auto f = Field(T); | 194 | 21.1k | f.template create_concrete<T>(data); | 195 | 21.1k | return f; | 196 | 21.1k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 24.4k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 24.4k | auto f = Field(T); | 194 | 24.4k | f.template create_concrete<T>(data); | 195 | 24.4k | return f; | 196 | 24.4k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 130 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 130 | auto f = Field(T); | 194 | 130 | f.template create_concrete<T>(data); | 195 | 130 | return f; | 196 | 130 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 2.85k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 2.85k | auto f = Field(T); | 194 | 2.85k | f.template create_concrete<T>(data); | 195 | 2.85k | return f; | 196 | 2.85k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 8.57k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 8.57k | auto f = Field(T); | 194 | 8.57k | f.template create_concrete<T>(data); | 195 | 8.57k | return f; | 196 | 8.57k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 8.73k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 8.73k | auto f = Field(T); | 194 | 8.73k | f.template create_concrete<T>(data); | 195 | 8.73k | return f; | 196 | 8.73k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 13.3k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 13.3k | auto f = Field(T); | 194 | 13.3k | f.template create_concrete<T>(data); | 195 | 13.3k | return f; | 196 | 13.3k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 9.75k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 9.75k | auto f = Field(T); | 194 | 9.75k | f.template create_concrete<T>(data); | 195 | 9.75k | return f; | 196 | 9.75k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 19.5k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 19.5k | auto f = Field(T); | 194 | 19.5k | f.template create_concrete<T>(data); | 195 | 19.5k | return f; | 196 | 19.5k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 22.1k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 22.1k | auto f = Field(T); | 194 | 22.1k | f.template create_concrete<T>(data); | 195 | 22.1k | return f; | 196 | 22.1k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 34.9k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 34.9k | auto f = Field(T); | 194 | 34.9k | f.template create_concrete<T>(data); | 195 | 34.9k | return f; | 196 | 34.9k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 33.0k | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 33.0k | auto f = Field(T); | 194 | 33.0k | f.template create_concrete<T>(data); | 195 | 33.0k | return f; | 196 | 33.0k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 192 | 17 | static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) { | 193 | 17 | auto f = Field(T); | 194 | 17 | f.template create_concrete<T>(data); | 195 | 17 | return f; | 196 | 17 | } |
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE |
197 | | template <PrimitiveType T> |
198 | 62.1M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { |
199 | 62.1M | auto f = Field(T); |
200 | 62.1M | f.template create_concrete<T>(std::move(data)); |
201 | 62.1M | return f; |
202 | 62.1M | } _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 2.36M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 2.36M | auto f = Field(T); | 200 | 2.36M | f.template create_concrete<T>(std::move(data)); | 201 | 2.36M | return f; | 202 | 2.36M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 265 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 265 | auto f = Field(T); | 200 | 265 | f.template create_concrete<T>(std::move(data)); | 201 | 265 | return f; | 202 | 265 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 845k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 845k | auto f = Field(T); | 200 | 845k | f.template create_concrete<T>(std::move(data)); | 201 | 845k | return f; | 202 | 845k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 14.9M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 14.9M | auto f = Field(T); | 200 | 14.9M | f.template create_concrete<T>(std::move(data)); | 201 | 14.9M | return f; | 202 | 14.9M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 95.7k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 95.7k | auto f = Field(T); | 200 | 95.7k | f.template create_concrete<T>(std::move(data)); | 201 | 95.7k | return f; | 202 | 95.7k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 29 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 29 | auto f = Field(T); | 200 | 29 | f.template create_concrete<T>(std::move(data)); | 201 | 29 | return f; | 202 | 29 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 9.56k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 9.56k | auto f = Field(T); | 200 | 9.56k | f.template create_concrete<T>(std::move(data)); | 201 | 9.56k | return f; | 202 | 9.56k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 28.3M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 28.3M | auto f = Field(T); | 200 | 28.3M | f.template create_concrete<T>(std::move(data)); | 201 | 28.3M | return f; | 202 | 28.3M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 13.5M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 13.5M | auto f = Field(T); | 200 | 13.5M | f.template create_concrete<T>(std::move(data)); | 201 | 13.5M | return f; | 202 | 13.5M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 1.79M | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 1.79M | auto f = Field(T); | 200 | 1.79M | f.template create_concrete<T>(std::move(data)); | 201 | 1.79M | return f; | 202 | 1.79M | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 86.0k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 86.0k | auto f = Field(T); | 200 | 86.0k | f.template create_concrete<T>(std::move(data)); | 201 | 86.0k | return f; | 202 | 86.0k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 4.94k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 4.94k | auto f = Field(T); | 200 | 4.94k | f.template create_concrete<T>(std::move(data)); | 201 | 4.94k | return f; | 202 | 4.94k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 88 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 88 | auto f = Field(T); | 200 | 88 | f.template create_concrete<T>(std::move(data)); | 201 | 88 | return f; | 202 | 88 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 798 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 798 | auto f = Field(T); | 200 | 798 | f.template create_concrete<T>(std::move(data)); | 201 | 798 | return f; | 202 | 798 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 116k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 116k | auto f = Field(T); | 200 | 116k | f.template create_concrete<T>(std::move(data)); | 201 | 116k | return f; | 202 | 116k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 23.1k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 23.1k | auto f = Field(T); | 200 | 23.1k | f.template create_concrete<T>(std::move(data)); | 201 | 23.1k | return f; | 202 | 23.1k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 74 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 74 | auto f = Field(T); | 200 | 74 | f.template create_concrete<T>(std::move(data)); | 201 | 74 | return f; | 202 | 74 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 1.74k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 1.74k | auto f = Field(T); | 200 | 1.74k | f.template create_concrete<T>(std::move(data)); | 201 | 1.74k | return f; | 202 | 1.74k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 3.32k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 3.32k | auto f = Field(T); | 200 | 3.32k | f.template create_concrete<T>(std::move(data)); | 201 | 3.32k | return f; | 202 | 3.32k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 330 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 330 | auto f = Field(T); | 200 | 330 | f.template create_concrete<T>(std::move(data)); | 201 | 330 | return f; | 202 | 330 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 12 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 12 | auto f = Field(T); | 200 | 12 | f.template create_concrete<T>(std::move(data)); | 201 | 12 | return f; | 202 | 12 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 816 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 816 | auto f = Field(T); | 200 | 816 | f.template create_concrete<T>(std::move(data)); | 201 | 816 | return f; | 202 | 816 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 10 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 10 | auto f = Field(T); | 200 | 10 | f.template create_concrete<T>(std::move(data)); | 201 | 10 | return f; | 202 | 10 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 86 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 86 | auto f = Field(T); | 200 | 86 | f.template create_concrete<T>(std::move(data)); | 201 | 86 | return f; | 202 | 86 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 6 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 6 | auto f = Field(T); | 200 | 6 | f.template create_concrete<T>(std::move(data)); | 201 | 6 | return f; | 202 | 6 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 10 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 10 | auto f = Field(T); | 200 | 10 | f.template create_concrete<T>(std::move(data)); | 201 | 10 | return f; | 202 | 10 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 2.72k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 2.72k | auto f = Field(T); | 200 | 2.72k | f.template create_concrete<T>(std::move(data)); | 201 | 2.72k | return f; | 202 | 2.72k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 40 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 40 | auto f = Field(T); | 200 | 40 | f.template create_concrete<T>(std::move(data)); | 201 | 40 | return f; | 202 | 40 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 66 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 66 | auto f = Field(T); | 200 | 66 | f.template create_concrete<T>(std::move(data)); | 201 | 66 | return f; | 202 | 66 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 4 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 4 | auto f = Field(T); | 200 | 4 | f.template create_concrete<T>(std::move(data)); | 201 | 4 | return f; | 202 | 4 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 27 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 27 | auto f = Field(T); | 200 | 27 | f.template create_concrete<T>(std::move(data)); | 201 | 27 | return f; | 202 | 27 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 3.00k | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 3.00k | auto f = Field(T); | 200 | 3.00k | f.template create_concrete<T>(std::move(data)); | 201 | 3.00k | return f; | 202 | 3.00k | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 50 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 50 | auto f = Field(T); | 200 | 50 | f.template create_concrete<T>(std::move(data)); | 201 | 50 | return f; | 202 | 50 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 79 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 79 | auto f = Field(T); | 200 | 79 | f.template create_concrete<T>(std::move(data)); | 201 | 79 | return f; | 202 | 79 | } |
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE Line | Count | Source | 198 | 25 | static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) { | 199 | 25 | auto f = Field(T); | 200 | 25 | f.template create_concrete<T>(std::move(data)); | 201 | 25 | return f; | 202 | 25 | } |
|
203 | | |
204 | | template <PrimitiveType PType, typename ValType = std::conditional_t< |
205 | | doris::is_string_type(PType), StringRef, |
206 | | typename PrimitiveTypeTraits<PType>::StorageFieldType>> |
207 | 33.7k | static Field create_field_from_olap_value(const ValType& data) { |
208 | 33.7k | auto f = Field(PType); |
209 | 33.7k | typename PrimitiveTypeTraits<PType>::CppType cpp_value; |
210 | 33.7k | if constexpr (is_string_type(PType)) { |
211 | 13.7k | cpp_value = String(data.data, data.size); |
212 | 13.7k | } else if constexpr (is_date_or_datetime(PType)) { |
213 | 58 | if constexpr (PType == TYPE_DATE) { |
214 | 21 | cpp_value.from_olap_date(data); |
215 | 37 | } else { |
216 | 37 | cpp_value.from_olap_datetime(data); |
217 | 37 | } |
218 | 58 | } else if constexpr (is_decimalv2(PType)) { |
219 | 31 | cpp_value = DecimalV2Value(data.integer, data.fraction); |
220 | 19.9k | } else { |
221 | 19.9k | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); |
222 | 19.9k | } |
223 | 33.7k | f.template create_concrete<PType>(std::move(cpp_value)); |
224 | 33.7k | return f; |
225 | 33.7k | } _ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_ Line | Count | Source | 207 | 21 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 21 | auto f = Field(PType); | 209 | 21 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | 21 | if constexpr (is_string_type(PType)) { | 211 | 21 | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 21 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 21 | return f; | 225 | 21 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_ Line | Count | Source | 207 | 1.50k | static Field create_field_from_olap_value(const ValType& data) { | 208 | 1.50k | auto f = Field(PType); | 209 | 1.50k | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | 1.50k | if constexpr (is_string_type(PType)) { | 211 | 1.50k | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 1.50k | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 1.50k | return f; | 225 | 1.50k | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_ Line | Count | Source | 207 | 21 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 21 | auto f = Field(PType); | 209 | 21 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | 21 | } else if constexpr (is_date_or_datetime(PType)) { | 213 | 21 | if constexpr (PType == TYPE_DATE) { | 214 | 21 | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 21 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 21 | return f; | 225 | 21 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_ Line | Count | Source | 207 | 37 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 37 | auto f = Field(PType); | 209 | 37 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | 37 | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | 37 | } else { | 216 | 37 | cpp_value.from_olap_datetime(data); | 217 | 37 | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 37 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 37 | return f; | 225 | 37 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_ Line | Count | Source | 207 | 23 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 23 | auto f = Field(PType); | 209 | 23 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 23 | } else { | 221 | 23 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 23 | } | 223 | 23 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 23 | return f; | 225 | 23 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_ Line | Count | Source | 207 | 50 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 50 | auto f = Field(PType); | 209 | 50 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 50 | } else { | 221 | 50 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 50 | } | 223 | 50 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 50 | return f; | 225 | 50 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_ Line | Count | Source | 207 | 31 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 31 | auto f = Field(PType); | 209 | 31 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | 31 | } else if constexpr (is_decimalv2(PType)) { | 219 | 31 | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 31 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 31 | return f; | 225 | 31 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_ Line | Count | Source | 207 | 14 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 14 | auto f = Field(PType); | 209 | 14 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 14 | } else { | 221 | 14 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 14 | } | 223 | 14 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 14 | return f; | 225 | 14 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_ Line | Count | Source | 207 | 12 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 12 | auto f = Field(PType); | 209 | 12 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 12 | } else { | 221 | 12 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 12 | } | 223 | 12 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 12 | return f; | 225 | 12 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_ Line | Count | Source | 207 | 11 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 11 | auto f = Field(PType); | 209 | 11 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 11 | } else { | 221 | 11 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 11 | } | 223 | 11 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 11 | return f; | 225 | 11 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_ Line | Count | Source | 207 | 9 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 9 | auto f = Field(PType); | 209 | 9 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 9 | } else { | 221 | 9 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 9 | } | 223 | 9 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 9 | return f; | 225 | 9 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_ Line | Count | Source | 207 | 27 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 27 | auto f = Field(PType); | 209 | 27 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 27 | } else { | 221 | 27 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 27 | } | 223 | 27 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 27 | return f; | 225 | 27 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_ Line | Count | Source | 207 | 16.3k | static Field create_field_from_olap_value(const ValType& data) { | 208 | 16.3k | auto f = Field(PType); | 209 | 16.3k | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 16.3k | } else { | 221 | 16.3k | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 16.3k | } | 223 | 16.3k | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 16.3k | return f; | 225 | 16.3k | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_ Line | Count | Source | 207 | 865 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 865 | auto f = Field(PType); | 209 | 865 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 865 | } else { | 221 | 865 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 865 | } | 223 | 865 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 865 | return f; | 225 | 865 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_ Line | Count | Source | 207 | 29 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 29 | auto f = Field(PType); | 209 | 29 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 29 | } else { | 221 | 29 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 29 | } | 223 | 29 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 29 | return f; | 225 | 29 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_ Line | Count | Source | 207 | 2.47k | static Field create_field_from_olap_value(const ValType& data) { | 208 | 2.47k | auto f = Field(PType); | 209 | 2.47k | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 2.47k | } else { | 221 | 2.47k | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 2.47k | } | 223 | 2.47k | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 2.47k | return f; | 225 | 2.47k | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_ Line | Count | Source | 207 | 7 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 7 | auto f = Field(PType); | 209 | 7 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 7 | } else { | 221 | 7 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 7 | } | 223 | 7 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 7 | return f; | 225 | 7 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_ Line | Count | Source | 207 | 13 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 13 | auto f = Field(PType); | 209 | 13 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 13 | } else { | 221 | 13 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 13 | } | 223 | 13 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 13 | return f; | 225 | 13 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_ Line | Count | Source | 207 | 9 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 9 | auto f = Field(PType); | 209 | 9 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 9 | } else { | 221 | 9 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 9 | } | 223 | 9 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 9 | return f; | 225 | 9 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_ Line | Count | Source | 207 | 13 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 13 | auto f = Field(PType); | 209 | 13 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 13 | } else { | 221 | 13 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 13 | } | 223 | 13 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 13 | return f; | 225 | 13 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_ Line | Count | Source | 207 | 5 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 5 | auto f = Field(PType); | 209 | 5 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 5 | } else { | 221 | 5 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 5 | } | 223 | 5 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 5 | return f; | 225 | 5 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_ Line | Count | Source | 207 | 5 | static Field create_field_from_olap_value(const ValType& data) { | 208 | 5 | auto f = Field(PType); | 209 | 5 | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | | if constexpr (is_string_type(PType)) { | 211 | | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | 5 | } else { | 221 | 5 | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | 5 | } | 223 | 5 | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 5 | return f; | 225 | 5 | } |
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_ Line | Count | Source | 207 | 12.2k | static Field create_field_from_olap_value(const ValType& data) { | 208 | 12.2k | auto f = Field(PType); | 209 | 12.2k | typename PrimitiveTypeTraits<PType>::CppType cpp_value; | 210 | 12.2k | if constexpr (is_string_type(PType)) { | 211 | 12.2k | cpp_value = String(data.data, data.size); | 212 | | } else if constexpr (is_date_or_datetime(PType)) { | 213 | | if constexpr (PType == TYPE_DATE) { | 214 | | cpp_value.from_olap_date(data); | 215 | | } else { | 216 | | cpp_value.from_olap_datetime(data); | 217 | | } | 218 | | } else if constexpr (is_decimalv2(PType)) { | 219 | | cpp_value = DecimalV2Value(data.integer, data.fraction); | 220 | | } else { | 221 | | cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data); | 222 | | } | 223 | 12.2k | f.template create_concrete<PType>(std::move(cpp_value)); | 224 | 12.2k | return f; | 225 | 12.2k | } |
|
226 | | |
227 | | /** Despite the presence of a template constructor, this constructor is still needed, |
228 | | * since, in its absence, the compiler will still generate the default constructor. |
229 | | */ |
230 | | Field(const Field& rhs); |
231 | | |
232 | | Field(Field&& rhs); |
233 | | |
234 | | Field& operator=(const Field& rhs); |
235 | | |
236 | 1.67M | bool is_complex_field() const { |
237 | 1.67M | return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP || |
238 | 1.67M | type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT; |
239 | 1.67M | } |
240 | | |
241 | 37.3M | Field& operator=(Field&& rhs) { |
242 | 37.3M | if (this != &rhs) { |
243 | 37.3M | if (type != rhs.type) { |
244 | 24.6M | destroy(); |
245 | 24.6M | create(std::move(rhs)); |
246 | 24.6M | } else { |
247 | 12.7M | assign(std::move(rhs)); |
248 | 12.7M | } |
249 | 37.3M | } |
250 | 37.3M | return *this; |
251 | 37.3M | } |
252 | | |
253 | 343M | ~Field() { destroy(); } |
254 | | |
255 | 49.7M | PrimitiveType get_type() const { return type; } |
256 | | std::string get_type_name() const; |
257 | | |
258 | 99.2M | bool is_null() const { return type == PrimitiveType::TYPE_NULL; } |
259 | | |
260 | | // The template parameter T needs to be consistent with `which`. |
261 | | // If not, use NearestFieldType<> externally. |
262 | | // Maybe modify this in the future, reference: https://github.com/ClickHouse/ClickHouse/pull/22003 |
263 | | template <PrimitiveType T> |
264 | | typename PrimitiveTypeTraits<T>::CppType& get(); |
265 | | |
266 | | template <PrimitiveType T> |
267 | | const typename PrimitiveTypeTraits<T>::CppType& get() const; |
268 | | |
269 | 267k | bool operator==(const Field& rhs) const { |
270 | 267k | return operator<=>(rhs) == std::strong_ordering::equal; |
271 | 267k | } |
272 | | |
273 | | std::strong_ordering operator<=>(const Field& rhs) const; |
274 | | |
275 | | std::string_view as_string_view() const; |
276 | | |
277 | | // Return a human-readable representation of the stored value for debugging. |
278 | | // Unlike get_type_name() which returns the type, this prints the actual value. |
279 | | // For decimal types, caller can provide scale for accurate formatting. |
280 | | std::string to_debug_string(int scale) const; |
281 | | |
282 | | private: |
283 | | std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64, |
284 | | Int128, IPv6, Float64, String, JsonbField, StringView, Array, Struct, Map, |
285 | | VariantField, Decimal32, Decimal64, DecimalV2Value, Decimal128V3, |
286 | | Decimal256, BitmapValue, HyperLogLog, QuantileState> |
287 | | storage; |
288 | | |
289 | | PrimitiveType type; |
290 | | |
291 | | /// Assuming there was no allocated state or it was deallocated (see destroy). |
292 | | template <PrimitiveType Type> |
293 | | void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x); |
294 | | template <PrimitiveType Type> |
295 | | void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x); |
296 | | /// Assuming same types. |
297 | | template <PrimitiveType Type> |
298 | | void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x); |
299 | | template <PrimitiveType Type> |
300 | | void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x); |
301 | | |
302 | | void create(const Field& field); |
303 | | void create(Field&& field); |
304 | | |
305 | | void assign(const Field& x); |
306 | | void assign(Field&& x); |
307 | | |
308 | | void destroy(); |
309 | | |
310 | | template <PrimitiveType T> |
311 | | void destroy(); |
312 | | }; |
313 | | |
314 | | struct FieldWithDataType { |
315 | | Field field; |
316 | | // used for nested type of array |
317 | | PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE; |
318 | | uint8_t num_dimensions = 0; |
319 | | int precision = -1; |
320 | | int scale = -1; |
321 | | // True when the array elements are mixed-type and must be converted to the common base |
322 | | // type on insert. Mirrors FieldInfo::need_convert so it survives the FieldWithDataType |
323 | | // round trip in the sparse read path. |
324 | | bool need_convert = false; |
325 | | }; |
326 | | |
327 | | } // namespace doris |
328 | | |
329 | | template <> |
330 | | struct std::hash<doris::Field> { |
331 | 0 | size_t operator()(const doris::Field& field) const { |
332 | 0 | if (field.is_null()) { |
333 | 0 | return 0; |
334 | 0 | } |
335 | 0 | std::hash<std::string_view> hasher; |
336 | 0 | return hasher(field.as_string_view()); |
337 | 0 | } |
338 | | }; |