Coverage Report

Created: 2026-03-30 11:06

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
10.4M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
88
89
2.35M
    JsonbField(const char* ptr, size_t len) : size(len) {
90
2.35M
        data = std::make_unique<char[]>(size);
91
2.35M
        if (!data) {
92
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
93
0
        }
94
2.35M
        if (size > 0) {
95
2.34M
            memcpy(data.get(), ptr, size);
96
2.34M
        }
97
2.35M
    }
98
99
2.50M
    JsonbField(const JsonbField& x) : size(x.size) {
100
2.50M
        data = std::make_unique<char[]>(size);
101
2.50M
        if (!data) {
102
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
103
0
        }
104
2.50M
        if (size > 0) {
105
2.49M
            memcpy(data.get(), x.data.get(), size);
106
2.49M
        }
107
2.50M
    }
108
109
5.41M
    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
22
    JsonbField& operator=(const JsonbField& x) {
113
22
        if (this != &x) {
114
22
            data = std::make_unique<char[]>(x.size);
115
22
            if (!data) {
116
0
                throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size));
117
0
            }
118
22
            if (x.size > 0) {
119
21
                memcpy(data.get(), x.data.get(), x.size);
120
21
            }
121
22
            size = x.size;
122
22
        }
123
22
        return *this;
124
22
    }
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.93M
    const char* get_value() const { return data.get(); }
136
1.97M
    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
139M
    Field() : type(PrimitiveType::TYPE_NULL) {}
194
    // set Types::Null explictly and avoid other types
195
185M
    Field(PrimitiveType w) : type(w) {}
196
    template <PrimitiveType T>
197
45.9M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
45.9M
        auto f = Field(T);
199
45.9M
        f.template create_concrete<T>(data);
200
45.9M
        return f;
201
45.9M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
19.8M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
19.8M
        auto f = Field(T);
199
19.8M
        f.template create_concrete<T>(data);
200
19.8M
        return f;
201
19.8M
    }
_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.6M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
19.6M
        auto f = Field(T);
199
19.6M
        f.template create_concrete<T>(data);
200
19.6M
        return f;
201
19.6M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
139
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
139
        auto f = Field(T);
199
139
        f.template create_concrete<T>(data);
200
139
        return f;
201
139
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
124k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
124k
        auto f = Field(T);
199
124k
        f.template create_concrete<T>(data);
200
124k
        return f;
201
124k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
440k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
440k
        auto f = Field(T);
199
440k
        f.template create_concrete<T>(data);
200
440k
        return f;
201
440k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
52.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
52.4k
        auto f = Field(T);
199
52.4k
        f.template create_concrete<T>(data);
200
52.4k
        return f;
201
52.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
4.08M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
4.08M
        auto f = Field(T);
199
4.08M
        f.template create_concrete<T>(data);
200
4.08M
        return f;
201
4.08M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_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_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
41.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
41.6k
        auto f = Field(T);
199
41.6k
        f.template create_concrete<T>(data);
200
41.6k
        return f;
201
41.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
190k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
190k
        auto f = Field(T);
199
190k
        f.template create_concrete<T>(data);
200
190k
        return f;
201
190k
    }
_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
14.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
14.2k
        auto f = Field(T);
199
14.2k
        f.template create_concrete<T>(data);
200
14.2k
        return f;
201
14.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
585k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
585k
        auto f = Field(T);
199
585k
        f.template create_concrete<T>(data);
200
585k
        return f;
201
585k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
14.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
14.8k
        auto f = Field(T);
199
14.8k
        f.template create_concrete<T>(data);
200
14.8k
        return f;
201
14.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
107k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
107k
        auto f = Field(T);
199
107k
        f.template create_concrete<T>(data);
200
107k
        return f;
201
107k
    }
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
16.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
16.5k
        auto f = Field(T);
199
16.5k
        f.template create_concrete<T>(data);
200
16.5k
        return f;
201
16.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
107k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
107k
        auto f = Field(T);
199
107k
        f.template create_concrete<T>(data);
200
107k
        return f;
201
107k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
22.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
22.5k
        auto f = Field(T);
199
22.5k
        f.template create_concrete<T>(data);
200
22.5k
        return f;
201
22.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
28.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
28.3k
        auto f = Field(T);
199
28.3k
        f.template create_concrete<T>(data);
200
28.3k
        return f;
201
28.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
8.75k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
8.75k
        auto f = Field(T);
199
8.75k
        f.template create_concrete<T>(data);
200
8.75k
        return f;
201
8.75k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
29.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
29.4k
        auto f = Field(T);
199
29.4k
        f.template create_concrete<T>(data);
200
29.4k
        return f;
201
29.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
40.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
40.8k
        auto f = Field(T);
199
40.8k
        f.template create_concrete<T>(data);
200
40.8k
        return f;
201
40.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_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
352k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
352k
        auto f = Field(T);
199
352k
        f.template create_concrete<T>(data);
200
352k
        return f;
201
352k
    }
_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
106M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
106M
        auto f = Field(T);
205
106M
        f.template create_concrete<T>(std::move(data));
206
106M
        return f;
207
106M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
15.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
15.3M
        auto f = Field(T);
205
15.3M
        f.template create_concrete<T>(std::move(data));
206
15.3M
        return f;
207
15.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
90
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
90
        auto f = Field(T);
205
90
        f.template create_concrete<T>(std::move(data));
206
90
        return f;
207
90
    }
_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
129k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
129k
        auto f = Field(T);
205
129k
        f.template create_concrete<T>(std::move(data));
206
129k
        return f;
207
129k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
56.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
56.0k
        auto f = Field(T);
205
56.0k
        f.template create_concrete<T>(std::move(data));
206
56.0k
        return f;
207
56.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
46.6k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
46.6k
        auto f = Field(T);
205
46.6k
        f.template create_concrete<T>(std::move(data));
206
46.6k
        return f;
207
46.6k
    }
_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.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
10.2k
        auto f = Field(T);
205
10.2k
        f.template create_concrete<T>(std::move(data));
206
10.2k
        return f;
207
10.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
11.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
11.0k
        auto f = Field(T);
205
11.0k
        f.template create_concrete<T>(std::move(data));
206
11.0k
        return f;
207
11.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
168k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
168k
        auto f = Field(T);
205
168k
        f.template create_concrete<T>(std::move(data));
206
168k
        return f;
207
168k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
57.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
57.7k
        auto f = Field(T);
205
57.7k
        f.template create_concrete<T>(std::move(data));
206
57.7k
        return f;
207
57.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.56M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.56M
        auto f = Field(T);
205
2.56M
        f.template create_concrete<T>(std::move(data));
206
2.56M
        return f;
207
2.56M
    }
_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.42M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.42M
        auto f = Field(T);
205
5.42M
        f.template create_concrete<T>(std::move(data));
206
5.42M
        return f;
207
5.42M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
101k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
101k
        auto f = Field(T);
205
101k
        f.template create_concrete<T>(std::move(data));
206
101k
        return f;
207
101k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.81M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.81M
        auto f = Field(T);
205
1.81M
        f.template create_concrete<T>(std::move(data));
206
1.81M
        return f;
207
1.81M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
29.2M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
29.2M
        auto f = Field(T);
205
29.2M
        f.template create_concrete<T>(std::move(data));
206
29.2M
        return f;
207
29.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
135k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
135k
        auto f = Field(T);
205
135k
        f.template create_concrete<T>(std::move(data));
206
135k
        return f;
207
135k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
54.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
54.7k
        auto f = Field(T);
205
54.7k
        f.template create_concrete<T>(std::move(data));
206
54.7k
        return f;
207
54.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.98M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.98M
        auto f = Field(T);
205
2.98M
        f.template create_concrete<T>(std::move(data));
206
2.98M
        return f;
207
2.98M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
9.53k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
9.53k
        auto f = Field(T);
205
9.53k
        f.template create_concrete<T>(std::move(data));
206
9.53k
        return f;
207
9.53k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
241k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
241k
        auto f = Field(T);
205
241k
        f.template create_concrete<T>(std::move(data));
206
241k
        return f;
207
241k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
11.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
11.5k
        auto f = Field(T);
205
11.5k
        f.template create_concrete<T>(std::move(data));
206
11.5k
        return f;
207
11.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_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_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.22k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.22k
        auto f = Field(T);
205
5.22k
        f.template create_concrete<T>(std::move(data));
206
5.22k
        return f;
207
5.22k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.82k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.82k
        auto f = Field(T);
205
2.82k
        f.template create_concrete<T>(std::move(data));
206
2.82k
        return f;
207
2.82k
    }
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
30.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
30.2k
        auto f = Field(T);
205
30.2k
        f.template create_concrete<T>(std::move(data));
206
30.2k
        return f;
207
30.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.42M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.42M
        auto f = Field(T);
205
2.42M
        f.template create_concrete<T>(std::move(data));
206
2.42M
        return f;
207
2.42M
    }
_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
21.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
21.0k
        auto f = Field(T);
205
21.0k
        f.template create_concrete<T>(std::move(data));
206
21.0k
        return f;
207
21.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.81k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.81k
        auto f = Field(T);
205
5.81k
        f.template create_concrete<T>(std::move(data));
206
5.81k
        return f;
207
5.81k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
697k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
697k
        auto f = Field(T);
205
697k
        f.template create_concrete<T>(std::move(data));
206
697k
        return f;
207
697k
    }
208
209
    template <PrimitiveType PType, typename ValType = std::conditional_t<
210
                                           doris::is_string_type(PType), StringRef,
211
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
212
9.71M
    static Field create_field_from_olap_value(const ValType& data) {
213
9.71M
        auto f = Field(PType);
214
9.71M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
9.71M
        if constexpr (is_string_type(PType)) {
216
5.62M
            auto min_size =
217
5.62M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
5.62M
            cpp_value = String(data.data, min_size);
219
5.62M
        } else if constexpr (is_date_or_datetime(PType)) {
220
1.07k
            if constexpr (PType == TYPE_DATE) {
221
391
                cpp_value.from_olap_date(data);
222
683
            } else {
223
683
                cpp_value.from_olap_datetime(data);
224
683
            }
225
1.07k
        } else if constexpr (is_decimalv2(PType)) {
226
150
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
4.08M
        } else {
228
4.08M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
4.08M
        }
230
9.71M
        f.template create_concrete<PType>(std::move(cpp_value));
231
9.71M
        return f;
232
9.71M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
212
95.9k
    static Field create_field_from_olap_value(const ValType& data) {
213
95.9k
        auto f = Field(PType);
214
95.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
95.9k
        } else {
228
95.9k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
95.9k
        }
230
95.9k
        f.template create_concrete<PType>(std::move(cpp_value));
231
95.9k
        return f;
232
95.9k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
212
23.8k
    static Field create_field_from_olap_value(const ValType& data) {
213
23.8k
        auto f = Field(PType);
214
23.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
23.8k
        } else {
228
23.8k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
23.8k
        }
230
23.8k
        f.template create_concrete<PType>(std::move(cpp_value));
231
23.8k
        return f;
232
23.8k
    }
_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.23M
    static Field create_field_from_olap_value(const ValType& data) {
213
1.23M
        auto f = Field(PType);
214
1.23M
        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.23M
        } else {
228
1.23M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.23M
        }
230
1.23M
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.23M
        return f;
232
1.23M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
212
102k
    static Field create_field_from_olap_value(const ValType& data) {
213
102k
        auto f = Field(PType);
214
102k
        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
102k
        } else {
228
102k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
102k
        }
230
102k
        f.template create_concrete<PType>(std::move(cpp_value));
231
102k
        return f;
232
102k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
212
14.6k
    static Field create_field_from_olap_value(const ValType& data) {
213
14.6k
        auto f = Field(PType);
214
14.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
14.6k
        } else {
228
14.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
14.6k
        }
230
14.6k
        f.template create_concrete<PType>(std::move(cpp_value));
231
14.6k
        return f;
232
14.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
212
32.1k
    static Field create_field_from_olap_value(const ValType& data) {
213
32.1k
        auto f = Field(PType);
214
32.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
32.1k
        } else {
228
32.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
32.1k
        }
230
32.1k
        f.template create_concrete<PType>(std::move(cpp_value));
231
32.1k
        return f;
232
32.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
62.7k
    static Field create_field_from_olap_value(const ValType& data) {
213
62.7k
        auto f = Field(PType);
214
62.7k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
62.7k
        if constexpr (is_string_type(PType)) {
216
62.7k
            auto min_size =
217
62.7k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
62.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
62.7k
        f.template create_concrete<PType>(std::move(cpp_value));
231
62.7k
        return f;
232
62.7k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
212
391
    static Field create_field_from_olap_value(const ValType& data) {
213
391
        auto f = Field(PType);
214
391
        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
391
        } else if constexpr (is_date_or_datetime(PType)) {
220
391
            if constexpr (PType == TYPE_DATE) {
221
391
                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
391
        f.template create_concrete<PType>(std::move(cpp_value));
231
391
        return f;
232
391
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
212
683
    static Field create_field_from_olap_value(const ValType& data) {
213
683
        auto f = Field(PType);
214
683
        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
683
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
683
            } else {
223
683
                cpp_value.from_olap_datetime(data);
224
683
            }
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
683
        f.template create_concrete<PType>(std::move(cpp_value));
231
683
        return f;
232
683
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
212
207k
    static Field create_field_from_olap_value(const ValType& data) {
213
207k
        auto f = Field(PType);
214
207k
        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
207k
        } else {
228
207k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
207k
        }
230
207k
        f.template create_concrete<PType>(std::move(cpp_value));
231
207k
        return f;
232
207k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
212
149k
    static Field create_field_from_olap_value(const ValType& data) {
213
149k
        auto f = Field(PType);
214
149k
        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
149k
        } else {
228
149k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
149k
        }
230
149k
        f.template create_concrete<PType>(std::move(cpp_value));
231
149k
        return f;
232
149k
    }
_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
56.3k
    static Field create_field_from_olap_value(const ValType& data) {
213
56.3k
        auto f = Field(PType);
214
56.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
56.3k
        } else {
228
56.3k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
56.3k
        }
230
56.3k
        f.template create_concrete<PType>(std::move(cpp_value));
231
56.3k
        return f;
232
56.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
386k
    static Field create_field_from_olap_value(const ValType& data) {
213
386k
        auto f = Field(PType);
214
386k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
386k
        if constexpr (is_string_type(PType)) {
216
386k
            auto min_size =
217
386k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
386k
            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
386k
        f.template create_concrete<PType>(std::move(cpp_value));
231
386k
        return f;
232
386k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
5.17M
    static Field create_field_from_olap_value(const ValType& data) {
213
5.17M
        auto f = Field(PType);
214
5.17M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
5.17M
        if constexpr (is_string_type(PType)) {
216
5.17M
            auto min_size =
217
5.17M
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
5.17M
            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
5.17M
        f.template create_concrete<PType>(std::move(cpp_value));
231
5.17M
        return f;
232
5.17M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
212
7.19k
    static Field create_field_from_olap_value(const ValType& data) {
213
7.19k
        auto f = Field(PType);
214
7.19k
        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.19k
        } else {
228
7.19k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
7.19k
        }
230
7.19k
        f.template create_concrete<PType>(std::move(cpp_value));
231
7.19k
        return f;
232
7.19k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
212
59.1k
    static Field create_field_from_olap_value(const ValType& data) {
213
59.1k
        auto f = Field(PType);
214
59.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
59.1k
        } else {
228
59.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
59.1k
        }
230
59.1k
        f.template create_concrete<PType>(std::move(cpp_value));
231
59.1k
        return f;
232
59.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
212
36.5k
    static Field create_field_from_olap_value(const ValType& data) {
213
36.5k
        auto f = Field(PType);
214
36.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
36.5k
        } else {
228
36.5k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
36.5k
        }
230
36.5k
        f.template create_concrete<PType>(std::move(cpp_value));
231
36.5k
        return f;
232
36.5k
    }
_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
150
    static Field create_field_from_olap_value(const ValType& data) {
213
150
        auto f = Field(PType);
214
150
        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
150
        } else if constexpr (is_decimalv2(PType)) {
226
150
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
150
        f.template create_concrete<PType>(std::move(cpp_value));
231
150
        return f;
232
150
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
212
442k
    static Field create_field_from_olap_value(const ValType& data) {
213
442k
        auto f = Field(PType);
214
442k
        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
442k
        } else {
228
442k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
442k
        }
230
442k
        f.template create_concrete<PType>(std::move(cpp_value));
231
442k
        return f;
232
442k
    }
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.5M
    bool is_complex_field() const {
244
22.5M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
245
22.5M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
246
22.5M
    }
247
248
106M
    Field& operator=(Field&& rhs) {
249
106M
        if (this != &rhs) {
250
106M
            if (type != rhs.type) {
251
74.2M
                destroy();
252
74.2M
                create(std::move(rhs));
253
74.2M
            } else {
254
31.8M
                assign(std::move(rhs));
255
31.8M
            }
256
106M
        }
257
106M
        return *this;
258
106M
    }
259
260
596M
    ~Field() { destroy(); }
261
262
140M
    PrimitiveType get_type() const { return type; }
263
    std::string get_type_name() const;
264
265
197M
    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
24.2M
    bool operator==(const Field& rhs) const {
277
24.2M
        return operator<=>(rhs) == std::strong_ordering::equal;
278
24.2M
    }
279
280
    std::strong_ordering operator<=>(const Field& rhs) const;
281
282
    std::string_view as_string_view() const;
283
284
    // Return a human-readable representation of the stored value for debugging.
285
    // Unlike get_type_name() which returns the type, this prints the actual value.
286
    // For decimal types, caller can provide scale for accurate formatting.
287
    std::string to_debug_string(int scale) const;
288
289
private:
290
    std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
291
                         Int128, IPv6, Float64, String, JsonbField, StringView, Array, Tuple, Map,
292
                         VariantMap, Decimal32, Decimal64, DecimalV2Value, Decimal128V3, Decimal256,
293
                         BitmapValue, HyperLogLog, QuantileState>
294
            storage;
295
296
    PrimitiveType type;
297
298
    /// Assuming there was no allocated state or it was deallocated (see destroy).
299
    template <PrimitiveType Type>
300
    void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
301
    template <PrimitiveType Type>
302
    void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
303
    /// Assuming same types.
304
    template <PrimitiveType Type>
305
    void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
306
    template <PrimitiveType Type>
307
    void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
308
309
    void create(const Field& field);
310
    void create(Field&& field);
311
312
    void assign(const Field& x);
313
    void assign(Field&& x);
314
315
    void destroy();
316
317
    template <PrimitiveType T>
318
    void destroy();
319
};
320
321
struct FieldWithDataType {
322
    Field field;
323
    // used for nested type of array
324
    PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE;
325
    uint8_t num_dimensions = 0;
326
    int precision = -1;
327
    int scale = -1;
328
};
329
330
} // namespace doris
331
332
template <>
333
struct std::hash<doris::Field> {
334
1.47k
    size_t operator()(const doris::Field& field) const {
335
1.47k
        if (field.is_null()) {
336
158
            return 0;
337
158
        }
338
1.31k
        std::hash<std::string_view> hasher;
339
1.31k
        return hasher(field.as_string_view());
340
1.47k
    }
341
};