Coverage Report

Created: 2026-05-20 14:16

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