Coverage Report

Created: 2026-08-06 16:42

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