Coverage Report

Created: 2026-03-24 16:04

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 Tuple 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 Tuple 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 Tuple : 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
206k
    JsonbField() = default;
87
12.2M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
88
89
2.39M
    JsonbField(const char* ptr, size_t len) : size(len) {
90
2.39M
        data = std::make_unique<char[]>(size);
91
2.39M
        if (!data) {
92
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
93
0
        }
94
2.39M
        if (size > 0) {
95
2.38M
            memcpy(data.get(), ptr, size);
96
2.38M
        }
97
2.39M
    }
98
99
2.70M
    JsonbField(const JsonbField& x) : size(x.size) {
100
2.70M
        data = std::make_unique<char[]>(size);
101
2.70M
        if (!data) {
102
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
103
0
        }
104
2.70M
        if (size > 0) {
105
2.68M
            memcpy(data.get(), x.data.get(), size);
106
2.68M
        }
107
2.70M
    }
108
109
6.92M
    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
21
    JsonbField& operator=(const JsonbField& x) {
113
21
        if (this != &x) {
114
21
            data = std::make_unique<char[]>(x.size);
115
21
            if (!data) {
116
0
                throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size));
117
0
            }
118
21
            if (x.size > 0) {
119
20
                memcpy(data.get(), x.data.get(), x.size);
120
20
            }
121
21
            size = x.size;
122
21
        }
123
21
        return *this;
124
21
    }
125
126
204k
    JsonbField& operator=(JsonbField&& x) noexcept {
127
204k
        if (this != &x) {
128
204k
            data = std::move(x.data);
129
204k
            size = x.size;
130
204k
            x.size = 0;
131
204k
        }
132
204k
        return *this;
133
204k
    }
134
135
1.98M
    const char* get_value() const { return data.get(); }
136
2.01M
    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
123M
    Field() : type(PrimitiveType::TYPE_NULL) {}
194
    // set Types::Null explictly and avoid other types
195
141M
    Field(PrimitiveType w) : type(w) {}
196
    template <PrimitiveType T>
197
23.8M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
23.8M
        auto f = Field(T);
199
23.8M
        f.template create_concrete<T>(data);
200
23.8M
        return f;
201
23.8M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
1.35M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
1.35M
        auto f = Field(T);
199
1.35M
        f.template create_concrete<T>(data);
200
1.35M
        return f;
201
1.35M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
27.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
27.5k
        auto f = Field(T);
199
27.5k
        f.template create_concrete<T>(data);
200
27.5k
        return f;
201
27.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
6
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
6
        auto f = Field(T);
199
6
        f.template create_concrete<T>(data);
200
6
        return f;
201
6
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
19.1M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
19.1M
        auto f = Field(T);
199
19.1M
        f.template create_concrete<T>(data);
200
19.1M
        return f;
201
19.1M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
170
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
170
        auto f = Field(T);
199
170
        f.template create_concrete<T>(data);
200
170
        return f;
201
170
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
122k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
122k
        auto f = Field(T);
199
122k
        f.template create_concrete<T>(data);
200
122k
        return f;
201
122k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
125k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
125k
        auto f = Field(T);
199
125k
        f.template create_concrete<T>(data);
200
125k
        return f;
201
125k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
42.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
42.5k
        auto f = Field(T);
199
42.5k
        f.template create_concrete<T>(data);
200
42.5k
        return f;
201
42.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
1.45M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
1.45M
        auto f = Field(T);
199
1.45M
        f.template create_concrete<T>(data);
200
1.45M
        return f;
201
1.45M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
32.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
32.3k
        auto f = Field(T);
199
32.3k
        f.template create_concrete<T>(data);
200
32.3k
        return f;
201
32.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
38.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
38.4k
        auto f = Field(T);
199
38.4k
        f.template create_concrete<T>(data);
200
38.4k
        return f;
201
38.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
371k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
371k
        auto f = Field(T);
199
371k
        f.template create_concrete<T>(data);
200
371k
        return f;
201
371k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
37.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
37.3k
        auto f = Field(T);
199
37.3k
        f.template create_concrete<T>(data);
200
37.3k
        return f;
201
37.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
9.58k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
9.58k
        auto f = Field(T);
199
9.58k
        f.template create_concrete<T>(data);
200
9.58k
        return f;
201
9.58k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
66.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
66.5k
        auto f = Field(T);
199
66.5k
        f.template create_concrete<T>(data);
200
66.5k
        return f;
201
66.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
14.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
14.6k
        auto f = Field(T);
199
14.6k
        f.template create_concrete<T>(data);
200
14.6k
        return f;
201
14.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
82.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
82.2k
        auto f = Field(T);
199
82.2k
        f.template create_concrete<T>(data);
200
82.2k
        return f;
201
82.2k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE21EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
127
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
127
        auto f = Field(T);
199
127
        f.template create_concrete<T>(data);
200
127
        return f;
201
127
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
12.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
12.1k
        auto f = Field(T);
199
12.1k
        f.template create_concrete<T>(data);
200
12.1k
        return f;
201
12.1k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
771k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
771k
        auto f = Field(T);
199
771k
        f.template create_concrete<T>(data);
200
771k
        return f;
201
771k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_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_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
27.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
27.8k
        auto f = Field(T);
199
27.8k
        f.template create_concrete<T>(data);
200
27.8k
        return f;
201
27.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
8.72k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
8.72k
        auto f = Field(T);
199
8.72k
        f.template create_concrete<T>(data);
200
8.72k
        return f;
201
8.72k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
28.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
28.4k
        auto f = Field(T);
199
28.4k
        f.template create_concrete<T>(data);
200
28.4k
        return f;
201
28.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
39.7k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
39.7k
        auto f = Field(T);
199
39.7k
        f.template create_concrete<T>(data);
200
39.7k
        return f;
201
39.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
22.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
22.3k
        auto f = Field(T);
199
22.3k
        f.template create_concrete<T>(data);
200
22.3k
        return f;
201
22.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
2.42k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
2.42k
        auto f = Field(T);
199
2.42k
        f.template create_concrete<T>(data);
200
2.42k
        return f;
201
2.42k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
403
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
403
        auto f = Field(T);
199
403
        f.template create_concrete<T>(data);
200
403
        return f;
201
403
    }
_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
31
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
31
        auto f = Field(T);
199
31
        f.template create_concrete<T>(data);
200
31
        return f;
201
31
    }
_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
    }
202
    template <PrimitiveType T>
203
94.0M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
94.0M
        auto f = Field(T);
205
94.0M
        f.template create_concrete<T>(std::move(data));
206
94.0M
        return f;
207
94.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
15.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
15.5M
        auto f = Field(T);
205
15.5M
        f.template create_concrete<T>(std::move(data));
206
15.5M
        return f;
207
15.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
208k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
208k
        auto f = Field(T);
205
208k
        f.template create_concrete<T>(std::move(data));
206
208k
        return f;
207
208k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
298k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
298k
        auto f = Field(T);
205
298k
        f.template create_concrete<T>(std::move(data));
206
298k
        return f;
207
298k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
62
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
62
        auto f = Field(T);
205
62
        f.template create_concrete<T>(std::move(data));
206
62
        return f;
207
62
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
3.21k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
3.21k
        auto f = Field(T);
205
3.21k
        f.template create_concrete<T>(std::move(data));
206
3.21k
        return f;
207
3.21k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
3.52k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
3.52k
        auto f = Field(T);
205
3.52k
        f.template create_concrete<T>(std::move(data));
206
3.52k
        return f;
207
3.52k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
18
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
18
        auto f = Field(T);
205
18
        f.template create_concrete<T>(std::move(data));
206
18
        return f;
207
18
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
469k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
469k
        auto f = Field(T);
205
469k
        f.template create_concrete<T>(std::move(data));
206
469k
        return f;
207
469k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
54.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
54.4k
        auto f = Field(T);
205
54.4k
        f.template create_concrete<T>(std::move(data));
206
54.4k
        return f;
207
54.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
39.3k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
39.3k
        auto f = Field(T);
205
39.3k
        f.template create_concrete<T>(std::move(data));
206
39.3k
        return f;
207
39.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
13.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
13.5M
        auto f = Field(T);
205
13.5M
        f.template create_concrete<T>(std::move(data));
206
13.5M
        return f;
207
13.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
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_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
9.54k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
9.54k
        auto f = Field(T);
205
9.54k
        f.template create_concrete<T>(std::move(data));
206
9.54k
        return f;
207
9.54k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
154k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
154k
        auto f = Field(T);
205
154k
        f.template create_concrete<T>(std::move(data));
206
154k
        return f;
207
154k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
53.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
53.0k
        auto f = Field(T);
205
53.0k
        f.template create_concrete<T>(std::move(data));
206
53.0k
        return f;
207
53.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.60M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.60M
        auto f = Field(T);
205
2.60M
        f.template create_concrete<T>(std::move(data));
206
2.60M
        return f;
207
2.60M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
28.6M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
28.6M
        auto f = Field(T);
205
28.6M
        f.template create_concrete<T>(std::move(data));
206
28.6M
        return f;
207
28.6M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.83M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.83M
        auto f = Field(T);
205
5.83M
        f.template create_concrete<T>(std::move(data));
206
5.83M
        return f;
207
5.83M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
90.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
90.4k
        auto f = Field(T);
205
90.4k
        f.template create_concrete<T>(std::move(data));
206
90.4k
        return f;
207
90.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
994k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
994k
        auto f = Field(T);
205
994k
        f.template create_concrete<T>(std::move(data));
206
994k
        return f;
207
994k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
20.4M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
20.4M
        auto f = Field(T);
205
20.4M
        f.template create_concrete<T>(std::move(data));
206
20.4M
        return f;
207
20.4M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
119k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
119k
        auto f = Field(T);
205
119k
        f.template create_concrete<T>(std::move(data));
206
119k
        return f;
207
119k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
42.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
42.7k
        auto f = Field(T);
205
42.7k
        f.template create_concrete<T>(std::move(data));
206
42.7k
        return f;
207
42.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.99M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.99M
        auto f = Field(T);
205
2.99M
        f.template create_concrete<T>(std::move(data));
206
2.99M
        return f;
207
2.99M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.06k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.06k
        auto f = Field(T);
205
5.06k
        f.template create_concrete<T>(std::move(data));
206
5.06k
        return f;
207
5.06k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.67k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.67k
        auto f = Field(T);
205
2.67k
        f.template create_concrete<T>(std::move(data));
206
2.67k
        return f;
207
2.67k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE21EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5
        auto f = Field(T);
205
5
        f.template create_concrete<T>(std::move(data));
206
5
        return f;
207
5
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
20.9k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
20.9k
        auto f = Field(T);
205
20.9k
        f.template create_concrete<T>(std::move(data));
206
20.9k
        return f;
207
20.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.02M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.02M
        auto f = Field(T);
205
1.02M
        f.template create_concrete<T>(std::move(data));
206
1.02M
        return f;
207
1.02M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
18
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
18
        auto f = Field(T);
205
18
        f.template create_concrete<T>(std::move(data));
206
18
        return f;
207
18
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
19
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
19
        auto f = Field(T);
205
19
        f.template create_concrete<T>(std::move(data));
206
19
        return f;
207
19
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
26.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
26.1k
        auto f = Field(T);
205
26.1k
        f.template create_concrete<T>(std::move(data));
206
26.1k
        return f;
207
26.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.79k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.79k
        auto f = Field(T);
205
5.79k
        f.template create_concrete<T>(std::move(data));
206
5.79k
        return f;
207
5.79k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
666k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
666k
        auto f = Field(T);
205
666k
        f.template create_concrete<T>(std::move(data));
206
666k
        return f;
207
666k
    }
208
209
    template <PrimitiveType PType, typename ValType = std::conditional_t<
210
                                           doris::is_string_type(PType), StringRef,
211
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
212
8.88M
    static Field create_field_from_olap_value(const ValType& data) {
213
8.88M
        auto f = Field(PType);
214
8.88M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
8.88M
        if constexpr (is_string_type(PType)) {
216
5.00M
            auto min_size =
217
5.00M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
5.00M
            cpp_value = String(data.data, min_size);
219
5.00M
        } else if constexpr (is_date_or_datetime(PType)) {
220
1.17k
            if constexpr (PType == TYPE_DATE) {
221
452
                cpp_value.from_olap_date(data);
222
723
            } else {
223
723
                cpp_value.from_olap_datetime(data);
224
723
            }
225
1.17k
        } else if constexpr (is_decimalv2(PType)) {
226
148
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
3.87M
        } else {
228
3.87M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
3.87M
        }
230
8.88M
        f.template create_concrete<PType>(std::move(cpp_value));
231
8.88M
        return f;
232
8.88M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
212
103k
    static Field create_field_from_olap_value(const ValType& data) {
213
103k
        auto f = Field(PType);
214
103k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
103k
        } else {
228
103k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
103k
        }
230
103k
        f.template create_concrete<PType>(std::move(cpp_value));
231
103k
        return f;
232
103k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
212
23.6k
    static Field create_field_from_olap_value(const ValType& data) {
213
23.6k
        auto f = Field(PType);
214
23.6k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
23.6k
        } else {
228
23.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
23.6k
        }
230
23.6k
        f.template create_concrete<PType>(std::move(cpp_value));
231
23.6k
        return f;
232
23.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
212
1.60M
    static Field create_field_from_olap_value(const ValType& data) {
213
1.60M
        auto f = Field(PType);
214
1.60M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
1.60M
        } else {
228
1.60M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.60M
        }
230
1.60M
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.60M
        return f;
232
1.60M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
212
1.20M
    static Field create_field_from_olap_value(const ValType& data) {
213
1.20M
        auto f = Field(PType);
214
1.20M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
1.20M
        } else {
228
1.20M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.20M
        }
230
1.20M
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.20M
        return f;
232
1.20M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
212
57.1k
    static Field create_field_from_olap_value(const ValType& data) {
213
57.1k
        auto f = Field(PType);
214
57.1k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
57.1k
        } else {
228
57.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
57.1k
        }
230
57.1k
        f.template create_concrete<PType>(std::move(cpp_value));
231
57.1k
        return f;
232
57.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
212
14.4k
    static Field create_field_from_olap_value(const ValType& data) {
213
14.4k
        auto f = Field(PType);
214
14.4k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
14.4k
        } else {
228
14.4k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
14.4k
        }
230
14.4k
        f.template create_concrete<PType>(std::move(cpp_value));
231
14.4k
        return f;
232
14.4k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
212
31.6k
    static Field create_field_from_olap_value(const ValType& data) {
213
31.6k
        auto f = Field(PType);
214
31.6k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
31.6k
        } else {
228
31.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
31.6k
        }
230
31.6k
        f.template create_concrete<PType>(std::move(cpp_value));
231
31.6k
        return f;
232
31.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
69.7k
    static Field create_field_from_olap_value(const ValType& data) {
213
69.7k
        auto f = Field(PType);
214
69.7k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
69.7k
        if constexpr (is_string_type(PType)) {
216
69.7k
            auto min_size =
217
69.7k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
69.7k
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
69.7k
        f.template create_concrete<PType>(std::move(cpp_value));
231
69.7k
        return f;
232
69.7k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
212
452
    static Field create_field_from_olap_value(const ValType& data) {
213
452
        auto f = Field(PType);
214
452
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
452
        } else if constexpr (is_date_or_datetime(PType)) {
220
452
            if constexpr (PType == TYPE_DATE) {
221
452
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
452
        f.template create_concrete<PType>(std::move(cpp_value));
231
452
        return f;
232
452
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
212
723
    static Field create_field_from_olap_value(const ValType& data) {
213
723
        auto f = Field(PType);
214
723
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
723
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
723
            } else {
223
723
                cpp_value.from_olap_datetime(data);
224
723
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
723
        f.template create_concrete<PType>(std::move(cpp_value));
231
723
        return f;
232
723
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
212
157k
    static Field create_field_from_olap_value(const ValType& data) {
213
157k
        auto f = Field(PType);
214
157k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
157k
        } else {
228
157k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
157k
        }
230
157k
        f.template create_concrete<PType>(std::move(cpp_value));
231
157k
        return f;
232
157k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
212
144k
    static Field create_field_from_olap_value(const ValType& data) {
213
144k
        auto f = Field(PType);
214
144k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
144k
        } else {
228
144k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
144k
        }
230
144k
        f.template create_concrete<PType>(std::move(cpp_value));
231
144k
        return f;
232
144k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
212
6.50k
    static Field create_field_from_olap_value(const ValType& data) {
213
6.50k
        auto f = Field(PType);
214
6.50k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
6.50k
        } else {
228
6.50k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
6.50k
        }
230
6.50k
        f.template create_concrete<PType>(std::move(cpp_value));
231
6.50k
        return f;
232
6.50k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
212
51.3k
    static Field create_field_from_olap_value(const ValType& data) {
213
51.3k
        auto f = Field(PType);
214
51.3k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
51.3k
        } else {
228
51.3k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
51.3k
        }
230
51.3k
        f.template create_concrete<PType>(std::move(cpp_value));
231
51.3k
        return f;
232
51.3k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
212
11.0k
    static Field create_field_from_olap_value(const ValType& data) {
213
11.0k
        auto f = Field(PType);
214
11.0k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
11.0k
        } else {
228
11.0k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
11.0k
        }
230
11.0k
        f.template create_concrete<PType>(std::move(cpp_value));
231
11.0k
        return f;
232
11.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
427k
    static Field create_field_from_olap_value(const ValType& data) {
213
427k
        auto f = Field(PType);
214
427k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
427k
        if constexpr (is_string_type(PType)) {
216
427k
            auto min_size =
217
427k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
427k
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
427k
        f.template create_concrete<PType>(std::move(cpp_value));
231
427k
        return f;
232
427k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
4.50M
    static Field create_field_from_olap_value(const ValType& data) {
213
4.50M
        auto f = Field(PType);
214
4.50M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
4.50M
        if constexpr (is_string_type(PType)) {
216
4.50M
            auto min_size =
217
4.50M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
4.50M
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
4.50M
        f.template create_concrete<PType>(std::move(cpp_value));
231
4.50M
        return f;
232
4.50M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
212
7.06k
    static Field create_field_from_olap_value(const ValType& data) {
213
7.06k
        auto f = Field(PType);
214
7.06k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
7.06k
        } else {
228
7.06k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
7.06k
        }
230
7.06k
        f.template create_concrete<PType>(std::move(cpp_value));
231
7.06k
        return f;
232
7.06k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
212
66.4k
    static Field create_field_from_olap_value(const ValType& data) {
213
66.4k
        auto f = Field(PType);
214
66.4k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
66.4k
        } else {
228
66.4k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
66.4k
        }
230
66.4k
        f.template create_concrete<PType>(std::move(cpp_value));
231
66.4k
        return f;
232
66.4k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
212
31.5k
    static Field create_field_from_olap_value(const ValType& data) {
213
31.5k
        auto f = Field(PType);
214
31.5k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
31.5k
        } else {
228
31.5k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
31.5k
        }
230
31.5k
        f.template create_concrete<PType>(std::move(cpp_value));
231
31.5k
        return f;
232
31.5k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
212
1.14k
    static Field create_field_from_olap_value(const ValType& data) {
213
1.14k
        auto f = Field(PType);
214
1.14k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
1.14k
        } else {
228
1.14k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.14k
        }
230
1.14k
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.14k
        return f;
232
1.14k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
212
148
    static Field create_field_from_olap_value(const ValType& data) {
213
148
        auto f = Field(PType);
214
148
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
148
        } else if constexpr (is_decimalv2(PType)) {
226
148
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
148
        f.template create_concrete<PType>(std::move(cpp_value));
231
148
        return f;
232
148
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
212
356k
    static Field create_field_from_olap_value(const ValType& data) {
213
356k
        auto f = Field(PType);
214
356k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
356k
        } else {
228
356k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
356k
        }
230
356k
        f.template create_concrete<PType>(std::move(cpp_value));
231
356k
        return f;
232
356k
    }
233
234
    /** Despite the presence of a template constructor, this constructor is still needed,
235
      *  since, in its absence, the compiler will still generate the default constructor.
236
      */
237
    Field(const Field& rhs);
238
239
    Field(Field&& rhs);
240
241
    Field& operator=(const Field& rhs);
242
243
20.5M
    bool is_complex_field() const {
244
20.5M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
245
20.5M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
246
20.5M
    }
247
248
84.8M
    Field& operator=(Field&& rhs) {
249
84.8M
        if (this != &rhs) {
250
84.8M
            if (type != rhs.type) {
251
39.7M
                destroy();
252
39.7M
                create(std::move(rhs));
253
45.0M
            } else {
254
45.0M
                assign(std::move(rhs));
255
45.0M
            }
256
84.8M
        }
257
84.8M
        return *this;
258
84.8M
    }
259
260
529M
    ~Field() { destroy(); }
261
262
149M
    PrimitiveType get_type() const { return type; }
263
    std::string get_type_name() const;
264
265
135M
    bool is_null() const { return type == PrimitiveType::TYPE_NULL; }
266
267
    // The template parameter T needs to be consistent with `which`.
268
    // If not, use NearestFieldType<> externally.
269
    // Maybe modify this in the future, reference: https://github.com/ClickHouse/ClickHouse/pull/22003
270
    template <PrimitiveType T>
271
    typename PrimitiveTypeTraits<T>::CppType& get();
272
273
    template <PrimitiveType T>
274
    const typename PrimitiveTypeTraits<T>::CppType& get() const;
275
276
15.0M
    bool operator==(const Field& rhs) const {
277
15.0M
        return operator<=>(rhs) == std::strong_ordering::equal;
278
15.0M
    }
279
280
    std::strong_ordering operator<=>(const Field& rhs) const;
281
282
    std::string_view as_string_view() const;
283
284
private:
285
    std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
286
                         Int128, IPv6, Float64, String, JsonbField, StringView, Array, Tuple, Map,
287
                         VariantMap, Decimal32, Decimal64, DecimalV2Value, Decimal128V3, Decimal256,
288
                         BitmapValue, HyperLogLog, QuantileState>
289
            storage;
290
291
    PrimitiveType type;
292
293
    /// Assuming there was no allocated state or it was deallocated (see destroy).
294
    template <PrimitiveType Type>
295
    void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
296
    template <PrimitiveType Type>
297
    void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
298
    /// Assuming same types.
299
    template <PrimitiveType Type>
300
    void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
301
    template <PrimitiveType Type>
302
    void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
303
304
    void create(const Field& field);
305
    void create(Field&& field);
306
307
    void assign(const Field& x);
308
    void assign(Field&& x);
309
310
    void destroy();
311
312
    template <PrimitiveType T>
313
    void destroy();
314
};
315
316
struct FieldWithDataType {
317
    Field field;
318
    // used for nested type of array
319
    PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE;
320
    uint8_t num_dimensions = 0;
321
    int precision = -1;
322
    int scale = -1;
323
};
324
325
} // namespace doris
326
327
template <>
328
struct std::hash<doris::Field> {
329
1.46k
    size_t operator()(const doris::Field& field) const {
330
1.46k
        if (field.is_null()) {
331
158
            return 0;
332
158
        }
333
1.31k
        std::hash<std::string_view> hasher;
334
1.31k
        return hasher(field.as_string_view());
335
1.46k
    }
336
};