Coverage Report

Created: 2026-09-14 18:17

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 <cmath>
29
#include <cstring>
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 "core/value/variant/variant_field.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
//TODO: rethink if we really need this? it only save one pointer from std::string
79
// not POD type so could only use read/write_json_binary instead of read/write_binary
80
class JsonbField {
81
public:
82
192k
    JsonbField() = default;
83
7.25M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
84
85
1.60M
    JsonbField(const char* ptr, size_t len) : size(len) {
86
1.60M
        data = std::make_unique<char[]>(size);
87
1.60M
        if (!data) {
88
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
89
0
        }
90
1.60M
        if (size > 0) {
91
1.60M
            memcpy(data.get(), ptr, size);
92
1.60M
        }
93
1.60M
    }
94
95
1.67M
    JsonbField(const JsonbField& x) : size(x.size) {
96
1.67M
        data = std::make_unique<char[]>(size);
97
1.67M
        if (!data) {
98
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
99
0
        }
100
1.67M
        if (size > 0) {
101
1.67M
            memcpy(data.get(), x.data.get(), size);
102
1.67M
        }
103
1.67M
    }
104
105
3.78M
    JsonbField(JsonbField&& x) noexcept : data(std::move(x.data)), size(x.size) { x.size = 0; }
106
107
    // dispatch for all type of storage. so need this. but not really used now.
108
2
    JsonbField& operator=(const JsonbField& x) {
109
2
        if (this != &x) {
110
2
            data = std::make_unique<char[]>(x.size);
111
2
            if (!data) {
112
0
                throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size));
113
0
            }
114
2
            if (x.size > 0) {
115
1
                memcpy(data.get(), x.data.get(), x.size);
116
1
            }
117
2
            size = x.size;
118
2
        }
119
2
        return *this;
120
2
    }
121
122
191k
    JsonbField& operator=(JsonbField&& x) noexcept {
123
191k
        if (this != &x) {
124
191k
            data = std::move(x.data);
125
191k
            size = x.size;
126
191k
            x.size = 0;
127
191k
        }
128
191k
        return *this;
129
191k
    }
130
131
1.20M
    const char* get_value() const { return data.get(); }
132
1.20M
    size_t get_size() const { return size; }
133
134
0
    bool operator<(const JsonbField& r) const {
135
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
136
0
    }
137
0
    bool operator<=(const JsonbField& r) const {
138
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
139
0
    }
140
0
    bool operator==(const JsonbField& r) const {
141
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
142
0
    }
143
0
    bool operator>(const JsonbField& r) const {
144
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
145
0
    }
146
0
    bool operator>=(const JsonbField& r) const {
147
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
148
0
    }
149
0
    bool operator!=(const JsonbField& r) const {
150
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
151
0
    }
152
153
0
    const JsonbField& operator+=(const JsonbField& r) {
154
0
        throw Exception(Status::FatalError("Not support plus opration on JsonbField"));
155
0
    }
156
157
0
    const JsonbField& operator-=(const JsonbField& r) {
158
0
        throw Exception(Status::FatalError("Not support minus opration on JsonbField"));
159
0
    }
160
161
private:
162
    std::unique_ptr<char[]> data = nullptr;
163
    size_t size = 0;
164
};
165
166
template <typename T>
167
bool decimal_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
168
template <typename T>
169
bool decimal_less(T x, T y, UInt32 x_scale, UInt32 y_scale);
170
template <typename T>
171
bool decimal_less_or_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
172
173
/** 32 is enough. Round number is used for alignment and for better arithmetic inside std::vector.
174
  * NOTE: Actually, sizeof(std::string) is 32 when using libc++, so Field is 40 bytes.
175
  */
176
constexpr size_t DBMS_MIN_FIELD_SIZE = 32;
177
178
/** Discriminated union of several types.
179
  * Made for replacement of `boost::variant`
180
  *  is not generalized,
181
  *  but somewhat more efficient, and simpler.
182
  *
183
  * Used to represent a single value of one of several types in memory.
184
  * Warning! Prefer to use chunks of columns instead of single values. See Column.h
185
  */
186
class Field {
187
public:
188
    static const int MIN_NON_POD = 16;
189
50.2M
    Field() : type(PrimitiveType::TYPE_NULL) {}
190
    // set Types::Null explictly and avoid other types
191
88.5M
    Field(PrimitiveType w) : type(w) {}
192
    template <PrimitiveType T>
193
26.1M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
26.1M
        auto f = Field(T);
195
26.1M
        f.template create_concrete<T>(data);
196
26.1M
        return f;
197
26.1M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
332k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
332k
        auto f = Field(T);
195
332k
        f.template create_concrete<T>(data);
196
332k
        return f;
197
332k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
21.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
21.8k
        auto f = Field(T);
195
21.8k
        f.template create_concrete<T>(data);
196
21.8k
        return f;
197
21.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
14
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
14
        auto f = Field(T);
195
14
        f.template create_concrete<T>(data);
196
14
        return f;
197
14
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
25.3M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
25.3M
        auto f = Field(T);
195
25.3M
        f.template create_concrete<T>(data);
196
25.3M
        return f;
197
25.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.42k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
2.42k
        auto f = Field(T);
195
2.42k
        f.template create_concrete<T>(data);
196
2.42k
        return f;
197
2.42k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
22.3k
        auto f = Field(T);
195
22.3k
        f.template create_concrete<T>(data);
196
22.3k
        return f;
197
22.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
404
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
404
        auto f = Field(T);
195
404
        f.template create_concrete<T>(data);
196
404
        return f;
197
404
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
44.7k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
44.7k
        auto f = Field(T);
195
44.7k
        f.template create_concrete<T>(data);
196
44.7k
        return f;
197
44.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
828
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
828
        auto f = Field(T);
195
828
        f.template create_concrete<T>(data);
196
828
        return f;
197
828
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
29
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
29
        auto f = Field(T);
195
29
        f.template create_concrete<T>(data);
196
29
        return f;
197
29
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
32.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
32.6k
        auto f = Field(T);
195
32.6k
        f.template create_concrete<T>(data);
196
32.6k
        return f;
197
32.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
47.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
47.3k
        auto f = Field(T);
195
47.3k
        f.template create_concrete<T>(data);
196
47.3k
        return f;
197
47.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
6.52k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
6.52k
        auto f = Field(T);
195
6.52k
        f.template create_concrete<T>(data);
196
6.52k
        return f;
197
6.52k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
4
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
4
        auto f = Field(T);
195
4
        f.template create_concrete<T>(data);
196
4
        return f;
197
4
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
50.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
50.9k
        auto f = Field(T);
195
50.9k
        f.template create_concrete<T>(data);
196
50.9k
        return f;
197
50.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
26.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
26.2k
        auto f = Field(T);
195
26.2k
        f.template create_concrete<T>(data);
196
26.2k
        return f;
197
26.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.5k
        auto f = Field(T);
195
24.5k
        f.template create_concrete<T>(data);
196
24.5k
        return f;
197
24.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
18.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
18.0k
        auto f = Field(T);
195
18.0k
        f.template create_concrete<T>(data);
196
18.0k
        return f;
197
18.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
27.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
27.3k
        auto f = Field(T);
195
27.3k
        f.template create_concrete<T>(data);
196
27.3k
        return f;
197
27.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.9k
        auto f = Field(T);
195
24.9k
        f.template create_concrete<T>(data);
196
24.9k
        return f;
197
24.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
134
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
134
        auto f = Field(T);
195
134
        f.template create_concrete<T>(data);
196
134
        return f;
197
134
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.86k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
2.86k
        auto f = Field(T);
195
2.86k
        f.template create_concrete<T>(data);
196
2.86k
        return f;
197
2.86k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
86
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
86
        auto f = Field(T);
195
86
        f.template create_concrete<T>(data);
196
86
        return f;
197
86
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.57k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
8.57k
        auto f = Field(T);
195
8.57k
        f.template create_concrete<T>(data);
196
8.57k
        return f;
197
8.57k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.73k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
8.73k
        auto f = Field(T);
195
8.73k
        f.template create_concrete<T>(data);
196
8.73k
        return f;
197
8.73k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
13.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
13.3k
        auto f = Field(T);
195
13.3k
        f.template create_concrete<T>(data);
196
13.3k
        return f;
197
13.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
17
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
17
        auto f = Field(T);
195
17
        f.template create_concrete<T>(data);
196
17
        return f;
197
17
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
9.75k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
9.75k
        auto f = Field(T);
195
9.75k
        f.template create_concrete<T>(data);
196
9.75k
        return f;
197
9.75k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
19.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
19.5k
        auto f = Field(T);
195
19.5k
        f.template create_concrete<T>(data);
196
19.5k
        return f;
197
19.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
22.1k
        auto f = Field(T);
195
22.1k
        f.template create_concrete<T>(data);
196
22.1k
        return f;
197
22.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
34.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
34.9k
        auto f = Field(T);
195
34.9k
        f.template create_concrete<T>(data);
196
34.9k
        return f;
197
34.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
33.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
33.0k
        auto f = Field(T);
195
33.0k
        f.template create_concrete<T>(data);
196
33.0k
        return f;
197
33.0k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
198
    template <PrimitiveType T>
199
62.1M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
62.1M
        auto f = Field(T);
201
62.1M
        f.template create_concrete<T>(std::move(data));
202
62.1M
        return f;
203
62.1M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.36M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.36M
        auto f = Field(T);
201
2.36M
        f.template create_concrete<T>(std::move(data));
202
2.36M
        return f;
203
2.36M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
862k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
862k
        auto f = Field(T);
201
862k
        f.template create_concrete<T>(std::move(data));
202
862k
        return f;
203
862k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
14.9M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
14.9M
        auto f = Field(T);
201
14.9M
        f.template create_concrete<T>(std::move(data));
202
14.9M
        return f;
203
14.9M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
97.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
97.7k
        auto f = Field(T);
201
97.7k
        f.template create_concrete<T>(std::move(data));
202
97.7k
        return f;
203
97.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
30
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
30
        auto f = Field(T);
201
30
        f.template create_concrete<T>(std::move(data));
202
30
        return f;
203
30
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
28.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
28.3M
        auto f = Field(T);
201
28.3M
        f.template create_concrete<T>(std::move(data));
202
28.3M
        return f;
203
28.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
13.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
13.5M
        auto f = Field(T);
201
13.5M
        f.template create_concrete<T>(std::move(data));
202
13.5M
        return f;
203
13.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.79M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.79M
        auto f = Field(T);
201
1.79M
        f.template create_concrete<T>(std::move(data));
202
1.79M
        return f;
203
1.79M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
86.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
86.2k
        auto f = Field(T);
201
86.2k
        f.template create_concrete<T>(std::move(data));
202
86.2k
        return f;
203
86.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
6.38k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
6.38k
        auto f = Field(T);
201
6.38k
        f.template create_concrete<T>(std::move(data));
202
6.38k
        return f;
203
6.38k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
637
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
637
        auto f = Field(T);
201
637
        f.template create_concrete<T>(std::move(data));
202
637
        return f;
203
637
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.71k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.71k
        auto f = Field(T);
201
1.71k
        f.template create_concrete<T>(std::move(data));
202
1.71k
        return f;
203
1.71k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
117k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
117k
        auto f = Field(T);
201
117k
        f.template create_concrete<T>(std::move(data));
202
117k
        return f;
203
117k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
23.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
23.2k
        auto f = Field(T);
201
23.2k
        f.template create_concrete<T>(std::move(data));
202
23.2k
        return f;
203
23.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
626
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
626
        auto f = Field(T);
201
626
        f.template create_concrete<T>(std::move(data));
202
626
        return f;
203
626
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
3.37k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
3.37k
        auto f = Field(T);
201
3.37k
        f.template create_concrete<T>(std::move(data));
202
3.37k
        return f;
203
3.37k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.27k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.27k
        auto f = Field(T);
201
2.27k
        f.template create_concrete<T>(std::move(data));
202
2.27k
        return f;
203
2.27k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
883
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
883
        auto f = Field(T);
201
883
        f.template create_concrete<T>(std::move(data));
202
883
        return f;
203
883
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
12
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
12
        auto f = Field(T);
201
12
        f.template create_concrete<T>(std::move(data));
202
12
        return f;
203
12
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
797
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
797
        auto f = Field(T);
201
797
        f.template create_concrete<T>(std::move(data));
202
797
        return f;
203
797
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10.0k
        auto f = Field(T);
201
10.0k
        f.template create_concrete<T>(std::move(data));
202
10.0k
        return f;
203
10.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.34k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.34k
        auto f = Field(T);
201
1.34k
        f.template create_concrete<T>(std::move(data));
202
1.34k
        return f;
203
1.34k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10
        auto f = Field(T);
201
10
        f.template create_concrete<T>(std::move(data));
202
10
        return f;
203
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
618
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
618
        auto f = Field(T);
201
618
        f.template create_concrete<T>(std::move(data));
202
618
        return f;
203
618
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
538
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
538
        auto f = Field(T);
201
538
        f.template create_concrete<T>(std::move(data));
202
538
        return f;
203
538
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10
        auto f = Field(T);
201
10
        f.template create_concrete<T>(std::move(data));
202
10
        return f;
203
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
33
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
33
        auto f = Field(T);
201
33
        f.template create_concrete<T>(std::move(data));
202
33
        return f;
203
33
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.79k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.79k
        auto f = Field(T);
201
2.79k
        f.template create_concrete<T>(std::move(data));
202
2.79k
        return f;
203
2.79k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
40
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
40
        auto f = Field(T);
201
40
        f.template create_concrete<T>(std::move(data));
202
40
        return f;
203
40
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
614
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
614
        auto f = Field(T);
201
614
        f.template create_concrete<T>(std::move(data));
202
614
        return f;
203
614
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
4
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
4
        auto f = Field(T);
201
4
        f.template create_concrete<T>(std::move(data));
202
4
        return f;
203
4
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
563
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
563
        auto f = Field(T);
201
563
        f.template create_concrete<T>(std::move(data));
202
563
        return f;
203
563
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
3.66k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
3.66k
        auto f = Field(T);
201
3.66k
        f.template create_concrete<T>(std::move(data));
202
3.66k
        return f;
203
3.66k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
598
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
598
        auto f = Field(T);
201
598
        f.template create_concrete<T>(std::move(data));
202
598
        return f;
203
598
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
627
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
627
        auto f = Field(T);
201
627
        f.template create_concrete<T>(std::move(data));
202
627
        return f;
203
627
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
569
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
569
        auto f = Field(T);
201
569
        f.template create_concrete<T>(std::move(data));
202
569
        return f;
203
569
    }
204
205
    template <PrimitiveType PType, typename ValType = std::conditional_t<
206
                                           doris::is_string_type(PType), StringRef,
207
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
208
43.6k
    static Field create_field_from_olap_value(const ValType& data) {
209
43.6k
        auto f = Field(PType);
210
43.6k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
43.6k
        if constexpr (is_string_type(PType)) {
212
15.2k
            cpp_value = String(data.data, data.size);
213
15.2k
        } else if constexpr (is_date_or_datetime(PType)) {
214
606
            if constexpr (PType == TYPE_DATE) {
215
295
                cpp_value.from_olap_date(data);
216
311
            } else {
217
311
                cpp_value.from_olap_datetime(data);
218
311
            }
219
606
        } else if constexpr (is_decimalv2(PType)) {
220
297
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
27.4k
        } else {
222
27.4k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
27.4k
        }
224
43.6k
        f.template create_concrete<PType>(std::move(cpp_value));
225
43.6k
        return f;
226
43.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
287
    static Field create_field_from_olap_value(const ValType& data) {
209
287
        auto f = Field(PType);
210
287
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
287
        if constexpr (is_string_type(PType)) {
212
287
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
287
        f.template create_concrete<PType>(std::move(cpp_value));
225
287
        return f;
226
287
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
1.96k
    static Field create_field_from_olap_value(const ValType& data) {
209
1.96k
        auto f = Field(PType);
210
1.96k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
1.96k
        if constexpr (is_string_type(PType)) {
212
1.96k
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
1.96k
        f.template create_concrete<PType>(std::move(cpp_value));
225
1.96k
        return f;
226
1.96k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
208
295
    static Field create_field_from_olap_value(const ValType& data) {
209
295
        auto f = Field(PType);
210
295
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
295
        } else if constexpr (is_date_or_datetime(PType)) {
214
295
            if constexpr (PType == TYPE_DATE) {
215
295
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
295
        f.template create_concrete<PType>(std::move(cpp_value));
225
295
        return f;
226
295
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
208
311
    static Field create_field_from_olap_value(const ValType& data) {
209
311
        auto f = Field(PType);
210
311
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
311
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
311
            } else {
217
311
                cpp_value.from_olap_datetime(data);
218
311
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
311
        f.template create_concrete<PType>(std::move(cpp_value));
225
311
        return f;
226
311
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
208
297
    static Field create_field_from_olap_value(const ValType& data) {
209
297
        auto f = Field(PType);
210
297
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
297
        } else {
222
297
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
297
        }
224
297
        f.template create_concrete<PType>(std::move(cpp_value));
225
297
        return f;
226
297
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
208
324
    static Field create_field_from_olap_value(const ValType& data) {
209
324
        auto f = Field(PType);
210
324
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
324
        } else {
222
324
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
324
        }
224
324
        f.template create_concrete<PType>(std::move(cpp_value));
225
324
        return f;
226
324
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
208
297
    static Field create_field_from_olap_value(const ValType& data) {
209
297
        auto f = Field(PType);
210
297
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
297
        } else if constexpr (is_decimalv2(PType)) {
220
297
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
297
        f.template create_concrete<PType>(std::move(cpp_value));
225
297
        return f;
226
297
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
208
280
    static Field create_field_from_olap_value(const ValType& data) {
209
280
        auto f = Field(PType);
210
280
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
280
        } else {
222
280
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
280
        }
224
280
        f.template create_concrete<PType>(std::move(cpp_value));
225
280
        return f;
226
280
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
208
278
    static Field create_field_from_olap_value(const ValType& data) {
209
278
        auto f = Field(PType);
210
278
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
278
        } else {
222
278
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
278
        }
224
278
        f.template create_concrete<PType>(std::move(cpp_value));
225
278
        return f;
226
278
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
208
277
    static Field create_field_from_olap_value(const ValType& data) {
209
277
        auto f = Field(PType);
210
277
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
277
        } else {
222
277
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
277
        }
224
277
        f.template create_concrete<PType>(std::move(cpp_value));
225
277
        return f;
226
277
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
208
275
    static Field create_field_from_olap_value(const ValType& data) {
209
275
        auto f = Field(PType);
210
275
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
275
        } else {
222
275
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
275
        }
224
275
        f.template create_concrete<PType>(std::move(cpp_value));
225
275
        return f;
226
275
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
208
301
    static Field create_field_from_olap_value(const ValType& data) {
209
301
        auto f = Field(PType);
210
301
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
301
        } else {
222
301
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
301
        }
224
301
        f.template create_concrete<PType>(std::move(cpp_value));
225
301
        return f;
226
301
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
208
18.3k
    static Field create_field_from_olap_value(const ValType& data) {
209
18.3k
        auto f = Field(PType);
210
18.3k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
18.3k
        } else {
222
18.3k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
18.3k
        }
224
18.3k
        f.template create_concrete<PType>(std::move(cpp_value));
225
18.3k
        return f;
226
18.3k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
208
1.73k
    static Field create_field_from_olap_value(const ValType& data) {
209
1.73k
        auto f = Field(PType);
210
1.73k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
1.73k
        } else {
222
1.73k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
1.73k
        }
224
1.73k
        f.template create_concrete<PType>(std::move(cpp_value));
225
1.73k
        return f;
226
1.73k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
208
303
    static Field create_field_from_olap_value(const ValType& data) {
209
303
        auto f = Field(PType);
210
303
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
303
        } else {
222
303
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
303
        }
224
303
        f.template create_concrete<PType>(std::move(cpp_value));
225
303
        return f;
226
303
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
208
3.19k
    static Field create_field_from_olap_value(const ValType& data) {
209
3.19k
        auto f = Field(PType);
210
3.19k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
3.19k
        } else {
222
3.19k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
3.19k
        }
224
3.19k
        f.template create_concrete<PType>(std::move(cpp_value));
225
3.19k
        return f;
226
3.19k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
208
281
    static Field create_field_from_olap_value(const ValType& data) {
209
281
        auto f = Field(PType);
210
281
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
281
        } else {
222
281
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
281
        }
224
281
        f.template create_concrete<PType>(std::move(cpp_value));
225
281
        return f;
226
281
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
208
391
    static Field create_field_from_olap_value(const ValType& data) {
209
391
        auto f = Field(PType);
210
391
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
391
        } else {
222
391
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
391
        }
224
391
        f.template create_concrete<PType>(std::move(cpp_value));
225
391
        return f;
226
391
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
208
295
    static Field create_field_from_olap_value(const ValType& data) {
209
295
        auto f = Field(PType);
210
295
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
295
        } else {
222
295
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
295
        }
224
295
        f.template create_concrete<PType>(std::move(cpp_value));
225
295
        return f;
226
295
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
208
399
    static Field create_field_from_olap_value(const ValType& data) {
209
399
        auto f = Field(PType);
210
399
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
399
        } else {
222
399
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
399
        }
224
399
        f.template create_concrete<PType>(std::move(cpp_value));
225
399
        return f;
226
399
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
208
271
    static Field create_field_from_olap_value(const ValType& data) {
209
271
        auto f = Field(PType);
210
271
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
271
        } else {
222
271
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
271
        }
224
271
        f.template create_concrete<PType>(std::move(cpp_value));
225
271
        return f;
226
271
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
208
271
    static Field create_field_from_olap_value(const ValType& data) {
209
271
        auto f = Field(PType);
210
271
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
271
        } else {
222
271
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
271
        }
224
271
        f.template create_concrete<PType>(std::move(cpp_value));
225
271
        return f;
226
271
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE43ElEES0_RKT0_
Line
Count
Source
208
4
    static Field create_field_from_olap_value(const ValType& data) {
209
4
        auto f = Field(PType);
210
4
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
4
        } else {
222
4
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
4
        }
224
4
        f.template create_concrete<PType>(std::move(cpp_value));
225
4
        return f;
226
4
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
12.9k
    static Field create_field_from_olap_value(const ValType& data) {
209
12.9k
        auto f = Field(PType);
210
12.9k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
12.9k
        if constexpr (is_string_type(PType)) {
212
12.9k
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
12.9k
        f.template create_concrete<PType>(std::move(cpp_value));
225
12.9k
        return f;
226
12.9k
    }
227
228
    /** Despite the presence of a template constructor, this constructor is still needed,
229
      *  since, in its absence, the compiler will still generate the default constructor.
230
      */
231
    Field(const Field& rhs);
232
233
    Field(Field&& rhs);
234
235
    Field& operator=(const Field& rhs);
236
237
1.67M
    bool is_complex_field() const {
238
1.67M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
239
1.67M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
240
1.67M
    }
241
242
39.5M
    Field& operator=(Field&& rhs) {
243
39.5M
        if (this != &rhs) {
244
39.5M
            if (type != rhs.type) {
245
26.8M
                destroy();
246
26.8M
                create(std::move(rhs));
247
26.8M
            } else {
248
12.7M
                assign(std::move(rhs));
249
12.7M
            }
250
39.5M
        }
251
39.5M
        return *this;
252
39.5M
    }
253
254
347M
    ~Field() { destroy(); }
255
256
49.8M
    PrimitiveType get_type() const { return type; }
257
    std::string get_type_name() const;
258
259
101M
    bool is_null() const { return type == PrimitiveType::TYPE_NULL; }
260
261
    // The template parameter T needs to be consistent with `which`.
262
    // If not, use NearestFieldType<> externally.
263
    // Maybe modify this in the future, reference: https://github.com/ClickHouse/ClickHouse/pull/22003
264
    template <PrimitiveType T>
265
    typename PrimitiveTypeTraits<T>::CppType& get();
266
267
    template <PrimitiveType T>
268
    const typename PrimitiveTypeTraits<T>::CppType& get() const;
269
270
223
    bool is_nan() const {
271
        // Keep type dispatch with the value so callers cannot reinterpret Field storage using a
272
        // mismatched PrimitiveType.
273
223
        if (type == PrimitiveType::TYPE_FLOAT) {
274
40
            return std::isnan(get<TYPE_FLOAT>());
275
40
        }
276
183
        if (type == PrimitiveType::TYPE_DOUBLE) {
277
40
            return std::isnan(get<TYPE_DOUBLE>());
278
40
        }
279
143
        return false;
280
183
    }
281
282
244k
    bool operator==(const Field& rhs) const {
283
244k
        return operator<=>(rhs) == std::strong_ordering::equal;
284
244k
    }
285
286
    std::strong_ordering operator<=>(const Field& rhs) const;
287
288
    std::string_view as_string_view() const;
289
290
    // Return a human-readable representation of the stored value for debugging.
291
    // Unlike get_type_name() which returns the type, this prints the actual value.
292
    // For decimal types, caller can provide scale for accurate formatting.
293
    std::string to_debug_string(int scale) const;
294
295
private:
296
    std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
297
                         Int128, IPv6, Float64, String, JsonbField, StringView, Array, Struct, Map,
298
                         VariantField, Decimal32, Decimal64, DecimalV2Value, Decimal128V3,
299
                         Decimal256, BitmapValue, HyperLogLog, QuantileState>
300
            storage;
301
302
    PrimitiveType type;
303
304
    /// Assuming there was no allocated state or it was deallocated (see destroy).
305
    template <PrimitiveType Type>
306
    void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
307
    template <PrimitiveType Type>
308
    void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
309
    /// Assuming same types.
310
    template <PrimitiveType Type>
311
    void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
312
    template <PrimitiveType Type>
313
    void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
314
315
    void create(const Field& field);
316
    void create(Field&& field);
317
318
    void assign(const Field& x);
319
    void assign(Field&& x);
320
321
    void destroy();
322
323
    template <PrimitiveType T>
324
    void destroy();
325
};
326
327
struct FieldWithDataType {
328
    Field field;
329
    // used for nested type of array
330
    PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE;
331
    uint8_t num_dimensions = 0;
332
    int precision = -1;
333
    int scale = -1;
334
    // True when the array elements are mixed-type and must be converted to the common base
335
    // type on insert. Mirrors FieldInfo::need_convert so it survives the FieldWithDataType
336
    // round trip in the sparse read path.
337
    bool need_convert = false;
338
};
339
340
} // namespace doris
341
342
template <>
343
struct std::hash<doris::Field> {
344
0
    size_t operator()(const doris::Field& field) const {
345
0
        if (field.is_null()) {
346
0
            return 0;
347
0
        }
348
0
        std::hash<std::string_view> hasher;
349
0
        return hasher(field.as_string_view());
350
0
    }
351
};