Coverage Report

Created: 2026-04-18 03:38

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
192k
    JsonbField() = default;
87
7.25M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
88
89
1.60M
    JsonbField(const char* ptr, size_t len) : size(len) {
90
1.60M
        data = std::make_unique<char[]>(size);
91
1.60M
        if (!data) {
92
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
93
0
        }
94
1.60M
        if (size > 0) {
95
1.60M
            memcpy(data.get(), ptr, size);
96
1.60M
        }
97
1.60M
    }
98
99
1.68M
    JsonbField(const JsonbField& x) : size(x.size) {
100
1.68M
        data = std::make_unique<char[]>(size);
101
1.68M
        if (!data) {
102
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
103
0
        }
104
1.68M
        if (size > 0) {
105
1.68M
            memcpy(data.get(), x.data.get(), size);
106
1.68M
        }
107
1.68M
    }
108
109
3.78M
    JsonbField(JsonbField&& x) noexcept : data(std::move(x.data)), size(x.size) { x.size = 0; }
110
111
    // dispatch for all type of storage. so need this. but not really used now.
112
2
    JsonbField& operator=(const JsonbField& x) {
113
2
        if (this != &x) {
114
2
            data = std::make_unique<char[]>(x.size);
115
2
            if (!data) {
116
0
                throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size));
117
0
            }
118
2
            if (x.size > 0) {
119
1
                memcpy(data.get(), x.data.get(), x.size);
120
1
            }
121
2
            size = x.size;
122
2
        }
123
2
        return *this;
124
2
    }
125
126
191k
    JsonbField& operator=(JsonbField&& x) noexcept {
127
191k
        if (this != &x) {
128
191k
            data = std::move(x.data);
129
191k
            size = x.size;
130
191k
            x.size = 0;
131
191k
        }
132
191k
        return *this;
133
191k
    }
134
135
1.20M
    const char* get_value() const { return data.get(); }
136
1.20M
    size_t get_size() const { return size; }
137
138
0
    bool operator<(const JsonbField& r) const {
139
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
140
0
    }
141
0
    bool operator<=(const JsonbField& r) const {
142
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
143
0
    }
144
0
    bool operator==(const JsonbField& r) const {
145
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
146
0
    }
147
0
    bool operator>(const JsonbField& r) const {
148
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
149
0
    }
150
0
    bool operator>=(const JsonbField& r) const {
151
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
152
0
    }
153
0
    bool operator!=(const JsonbField& r) const {
154
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
155
0
    }
156
157
0
    const JsonbField& operator+=(const JsonbField& r) {
158
0
        throw Exception(Status::FatalError("Not support plus opration on JsonbField"));
159
0
    }
160
161
0
    const JsonbField& operator-=(const JsonbField& r) {
162
0
        throw Exception(Status::FatalError("Not support minus opration on JsonbField"));
163
0
    }
164
165
private:
166
    std::unique_ptr<char[]> data = nullptr;
167
    size_t size = 0;
168
};
169
170
template <typename T>
171
bool decimal_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
172
template <typename T>
173
bool decimal_less(T x, T y, UInt32 x_scale, UInt32 y_scale);
174
template <typename T>
175
bool decimal_less_or_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
176
177
/** 32 is enough. Round number is used for alignment and for better arithmetic inside std::vector.
178
  * NOTE: Actually, sizeof(std::string) is 32 when using libc++, so Field is 40 bytes.
179
  */
180
constexpr size_t DBMS_MIN_FIELD_SIZE = 32;
181
182
/** Discriminated union of several types.
183
  * Made for replacement of `boost::variant`
184
  *  is not generalized,
185
  *  but somewhat more efficient, and simpler.
186
  *
187
  * Used to represent a single value of one of several types in memory.
188
  * Warning! Prefer to use chunks of columns instead of single values. See Column.h
189
  */
190
class Field {
191
public:
192
    static const int MIN_NON_POD = 16;
193
49.8M
    Field() : type(PrimitiveType::TYPE_NULL) {}
194
    // set Types::Null explictly and avoid other types
195
92.1M
    Field(PrimitiveType w) : type(w) {}
196
    template <PrimitiveType T>
197
20.5M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
20.5M
        auto f = Field(T);
199
20.5M
        f.template create_concrete<T>(data);
200
20.5M
        return f;
201
20.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
518k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
518k
        auto f = Field(T);
199
518k
        f.template create_concrete<T>(data);
200
518k
        return f;
201
518k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
23.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
23.4k
        auto f = Field(T);
199
23.4k
        f.template create_concrete<T>(data);
200
23.4k
        return f;
201
23.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.0M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
19.0M
        auto f = Field(T);
199
19.0M
        f.template create_concrete<T>(data);
200
19.0M
        return f;
201
19.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
12
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
12
        auto f = Field(T);
199
12
        f.template create_concrete<T>(data);
200
12
        return f;
201
12
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
8.33k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
8.33k
        auto f = Field(T);
199
8.33k
        f.template create_concrete<T>(data);
200
8.33k
        return f;
201
8.33k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
90.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
90.9k
        auto f = Field(T);
199
90.9k
        f.template create_concrete<T>(data);
200
90.9k
        return f;
201
90.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
45.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
45.2k
        auto f = Field(T);
199
45.2k
        f.template create_concrete<T>(data);
200
45.2k
        return f;
201
45.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
63.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
63.3k
        auto f = Field(T);
199
63.3k
        f.template create_concrete<T>(data);
200
63.3k
        return f;
201
63.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
21.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
21.3k
        auto f = Field(T);
199
21.3k
        f.template create_concrete<T>(data);
200
21.3k
        return f;
201
21.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
29.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
29.3k
        auto f = Field(T);
199
29.3k
        f.template create_concrete<T>(data);
200
29.3k
        return f;
201
29.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
32.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
32.8k
        auto f = Field(T);
199
32.8k
        f.template create_concrete<T>(data);
200
32.8k
        return f;
201
32.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
34.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
34.9k
        auto f = Field(T);
199
34.9k
        f.template create_concrete<T>(data);
200
34.9k
        return f;
201
34.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
9.31k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
9.31k
        auto f = Field(T);
199
9.31k
        f.template create_concrete<T>(data);
200
9.31k
        return f;
201
9.31k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
28.4k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
28.4k
        auto f = Field(T);
199
28.4k
        f.template create_concrete<T>(data);
200
28.4k
        return f;
201
28.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_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_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
60.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
60.2k
        auto f = Field(T);
199
60.2k
        f.template create_concrete<T>(data);
200
60.2k
        return f;
201
60.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
10
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
10
        auto f = Field(T);
199
10
        f.template create_concrete<T>(data);
200
10
        return f;
201
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
87
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
87
        auto f = Field(T);
199
87
        f.template create_concrete<T>(data);
200
87
        return f;
201
87
    }
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
59.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
59.1k
        auto f = Field(T);
199
59.1k
        f.template create_concrete<T>(data);
200
59.1k
        return f;
201
59.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
12.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
12.6k
        auto f = Field(T);
199
12.6k
        f.template create_concrete<T>(data);
200
12.6k
        return f;
201
12.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
39.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
39.0k
        auto f = Field(T);
199
39.0k
        f.template create_concrete<T>(data);
200
39.0k
        return f;
201
39.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
8.55k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
8.55k
        auto f = Field(T);
199
8.55k
        f.template create_concrete<T>(data);
200
8.55k
        return f;
201
8.55k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
27.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
27.3k
        auto f = Field(T);
199
27.3k
        f.template create_concrete<T>(data);
200
27.3k
        return f;
201
27.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_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_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
821
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
821
        auto f = Field(T);
199
821
        f.template create_concrete<T>(data);
200
821
        return f;
201
821
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
27
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
27
        auto f = Field(T);
199
27
        f.template create_concrete<T>(data);
200
27
        return f;
201
27
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
197
292k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
198
292k
        auto f = Field(T);
199
292k
        f.template create_concrete<T>(data);
200
292k
        return f;
201
292k
    }
_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
64.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
64.5M
        auto f = Field(T);
205
64.5M
        f.template create_concrete<T>(std::move(data));
206
64.5M
        return f;
207
64.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.51M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.51M
        auto f = Field(T);
205
2.51M
        f.template create_concrete<T>(std::move(data));
206
2.51M
        return f;
207
2.51M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_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_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
79.8k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
79.8k
        auto f = Field(T);
205
79.8k
        f.template create_concrete<T>(std::move(data));
206
79.8k
        return f;
207
79.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.51k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.51k
        auto f = Field(T);
205
1.51k
        f.template create_concrete<T>(std::move(data));
206
1.51k
        return f;
207
1.51k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.89k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.89k
        auto f = Field(T);
205
5.89k
        f.template create_concrete<T>(std::move(data));
206
5.89k
        return f;
207
5.89k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
13.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
13.5M
        auto f = Field(T);
205
13.5M
        f.template create_concrete<T>(std::move(data));
206
13.5M
        return f;
207
13.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
9.56k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
9.56k
        auto f = Field(T);
205
9.56k
        f.template create_concrete<T>(std::move(data));
206
9.56k
        return f;
207
9.56k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
811
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
811
        auto f = Field(T);
205
811
        f.template create_concrete<T>(std::move(data));
206
811
        return f;
207
811
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.00k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.00k
        auto f = Field(T);
205
5.00k
        f.template create_concrete<T>(std::move(data));
206
5.00k
        return f;
207
5.00k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
28.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
28.2k
        auto f = Field(T);
205
28.2k
        f.template create_concrete<T>(std::move(data));
206
28.2k
        return f;
207
28.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.79M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.79M
        auto f = Field(T);
205
1.79M
        f.template create_concrete<T>(std::move(data));
206
1.79M
        return f;
207
1.79M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
28.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
28.3M
        auto f = Field(T);
205
28.3M
        f.template create_concrete<T>(std::move(data));
206
28.3M
        return f;
207
28.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.03M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.03M
        auto f = Field(T);
205
2.03M
        f.template create_concrete<T>(std::move(data));
206
2.03M
        return f;
207
2.03M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
3.88k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
3.88k
        auto f = Field(T);
205
3.88k
        f.template create_concrete<T>(std::move(data));
206
3.88k
        return f;
207
3.88k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
903k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
903k
        auto f = Field(T);
205
903k
        f.template create_concrete<T>(std::move(data));
206
903k
        return f;
207
903k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
14.9M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
14.9M
        auto f = Field(T);
205
14.9M
        f.template create_concrete<T>(std::move(data));
206
14.9M
        return f;
207
14.9M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
1.96k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
1.96k
        auto f = Field(T);
205
1.96k
        f.template create_concrete<T>(std::move(data));
206
1.96k
        return f;
207
1.96k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
4.65k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
4.65k
        auto f = Field(T);
205
4.65k
        f.template create_concrete<T>(std::move(data));
206
4.65k
        return f;
207
4.65k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
120k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
120k
        auto f = Field(T);
205
120k
        f.template create_concrete<T>(std::move(data));
206
120k
        return f;
207
120k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
40
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
40
        auto f = Field(T);
205
40
        f.template create_concrete<T>(std::move(data));
206
40
        return f;
207
40
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5.31k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5.31k
        auto f = Field(T);
205
5.31k
        f.template create_concrete<T>(std::move(data));
206
5.31k
        return f;
207
5.31k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
69
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
69
        auto f = Field(T);
205
69
        f.template create_concrete<T>(std::move(data));
206
69
        return f;
207
69
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
21.3k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
21.3k
        auto f = Field(T);
205
21.3k
        f.template create_concrete<T>(std::move(data));
206
21.3k
        return f;
207
21.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
82
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
82
        auto f = Field(T);
205
82
        f.template create_concrete<T>(std::move(data));
206
82
        return f;
207
82
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
7
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
7
        auto f = Field(T);
205
7
        f.template create_concrete<T>(std::move(data));
206
7
        return f;
207
7
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
5
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
5
        auto f = Field(T);
205
5
        f.template create_concrete<T>(std::move(data));
206
5
        return f;
207
5
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
20
    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_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
102k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
102k
        auto f = Field(T);
205
102k
        f.template create_concrete<T>(std::move(data));
206
102k
        return f;
207
102k
    }
_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
39
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
39
        auto f = Field(T);
205
39
        f.template create_concrete<T>(std::move(data));
206
39
        return f;
207
39
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
2.87k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
2.87k
        auto f = Field(T);
205
2.87k
        f.template create_concrete<T>(std::move(data));
206
2.87k
        return f;
207
2.87k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
3.57k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
3.57k
        auto f = Field(T);
205
3.57k
        f.template create_concrete<T>(std::move(data));
206
3.57k
        return f;
207
3.57k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
203
171k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
204
171k
        auto f = Field(T);
205
171k
        f.template create_concrete<T>(std::move(data));
206
171k
        return f;
207
171k
    }
208
209
    template <PrimitiveType PType, typename ValType = std::conditional_t<
210
                                           doris::is_string_type(PType), StringRef,
211
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
212
1.50M
    static Field create_field_from_olap_value(const ValType& data) {
213
1.50M
        auto f = Field(PType);
214
1.50M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
1.50M
        if constexpr (is_string_type(PType)) {
216
84.9k
            auto min_size =
217
84.9k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
84.9k
            cpp_value = String(data.data, min_size);
219
84.9k
        } else if constexpr (is_date_or_datetime(PType)) {
220
46
            if constexpr (PType == TYPE_DATE) {
221
15
                cpp_value.from_olap_date(data);
222
31
            } else {
223
31
                cpp_value.from_olap_datetime(data);
224
31
            }
225
46
        } else if constexpr (is_decimalv2(PType)) {
226
26
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
1.42M
        } else {
228
1.42M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.42M
        }
230
1.50M
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.50M
        return f;
232
1.50M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
212
10.9k
    static Field create_field_from_olap_value(const ValType& data) {
213
10.9k
        auto f = Field(PType);
214
10.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
10.9k
        } else {
228
10.9k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
10.9k
        }
230
10.9k
        f.template create_concrete<PType>(std::move(cpp_value));
231
10.9k
        return f;
232
10.9k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
212
1.06k
    static Field create_field_from_olap_value(const ValType& data) {
213
1.06k
        auto f = Field(PType);
214
1.06k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
        if constexpr (is_string_type(PType)) {
216
            auto min_size =
217
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
            cpp_value = String(data.data, min_size);
219
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
            } else {
223
                cpp_value.from_olap_datetime(data);
224
            }
225
        } else if constexpr (is_decimalv2(PType)) {
226
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
1.06k
        } else {
228
1.06k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.06k
        }
230
1.06k
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.06k
        return f;
232
1.06k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
212
1.33M
    static Field create_field_from_olap_value(const ValType& data) {
213
1.33M
        auto f = Field(PType);
214
1.33M
        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.33M
        } else {
228
1.33M
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.33M
        }
230
1.33M
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.33M
        return f;
232
1.33M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
212
61.9k
    static Field create_field_from_olap_value(const ValType& data) {
213
61.9k
        auto f = Field(PType);
214
61.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
61.9k
        } else {
228
61.9k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
61.9k
        }
230
61.9k
        f.template create_concrete<PType>(std::move(cpp_value));
231
61.9k
        return f;
232
61.9k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
212
426
    static Field create_field_from_olap_value(const ValType& data) {
213
426
        auto f = Field(PType);
214
426
        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
426
        } else {
228
426
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
426
        }
230
426
        f.template create_concrete<PType>(std::move(cpp_value));
231
426
        return f;
232
426
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
212
734
    static Field create_field_from_olap_value(const ValType& data) {
213
734
        auto f = Field(PType);
214
734
        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
734
        } else {
228
734
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
734
        }
230
734
        f.template create_concrete<PType>(std::move(cpp_value));
231
734
        return f;
232
734
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
212
830
    static Field create_field_from_olap_value(const ValType& data) {
213
830
        auto f = Field(PType);
214
830
        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
830
        } else {
228
830
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
830
        }
230
830
        f.template create_concrete<PType>(std::move(cpp_value));
231
830
        return f;
232
830
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
609
    static Field create_field_from_olap_value(const ValType& data) {
213
609
        auto f = Field(PType);
214
609
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
609
        if constexpr (is_string_type(PType)) {
216
609
            auto min_size =
217
609
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
609
            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
609
        f.template create_concrete<PType>(std::move(cpp_value));
231
609
        return f;
232
609
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
212
15
    static Field create_field_from_olap_value(const ValType& data) {
213
15
        auto f = Field(PType);
214
15
        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
15
        } else if constexpr (is_date_or_datetime(PType)) {
220
15
            if constexpr (PType == TYPE_DATE) {
221
15
                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
15
        f.template create_concrete<PType>(std::move(cpp_value));
231
15
        return f;
232
15
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
212
31
    static Field create_field_from_olap_value(const ValType& data) {
213
31
        auto f = Field(PType);
214
31
        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
31
        } else if constexpr (is_date_or_datetime(PType)) {
220
            if constexpr (PType == TYPE_DATE) {
221
                cpp_value.from_olap_date(data);
222
31
            } else {
223
31
                cpp_value.from_olap_datetime(data);
224
31
            }
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
31
        f.template create_concrete<PType>(std::move(cpp_value));
231
31
        return f;
232
31
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
212
1.30k
    static Field create_field_from_olap_value(const ValType& data) {
213
1.30k
        auto f = Field(PType);
214
1.30k
        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.30k
        } else {
228
1.30k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
1.30k
        }
230
1.30k
        f.template create_concrete<PType>(std::move(cpp_value));
231
1.30k
        return f;
232
1.30k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
212
6.11k
    static Field create_field_from_olap_value(const ValType& data) {
213
6.11k
        auto f = Field(PType);
214
6.11k
        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.11k
        } else {
228
6.11k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
6.11k
        }
230
6.11k
        f.template create_concrete<PType>(std::move(cpp_value));
231
6.11k
        return f;
232
6.11k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
212
67
    static Field create_field_from_olap_value(const ValType& data) {
213
67
        auto f = Field(PType);
214
67
        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
        } else {
228
67
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
67
        }
230
67
        f.template create_concrete<PType>(std::move(cpp_value));
231
67
        return f;
232
67
    }
Unexecuted instantiation: _ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Unexecuted instantiation: _ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
41.3k
    static Field create_field_from_olap_value(const ValType& data) {
213
41.3k
        auto f = Field(PType);
214
41.3k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
41.3k
        if constexpr (is_string_type(PType)) {
216
41.3k
            auto min_size =
217
41.3k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
41.3k
            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
41.3k
        f.template create_concrete<PType>(std::move(cpp_value));
231
41.3k
        return f;
232
41.3k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
212
43.0k
    static Field create_field_from_olap_value(const ValType& data) {
213
43.0k
        auto f = Field(PType);
214
43.0k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
215
43.0k
        if constexpr (is_string_type(PType)) {
216
43.0k
            auto min_size =
217
43.0k
                    MAX_ZONE_MAP_INDEX_SIZE >= data.size ? data.size : MAX_ZONE_MAP_INDEX_SIZE;
218
43.0k
            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
43.0k
        f.template create_concrete<PType>(std::move(cpp_value));
231
43.0k
        return f;
232
43.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
212
397
    static Field create_field_from_olap_value(const ValType& data) {
213
397
        auto f = Field(PType);
214
397
        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
397
        } else {
228
397
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
397
        }
230
397
        f.template create_concrete<PType>(std::move(cpp_value));
231
397
        return f;
232
397
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
212
791
    static Field create_field_from_olap_value(const ValType& data) {
213
791
        auto f = Field(PType);
214
791
        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
791
        } else {
228
791
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
791
        }
230
791
        f.template create_concrete<PType>(std::move(cpp_value));
231
791
        return f;
232
791
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
212
590
    static Field create_field_from_olap_value(const ValType& data) {
213
590
        auto f = Field(PType);
214
590
        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
590
        } else {
228
590
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
590
        }
230
590
        f.template create_concrete<PType>(std::move(cpp_value));
231
590
        return f;
232
590
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
212
4
    static Field create_field_from_olap_value(const ValType& data) {
213
4
        auto f = Field(PType);
214
4
        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
4
        } else {
228
4
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
4
        }
230
4
        f.template create_concrete<PType>(std::move(cpp_value));
231
4
        return f;
232
4
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
212
26
    static Field create_field_from_olap_value(const ValType& data) {
213
26
        auto f = Field(PType);
214
26
        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
26
        } else if constexpr (is_decimalv2(PType)) {
226
26
            cpp_value = DecimalV2Value(data.integer, data.fraction);
227
        } else {
228
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
        }
230
26
        f.template create_concrete<PType>(std::move(cpp_value));
231
26
        return f;
232
26
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
212
640
    static Field create_field_from_olap_value(const ValType& data) {
213
640
        auto f = Field(PType);
214
640
        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
640
        } else {
228
640
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
229
640
        }
230
640
        f.template create_concrete<PType>(std::move(cpp_value));
231
640
        return f;
232
640
    }
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
1.51M
    bool is_complex_field() const {
244
1.51M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
245
1.51M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
246
1.51M
    }
247
248
36.6M
    Field& operator=(Field&& rhs) {
249
36.6M
        if (this != &rhs) {
250
36.6M
            if (type != rhs.type) {
251
23.3M
                destroy();
252
23.3M
                create(std::move(rhs));
253
23.3M
            } else {
254
13.2M
                assign(std::move(rhs));
255
13.2M
            }
256
36.6M
        }
257
36.6M
        return *this;
258
36.6M
    }
259
260
354M
    ~Field() { destroy(); }
261
262
49.9M
    PrimitiveType get_type() const { return type; }
263
    std::string get_type_name() const;
264
265
109M
    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
5.46M
    bool operator==(const Field& rhs) const {
277
5.46M
        return operator<=>(rhs) == std::strong_ordering::equal;
278
5.46M
    }
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
0
    size_t operator()(const doris::Field& field) const {
335
0
        if (field.is_null()) {
336
0
            return 0;
337
0
        }
338
0
        std::hash<std::string_view> hasher;
339
0
        return hasher(field.as_string_view());
340
0
    }
341
};