Coverage Report

Created: 2026-08-17 23:49

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
48.1M
    Field() : type(PrimitiveType::TYPE_NULL) {}
190
    // set Types::Null explictly and avoid other types
191
86.4M
    Field(PrimitiveType w) : type(w) {}
192
    template <PrimitiveType T>
193
23.9M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
23.9M
        auto f = Field(T);
195
23.9M
        f.template create_concrete<T>(data);
196
23.9M
        return f;
197
23.9M
    }
_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
23.1M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
23.1M
        auto f = Field(T);
195
23.1M
        f.template create_concrete<T>(data);
196
23.1M
        return f;
197
23.1M
    }
_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.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
44.6k
        auto f = Field(T);
195
44.6k
        f.template create_concrete<T>(data);
196
44.6k
        return f;
197
44.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
825
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
825
        auto f = Field(T);
195
825
        f.template create_concrete<T>(data);
196
825
        return f;
197
825
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
26
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
26
        auto f = Field(T);
195
26
        f.template create_concrete<T>(data);
196
26
        return f;
197
26
    }
_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.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
27.1k
        auto f = Field(T);
195
27.1k
        f.template create_concrete<T>(data);
196
27.1k
        return f;
197
27.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.6k
        auto f = Field(T);
195
24.6k
        f.template create_concrete<T>(data);
196
24.6k
        return f;
197
24.6k
    }
_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.87k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
2.87k
        auto f = Field(T);
195
2.87k
        f.template create_concrete<T>(data);
196
2.87k
        return f;
197
2.87k
    }
_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_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
    }
_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
    }
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
869k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
869k
        auto f = Field(T);
201
869k
        f.template create_concrete<T>(std::move(data));
202
869k
        return f;
203
869k
    }
_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.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
97.5k
        auto f = Field(T);
201
97.5k
        f.template create_concrete<T>(std::move(data));
202
97.5k
        return f;
203
97.5k
    }
_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.22k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
6.22k
        auto f = Field(T);
201
6.22k
        f.template create_concrete<T>(std::move(data));
202
6.22k
        return f;
203
6.22k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
683
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
683
        auto f = Field(T);
201
683
        f.template create_concrete<T>(std::move(data));
202
683
        return f;
203
683
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
944
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
944
        auto f = Field(T);
201
944
        f.template create_concrete<T>(std::move(data));
202
944
        return f;
203
944
    }
_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
676
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
676
        auto f = Field(T);
201
676
        f.template create_concrete<T>(std::move(data));
202
676
        return f;
203
676
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
3.36k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
3.36k
        auto f = Field(T);
201
3.36k
        f.template create_concrete<T>(std::move(data));
202
3.36k
        return f;
203
3.36k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.32k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.32k
        auto f = Field(T);
201
2.32k
        f.template create_concrete<T>(std::move(data));
202
2.32k
        return f;
203
2.32k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
931
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
931
        auto f = Field(T);
201
931
        f.template create_concrete<T>(std::move(data));
202
931
        return f;
203
931
    }
_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
845
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
845
        auto f = Field(T);
201
845
        f.template create_concrete<T>(std::move(data));
202
845
        return f;
203
845
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10.1k
        auto f = Field(T);
201
10.1k
        f.template create_concrete<T>(std::move(data));
202
10.1k
        return f;
203
10.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.39k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.39k
        auto f = Field(T);
201
1.39k
        f.template create_concrete<T>(std::move(data));
202
1.39k
        return f;
203
1.39k
    }
_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
666
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
666
        auto f = Field(T);
201
666
        f.template create_concrete<T>(std::move(data));
202
666
        return f;
203
666
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
586
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
586
        auto f = Field(T);
201
586
        f.template create_concrete<T>(std::move(data));
202
586
        return f;
203
586
    }
_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_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
662
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
662
        auto f = Field(T);
201
662
        f.template create_concrete<T>(std::move(data));
202
662
        return f;
203
662
    }
_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
611
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
611
        auto f = Field(T);
201
611
        f.template create_concrete<T>(std::move(data));
202
611
        return f;
203
611
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
3.70k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
3.70k
        auto f = Field(T);
201
3.70k
        f.template create_concrete<T>(std::move(data));
202
3.70k
        return f;
203
3.70k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
646
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
646
        auto f = Field(T);
201
646
        f.template create_concrete<T>(std::move(data));
202
646
        return f;
203
646
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
675
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
675
        auto f = Field(T);
201
675
        f.template create_concrete<T>(std::move(data));
202
675
        return f;
203
675
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
617
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
617
        auto f = Field(T);
201
617
        f.template create_concrete<T>(std::move(data));
202
617
        return f;
203
617
    }
204
205
    template <PrimitiveType PType, typename ValType = std::conditional_t<
206
                                           doris::is_string_type(PType), StringRef,
207
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
208
43.0k
    static Field create_field_from_olap_value(const ValType& data) {
209
43.0k
        auto f = Field(PType);
210
43.0k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
43.0k
        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
654
            if constexpr (PType == TYPE_DATE) {
215
319
                cpp_value.from_olap_date(data);
216
335
            } else {
217
335
                cpp_value.from_olap_datetime(data);
218
335
            }
219
654
        } else if constexpr (is_decimalv2(PType)) {
220
321
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
26.7k
        } else {
222
26.7k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
26.7k
        }
224
43.0k
        f.template create_concrete<PType>(std::move(cpp_value));
225
43.0k
        return f;
226
43.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_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
311
        if constexpr (is_string_type(PType)) {
212
311
            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
311
        f.template create_concrete<PType>(std::move(cpp_value));
225
311
        return f;
226
311
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
1.98k
    static Field create_field_from_olap_value(const ValType& data) {
209
1.98k
        auto f = Field(PType);
210
1.98k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
1.98k
        if constexpr (is_string_type(PType)) {
212
1.98k
            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.98k
        f.template create_concrete<PType>(std::move(cpp_value));
225
1.98k
        return f;
226
1.98k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
208
319
    static Field create_field_from_olap_value(const ValType& data) {
209
319
        auto f = Field(PType);
210
319
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
319
        } else if constexpr (is_date_or_datetime(PType)) {
214
319
            if constexpr (PType == TYPE_DATE) {
215
319
                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
319
        f.template create_concrete<PType>(std::move(cpp_value));
225
319
        return f;
226
319
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
208
335
    static Field create_field_from_olap_value(const ValType& data) {
209
335
        auto f = Field(PType);
210
335
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
335
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
335
            } else {
217
335
                cpp_value.from_olap_datetime(data);
218
335
            }
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
335
        f.template create_concrete<PType>(std::move(cpp_value));
225
335
        return f;
226
335
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
208
321
    static Field create_field_from_olap_value(const ValType& data) {
209
321
        auto f = Field(PType);
210
321
        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
321
        } else {
222
321
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
321
        }
224
321
        f.template create_concrete<PType>(std::move(cpp_value));
225
321
        return f;
226
321
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
208
348
    static Field create_field_from_olap_value(const ValType& data) {
209
348
        auto f = Field(PType);
210
348
        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
348
        } else {
222
348
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
348
        }
224
348
        f.template create_concrete<PType>(std::move(cpp_value));
225
348
        return f;
226
348
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
208
321
    static Field create_field_from_olap_value(const ValType& data) {
209
321
        auto f = Field(PType);
210
321
        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
321
        } else if constexpr (is_decimalv2(PType)) {
220
321
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
321
        f.template create_concrete<PType>(std::move(cpp_value));
225
321
        return f;
226
321
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
208
304
    static Field create_field_from_olap_value(const ValType& data) {
209
304
        auto f = Field(PType);
210
304
        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
304
        } else {
222
304
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
304
        }
224
304
        f.template create_concrete<PType>(std::move(cpp_value));
225
304
        return f;
226
304
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
208
302
    static Field create_field_from_olap_value(const ValType& data) {
209
302
        auto f = Field(PType);
210
302
        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
302
        } else {
222
302
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
302
        }
224
302
        f.template create_concrete<PType>(std::move(cpp_value));
225
302
        return f;
226
302
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_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_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
208
299
    static Field create_field_from_olap_value(const ValType& data) {
209
299
        auto f = Field(PType);
210
299
        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
299
        } else {
222
299
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
299
        }
224
299
        f.template create_concrete<PType>(std::move(cpp_value));
225
299
        return f;
226
299
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
208
325
    static Field create_field_from_olap_value(const ValType& data) {
209
325
        auto f = Field(PType);
210
325
        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
325
        } else {
222
325
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
325
        }
224
325
        f.template create_concrete<PType>(std::move(cpp_value));
225
325
        return f;
226
325
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
208
17.8k
    static Field create_field_from_olap_value(const ValType& data) {
209
17.8k
        auto f = Field(PType);
210
17.8k
        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
17.8k
        } else {
222
17.8k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
17.8k
        }
224
17.8k
        f.template create_concrete<PType>(std::move(cpp_value));
225
17.8k
        return f;
226
17.8k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
208
1.75k
    static Field create_field_from_olap_value(const ValType& data) {
209
1.75k
        auto f = Field(PType);
210
1.75k
        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.75k
        } else {
222
1.75k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
1.75k
        }
224
1.75k
        f.template create_concrete<PType>(std::move(cpp_value));
225
1.75k
        return f;
226
1.75k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
208
327
    static Field create_field_from_olap_value(const ValType& data) {
209
327
        auto f = Field(PType);
210
327
        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
327
        } else {
222
327
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
327
        }
224
327
        f.template create_concrete<PType>(std::move(cpp_value));
225
327
        return f;
226
327
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
208
3.11k
    static Field create_field_from_olap_value(const ValType& data) {
209
3.11k
        auto f = Field(PType);
210
3.11k
        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.11k
        } else {
222
3.11k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
3.11k
        }
224
3.11k
        f.template create_concrete<PType>(std::move(cpp_value));
225
3.11k
        return f;
226
3.11k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
208
305
    static Field create_field_from_olap_value(const ValType& data) {
209
305
        auto f = Field(PType);
210
305
        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
305
        } else {
222
305
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
305
        }
224
305
        f.template create_concrete<PType>(std::move(cpp_value));
225
305
        return f;
226
305
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
208
431
    static Field create_field_from_olap_value(const ValType& data) {
209
431
        auto f = Field(PType);
210
431
        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
431
        } else {
222
431
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
431
        }
224
431
        f.template create_concrete<PType>(std::move(cpp_value));
225
431
        return f;
226
431
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
208
41
    static Field create_field_from_olap_value(const ValType& data) {
209
41
        auto f = Field(PType);
210
41
        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
41
        } else {
222
41
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
41
        }
224
41
        f.template create_concrete<PType>(std::move(cpp_value));
225
41
        return f;
226
41
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
208
153
    static Field create_field_from_olap_value(const ValType& data) {
209
153
        auto f = Field(PType);
210
153
        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
153
        } else {
222
153
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
153
        }
224
153
        f.template create_concrete<PType>(std::move(cpp_value));
225
153
        return f;
226
153
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_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_13PrimitiveTypeE37EoEES0_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_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
37.3M
    Field& operator=(Field&& rhs) {
243
37.3M
        if (this != &rhs) {
244
37.3M
            if (type != rhs.type) {
245
24.6M
                destroy();
246
24.6M
                create(std::move(rhs));
247
24.6M
            } else {
248
12.7M
                assign(std::move(rhs));
249
12.7M
            }
250
37.3M
        }
251
37.3M
        return *this;
252
37.3M
    }
253
254
343M
    ~Field() { destroy(); }
255
256
49.8M
    PrimitiveType get_type() const { return type; }
257
    std::string get_type_name() const;
258
259
99.3M
    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
8.41k
    bool is_nan() const {
271
        // Keep type dispatch with the value so callers cannot reinterpret Field storage using a
272
        // mismatched PrimitiveType.
273
8.41k
        if (type == PrimitiveType::TYPE_FLOAT) {
274
43
            return std::isnan(get<TYPE_FLOAT>());
275
43
        }
276
8.37k
        if (type == PrimitiveType::TYPE_DOUBLE) {
277
43
            return std::isnan(get<TYPE_DOUBLE>());
278
43
        }
279
8.32k
        return false;
280
8.37k
    }
281
282
268k
    bool operator==(const Field& rhs) const {
283
268k
        return operator<=>(rhs) == std::strong_ordering::equal;
284
268k
    }
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
};