Coverage Report

Created: 2026-08-14 13:56

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