Coverage Report

Created: 2026-03-25 11:18

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.4M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
88
89
2.61M
    JsonbField(const char* ptr, size_t len) : size(len) {
90
2.61M
        data = std::make_unique<char[]>(size);
91
2.61M
        if (!data) {
92
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
93
0
        }
94
2.61M
        if (size > 0) {
95
2.59M
            memcpy(data.get(), ptr, size);
96
2.59M
        }
97
2.61M
    }
98
99
2.91M
    JsonbField(const JsonbField& x) : size(x.size) {
100
2.91M
        data = std::make_unique<char[]>(size);
101
2.91M
        if (!data) {
102
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
103
0
        }
104
2.91M
        if (size > 0) {
105
2.90M
            memcpy(data.get(), x.data.get(), size);
106
2.90M
        }
107
2.91M
    }
108
109
6.67M
    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
2.19M
    const char* get_value() const { return data.get(); }
136
2.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
138M
    Field() : type(PrimitiveType::TYPE_NULL) {}
194
    // set Types::Null explictly and avoid other types
195
167M
    Field(PrimitiveType w) : type(w) {}
196
    template <PrimitiveType T>
197
43.8M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
43.8M
        auto f = Field(T);
199
43.8M
        f.template create_concrete<T>(data);
200
43.8M
        return f;
201
43.8M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
21.2M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
21.2M
        auto f = Field(T);
199
21.2M
        f.template create_concrete<T>(data);
200
21.2M
        return f;
201
21.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
27.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
27.4k
        auto f = Field(T);
199
27.4k
        f.template create_concrete<T>(data);
200
27.4k
        return f;
201
27.4k
    }
_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.2M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
19.2M
        auto f = Field(T);
199
19.2M
        f.template create_concrete<T>(data);
200
19.2M
        return f;
201
19.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
175
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
175
        auto f = Field(T);
199
175
        f.template create_concrete<T>(data);
200
175
        return f;
201
175
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
126k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
126k
        auto f = Field(T);
199
126k
        f.template create_concrete<T>(data);
200
126k
        return f;
201
126k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
170k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
170k
        auto f = Field(T);
199
170k
        f.template create_concrete<T>(data);
200
170k
        return f;
201
170k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
45.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
45.4k
        auto f = Field(T);
199
45.4k
        f.template create_concrete<T>(data);
200
45.4k
        return f;
201
45.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
1.82M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
1.82M
        auto f = Field(T);
199
1.82M
        f.template create_concrete<T>(data);
200
1.82M
        return f;
201
1.82M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
33.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
33.4k
        auto f = Field(T);
199
33.4k
        f.template create_concrete<T>(data);
200
33.4k
        return f;
201
33.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
48.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
48.2k
        auto f = Field(T);
199
48.2k
        f.template create_concrete<T>(data);
200
48.2k
        return f;
201
48.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
202k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
202k
        auto f = Field(T);
199
202k
        f.template create_concrete<T>(data);
200
202k
        return f;
201
202k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
37.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
37.2k
        auto f = Field(T);
199
37.2k
        f.template create_concrete<T>(data);
200
37.2k
        return f;
201
37.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
9.62k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
9.62k
        auto f = Field(T);
199
9.62k
        f.template create_concrete<T>(data);
200
9.62k
        return f;
201
9.62k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
78.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
78.6k
        auto f = Field(T);
199
78.6k
        f.template create_concrete<T>(data);
200
78.6k
        return f;
201
78.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
14.7k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
14.7k
        auto f = Field(T);
199
14.7k
        f.template create_concrete<T>(data);
200
14.7k
        return f;
201
14.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
95.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
95.0k
        auto f = Field(T);
199
95.0k
        f.template create_concrete<T>(data);
200
95.0k
        return f;
201
95.0k
    }
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
11.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
11.5k
        auto f = Field(T);
199
11.5k
        f.template create_concrete<T>(data);
200
11.5k
        return f;
201
11.5k
    }
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
486k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
486k
        auto f = Field(T);
199
486k
        f.template create_concrete<T>(data);
200
486k
        return f;
201
486k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
24.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
24.2k
        auto f = Field(T);
199
24.2k
        f.template create_concrete<T>(data);
200
24.2k
        return f;
201
24.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
50.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
50.4k
        auto f = Field(T);
199
50.4k
        f.template create_concrete<T>(data);
200
50.4k
        return f;
201
50.4k
    }
_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
33.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
33.5k
        auto f = Field(T);
199
33.5k
        f.template create_concrete<T>(data);
200
33.5k
        return f;
201
33.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
39.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
39.8k
        auto f = Field(T);
199
39.8k
        f.template create_concrete<T>(data);
200
39.8k
        return f;
201
39.8k
    }
_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
1.44k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
1.44k
        auto f = Field(T);
199
1.44k
        f.template create_concrete<T>(data);
200
1.44k
        return f;
201
1.44k
    }
202
    template <PrimitiveType T>
203
109M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
109M
        auto f = Field(T);
205
109M
        f.template create_concrete<T>(std::move(data));
206
109M
        return f;
207
109M
    }
_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
240k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
240k
        auto f = Field(T);
205
240k
        f.template create_concrete<T>(std::move(data));
206
240k
        return f;
207
240k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.84M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.84M
        auto f = Field(T);
205
2.84M
        f.template create_concrete<T>(std::move(data));
206
2.84M
        return f;
207
2.84M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
68
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
68
        auto f = Field(T);
205
68
        f.template create_concrete<T>(std::move(data));
206
68
        return f;
207
68
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
9.62k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
9.62k
        auto f = Field(T);
205
9.62k
        f.template create_concrete<T>(std::move(data));
206
9.62k
        return f;
207
9.62k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
12.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
12.4k
        auto f = Field(T);
205
12.4k
        f.template create_concrete<T>(std::move(data));
206
12.4k
        return f;
207
12.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
24
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
24
        auto f = Field(T);
205
24
        f.template create_concrete<T>(std::move(data));
206
24
        return f;
207
24
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
240k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
240k
        auto f = Field(T);
205
240k
        f.template create_concrete<T>(std::move(data));
206
240k
        return f;
207
240k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
56.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
56.1k
        auto f = Field(T);
205
56.1k
        f.template create_concrete<T>(std::move(data));
206
56.1k
        return f;
207
56.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
51.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
51.1k
        auto f = Field(T);
205
51.1k
        f.template create_concrete<T>(std::move(data));
206
51.1k
        return f;
207
51.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
13.6M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
13.6M
        auto f = Field(T);
205
13.6M
        f.template create_concrete<T>(std::move(data));
206
13.6M
        return f;
207
13.6M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
10.3k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
10.3k
        auto f = Field(T);
205
10.3k
        f.template create_concrete<T>(std::move(data));
206
10.3k
        return f;
207
10.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
10.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
10.4k
        auto f = Field(T);
205
10.4k
        f.template create_concrete<T>(std::move(data));
206
10.4k
        return f;
207
10.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
93.9k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
93.9k
        auto f = Field(T);
205
93.9k
        f.template create_concrete<T>(std::move(data));
206
93.9k
        return f;
207
93.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
54.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
54.0k
        auto f = Field(T);
205
54.0k
        f.template create_concrete<T>(std::move(data));
206
54.0k
        return f;
207
54.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.81M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.81M
        auto f = Field(T);
205
2.81M
        f.template create_concrete<T>(std::move(data));
206
2.81M
        return f;
207
2.81M
    }
_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
7.79M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
7.79M
        auto f = Field(T);
205
7.79M
        f.template create_concrete<T>(std::move(data));
206
7.79M
        return f;
207
7.79M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
106k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
106k
        auto f = Field(T);
205
106k
        f.template create_concrete<T>(std::move(data));
206
106k
        return f;
207
106k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.13M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.13M
        auto f = Field(T);
205
1.13M
        f.template create_concrete<T>(std::move(data));
206
1.13M
        return f;
207
1.13M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
30.2M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
30.2M
        auto f = Field(T);
205
30.2M
        f.template create_concrete<T>(std::move(data));
206
30.2M
        return f;
207
30.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
127k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
127k
        auto f = Field(T);
205
127k
        f.template create_concrete<T>(std::move(data));
206
127k
        return f;
207
127k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
58.3k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
58.3k
        auto f = Field(T);
205
58.3k
        f.template create_concrete<T>(std::move(data));
206
58.3k
        return f;
207
58.3k
    }
_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.23k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.23k
        auto f = Field(T);
205
5.23k
        f.template create_concrete<T>(std::move(data));
206
5.23k
        return f;
207
5.23k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.86k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.86k
        auto f = Field(T);
205
2.86k
        f.template create_concrete<T>(std::move(data));
206
2.86k
        return f;
207
2.86k
    }
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
26.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
26.0k
        auto f = Field(T);
205
26.0k
        f.template create_concrete<T>(std::move(data));
206
26.0k
        return f;
207
26.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.31M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.31M
        auto f = Field(T);
205
2.31M
        f.template create_concrete<T>(std::move(data));
206
2.31M
        return f;
207
2.31M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
20
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
20
        auto f = Field(T);
205
20
        f.template create_concrete<T>(std::move(data));
206
20
        return f;
207
20
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
59
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
59
        auto f = Field(T);
205
59
        f.template create_concrete<T>(std::move(data));
206
59
        return f;
207
59
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
24.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
24.1k
        auto f = Field(T);
205
24.1k
        f.template create_concrete<T>(std::move(data));
206
24.1k
        return f;
207
24.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.93k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.93k
        auto f = Field(T);
205
5.93k
        f.template create_concrete<T>(std::move(data));
206
5.93k
        return f;
207
5.93k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
774k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
774k
        auto f = Field(T);
205
774k
        f.template create_concrete<T>(std::move(data));
206
774k
        return f;
207
774k
    }
208
209
    template <PrimitiveType PType, typename ValType = std::conditional_t<
210
                                           doris::is_string_type(PType), StringRef,
211
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
212
5.80M
    static Field create_field_from_olap_value(const ValType& data) {
213
5.80M
        auto f = Field(PType);
214
5.80M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
5.80M
        if constexpr (is_string_type(PType)) {
216
2.62M
            auto min_size =
217
2.62M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
2.62M
            cpp_value = String(data.data, min_size);
219
2.62M
        } else if constexpr (is_date_or_datetime(PType)) {
220
1.11k
            if constexpr (PType == TYPE_DATE) {
221
390
                cpp_value.from_olap_date(data);
222
725
            } else {
223
725
                cpp_value.from_olap_datetime(data);
224
725
            }
225
1.11k
        } else if constexpr (is_decimalv2(PType)) {
226
148
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
3.17M
        } else {
228
3.17M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
3.17M
        }
230
5.80M
        f.template create_concrete<PType>(std::move(cpp_value));
231
5.80M
        return f;
232
5.80M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
212
111k
    static Field create_field_from_olap_value(const ValType& data) {
213
111k
        auto f = Field(PType);
214
111k
        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
111k
        } else {
228
111k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
111k
        }
230
111k
        f.template create_concrete<PType>(std::move(cpp_value));
231
111k
        return f;
232
111k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
212
24.7k
    static Field create_field_from_olap_value(const ValType& data) {
213
24.7k
        auto f = Field(PType);
214
24.7k
        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
24.7k
        } else {
228
24.7k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
24.7k
        }
230
24.7k
        f.template create_concrete<PType>(std::move(cpp_value));
231
24.7k
        return f;
232
24.7k
    }
_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
835k
    static Field create_field_from_olap_value(const ValType& data) {
213
835k
        auto f = Field(PType);
214
835k
        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
835k
        } else {
228
835k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
835k
        }
230
835k
        f.template create_concrete<PType>(std::move(cpp_value));
231
835k
        return f;
232
835k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
212
42.8k
    static Field create_field_from_olap_value(const ValType& data) {
213
42.8k
        auto f = Field(PType);
214
42.8k
        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
42.8k
        } else {
228
42.8k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
42.8k
        }
230
42.8k
        f.template create_concrete<PType>(std::move(cpp_value));
231
42.8k
        return f;
232
42.8k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
212
15.1k
    static Field create_field_from_olap_value(const ValType& data) {
213
15.1k
        auto f = Field(PType);
214
15.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
15.1k
        } else {
228
15.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
15.1k
        }
230
15.1k
        f.template create_concrete<PType>(std::move(cpp_value));
231
15.1k
        return f;
232
15.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
212
33.2k
    static Field create_field_from_olap_value(const ValType& data) {
213
33.2k
        auto f = Field(PType);
214
33.2k
        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
33.2k
        } else {
228
33.2k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
33.2k
        }
230
33.2k
        f.template create_concrete<PType>(std::move(cpp_value));
231
33.2k
        return f;
232
33.2k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
70.7k
    static Field create_field_from_olap_value(const ValType& data) {
213
70.7k
        auto f = Field(PType);
214
70.7k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
70.7k
        if constexpr (is_string_type(PType)) {
216
70.7k
            auto min_size =
217
70.7k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
70.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
70.7k
        f.template create_concrete<PType>(std::move(cpp_value));
231
70.7k
        return f;
232
70.7k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
212
390
    static Field create_field_from_olap_value(const ValType& data) {
213
390
        auto f = Field(PType);
214
390
        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
390
        } else if constexpr (is_date_or_datetime(PType)) {
220
390
            if constexpr (PType == TYPE_DATE) {
221
390
                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
390
        f.template create_concrete<PType>(std::move(cpp_value));
231
390
        return f;
232
390
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
212
725
    static Field create_field_from_olap_value(const ValType& data) {
213
725
        auto f = Field(PType);
214
725
        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
725
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
725
            } else {
223
725
                cpp_value.from_olap_datetime(data);
224
725
            }
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
725
        f.template create_concrete<PType>(std::move(cpp_value));
231
725
        return f;
232
725
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
212
143k
    static Field create_field_from_olap_value(const ValType& data) {
213
143k
        auto f = Field(PType);
214
143k
        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
143k
        } else {
228
143k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
143k
        }
230
143k
        f.template create_concrete<PType>(std::move(cpp_value));
231
143k
        return f;
232
143k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
212
81.9k
    static Field create_field_from_olap_value(const ValType& data) {
213
81.9k
        auto f = Field(PType);
214
81.9k
        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
81.9k
        } else {
228
81.9k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
81.9k
        }
230
81.9k
        f.template create_concrete<PType>(std::move(cpp_value));
231
81.9k
        return f;
232
81.9k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
212
6.48k
    static Field create_field_from_olap_value(const ValType& data) {
213
6.48k
        auto f = Field(PType);
214
6.48k
        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.48k
        } else {
228
6.48k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
6.48k
        }
230
6.48k
        f.template create_concrete<PType>(std::move(cpp_value));
231
6.48k
        return f;
232
6.48k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
212
1.26k
    static Field create_field_from_olap_value(const ValType& data) {
213
1.26k
        auto f = Field(PType);
214
1.26k
        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.26k
        } else {
228
1.26k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.26k
        }
230
1.26k
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.26k
        return f;
232
1.26k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
212
6.07k
    static Field create_field_from_olap_value(const ValType& data) {
213
6.07k
        auto f = Field(PType);
214
6.07k
        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.07k
        } else {
228
6.07k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
6.07k
        }
230
6.07k
        f.template create_concrete<PType>(std::move(cpp_value));
231
6.07k
        return f;
232
6.07k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
473k
    static Field create_field_from_olap_value(const ValType& data) {
213
473k
        auto f = Field(PType);
214
473k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
473k
        if constexpr (is_string_type(PType)) {
216
473k
            auto min_size =
217
473k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
473k
            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
473k
        f.template create_concrete<PType>(std::move(cpp_value));
231
473k
        return f;
232
473k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
2.07M
    static Field create_field_from_olap_value(const ValType& data) {
213
2.07M
        auto f = Field(PType);
214
2.07M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
2.07M
        if constexpr (is_string_type(PType)) {
216
2.07M
            auto min_size =
217
2.07M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
2.07M
            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
2.07M
        f.template create_concrete<PType>(std::move(cpp_value));
231
2.07M
        return f;
232
2.07M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
212
7.32k
    static Field create_field_from_olap_value(const ValType& data) {
213
7.32k
        auto f = Field(PType);
214
7.32k
        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.32k
        } else {
228
7.32k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
7.32k
        }
230
7.32k
        f.template create_concrete<PType>(std::move(cpp_value));
231
7.32k
        return f;
232
7.32k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
212
67.4k
    static Field create_field_from_olap_value(const ValType& data) {
213
67.4k
        auto f = Field(PType);
214
67.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
67.4k
        } else {
228
67.4k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
67.4k
        }
230
67.4k
        f.template create_concrete<PType>(std::move(cpp_value));
231
67.4k
        return f;
232
67.4k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
212
22.0k
    static Field create_field_from_olap_value(const ValType& data) {
213
22.0k
        auto f = Field(PType);
214
22.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
22.0k
        } else {
228
22.0k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
22.0k
        }
230
22.0k
        f.template create_concrete<PType>(std::move(cpp_value));
231
22.0k
        return f;
232
22.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
212
1.15k
    static Field create_field_from_olap_value(const ValType& data) {
213
1.15k
        auto f = Field(PType);
214
1.15k
        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.15k
        } else {
228
1.15k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.15k
        }
230
1.15k
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.15k
        return f;
232
1.15k
    }
_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
169k
    static Field create_field_from_olap_value(const ValType& data) {
213
169k
        auto f = Field(PType);
214
169k
        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
169k
        } else {
228
169k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
169k
        }
230
169k
        f.template create_concrete<PType>(std::move(cpp_value));
231
169k
        return f;
232
169k
    }
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
22.3M
    bool is_complex_field() const {
244
22.3M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
245
22.3M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
246
22.3M
    }
247
248
108M
    Field& operator=(Field&& rhs) {
249
108M
        if (this != &rhs) {
250
108M
            if (type != rhs.type) {
251
75.9M
                destroy();
252
75.9M
                create(std::move(rhs));
253
75.9M
            } else {
254
33.0M
                assign(std::move(rhs));
255
33.0M
            }
256
108M
        }
257
108M
        return *this;
258
108M
    }
259
260
560M
    ~Field() { destroy(); }
261
262
150M
    PrimitiveType get_type() const { return type; }
263
    std::string get_type_name() const;
264
265
118M
    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
8.65M
    bool operator==(const Field& rhs) const {
277
8.65M
        return operator<=>(rhs) == std::strong_ordering::equal;
278
8.65M
    }
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.48k
    size_t operator()(const doris::Field& field) const {
330
1.48k
        if (field.is_null()) {
331
158
            return 0;
332
158
        }
333
1.32k
        std::hash<std::string_view> hasher;
334
1.32k
        return hasher(field.as_string_view());
335
1.48k
    }
336
};