Coverage Report

Created: 2026-08-18 09:31

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 <cmath>
29
#include <cstring>
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 "core/value/variant/variant_field.h"
46
47
namespace doris {
48
template <PrimitiveType type>
49
struct PrimitiveTypeTraits;
50
template <typename T>
51
struct TypeName;
52
struct PackedInt128;
53
} // namespace doris
54
55
namespace doris {
56
57
class Field;
58
59
using FieldVector = std::vector<Field>;
60
61
/// Array and Struct use the same storage type -- FieldVector, but we declare
62
/// distinct types for them, so that the caller can choose whether it wants to
63
/// construct a Field of Array or a Struct type. An alternative approach would be
64
/// to construct both of these types from FieldVector, and have the caller
65
/// specify the desired Field type explicitly.
66
struct Array : public FieldVector {
67
    using FieldVector::FieldVector;
68
};
69
70
struct Struct : public FieldVector {
71
    using FieldVector::FieldVector;
72
};
73
74
struct Map : public FieldVector {
75
    using FieldVector::FieldVector;
76
};
77
78
//TODO: rethink if we really need this? it only save one pointer from std::string
79
// not POD type so could only use read/write_json_binary instead of read/write_binary
80
class JsonbField {
81
public:
82
192k
    JsonbField() = default;
83
7.25M
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
84
85
1.60M
    JsonbField(const char* ptr, size_t len) : size(len) {
86
1.60M
        data = std::make_unique<char[]>(size);
87
1.60M
        if (!data) {
88
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
89
0
        }
90
1.60M
        if (size > 0) {
91
1.60M
            memcpy(data.get(), ptr, size);
92
1.60M
        }
93
1.60M
    }
94
95
1.67M
    JsonbField(const JsonbField& x) : size(x.size) {
96
1.67M
        data = std::make_unique<char[]>(size);
97
1.67M
        if (!data) {
98
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
99
0
        }
100
1.67M
        if (size > 0) {
101
1.67M
            memcpy(data.get(), x.data.get(), size);
102
1.67M
        }
103
1.67M
    }
104
105
3.77M
    JsonbField(JsonbField&& x) noexcept : data(std::move(x.data)), size(x.size) { x.size = 0; }
106
107
    // dispatch for all type of storage. so need this. but not really used now.
108
2
    JsonbField& operator=(const JsonbField& x) {
109
2
        if (this != &x) {
110
2
            data = std::make_unique<char[]>(x.size);
111
2
            if (!data) {
112
0
                throw Exception(Status::FatalError("new data buffer failed, size: {}", x.size));
113
0
            }
114
2
            if (x.size > 0) {
115
1
                memcpy(data.get(), x.data.get(), x.size);
116
1
            }
117
2
            size = x.size;
118
2
        }
119
2
        return *this;
120
2
    }
121
122
191k
    JsonbField& operator=(JsonbField&& x) noexcept {
123
191k
        if (this != &x) {
124
191k
            data = std::move(x.data);
125
191k
            size = x.size;
126
191k
            x.size = 0;
127
191k
        }
128
191k
        return *this;
129
191k
    }
130
131
1.20M
    const char* get_value() const { return data.get(); }
132
1.20M
    size_t get_size() const { return size; }
133
134
0
    bool operator<(const JsonbField& r) const {
135
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
136
0
    }
137
0
    bool operator<=(const JsonbField& r) const {
138
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
139
0
    }
140
0
    bool operator==(const JsonbField& r) const {
141
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
142
0
    }
143
0
    bool operator>(const JsonbField& r) const {
144
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
145
0
    }
146
0
    bool operator>=(const JsonbField& r) const {
147
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
148
0
    }
149
0
    bool operator!=(const JsonbField& r) const {
150
0
        throw Exception(Status::FatalError("comparing between JsonbField is not supported"));
151
0
    }
152
153
0
    const JsonbField& operator+=(const JsonbField& r) {
154
0
        throw Exception(Status::FatalError("Not support plus opration on JsonbField"));
155
0
    }
156
157
0
    const JsonbField& operator-=(const JsonbField& r) {
158
0
        throw Exception(Status::FatalError("Not support minus opration on JsonbField"));
159
0
    }
160
161
private:
162
    std::unique_ptr<char[]> data = nullptr;
163
    size_t size = 0;
164
};
165
166
template <typename T>
167
bool decimal_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
168
template <typename T>
169
bool decimal_less(T x, T y, UInt32 x_scale, UInt32 y_scale);
170
template <typename T>
171
bool decimal_less_or_equal(T x, T y, UInt32 x_scale, UInt32 y_scale);
172
173
/** 32 is enough. Round number is used for alignment and for better arithmetic inside std::vector.
174
  * NOTE: Actually, sizeof(std::string) is 32 when using libc++, so Field is 40 bytes.
175
  */
176
constexpr size_t DBMS_MIN_FIELD_SIZE = 32;
177
178
/** Discriminated union of several types.
179
  * Made for replacement of `boost::variant`
180
  *  is not generalized,
181
  *  but somewhat more efficient, and simpler.
182
  *
183
  * Used to represent a single value of one of several types in memory.
184
  * Warning! Prefer to use chunks of columns instead of single values. See Column.h
185
  */
186
class Field {
187
public:
188
    static const int MIN_NON_POD = 16;
189
48.2M
    Field() : type(PrimitiveType::TYPE_NULL) {}
190
    // set Types::Null explictly and avoid other types
191
86.6M
    Field(PrimitiveType w) : type(w) {}
192
    template <PrimitiveType T>
193
24.0M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.0M
        auto f = Field(T);
195
24.0M
        f.template create_concrete<T>(data);
196
24.0M
        return f;
197
24.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
338k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
338k
        auto f = Field(T);
195
338k
        f.template create_concrete<T>(data);
196
338k
        return f;
197
338k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
21.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
21.8k
        auto f = Field(T);
195
21.8k
        f.template create_concrete<T>(data);
196
21.8k
        return f;
197
21.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
14
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
14
        auto f = Field(T);
195
14
        f.template create_concrete<T>(data);
196
14
        return f;
197
14
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
23.1M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
23.1M
        auto f = Field(T);
195
23.1M
        f.template create_concrete<T>(data);
196
23.1M
        return f;
197
23.1M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
44.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
44.6k
        auto f = Field(T);
195
44.6k
        f.template create_concrete<T>(data);
196
44.6k
        return f;
197
44.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
9.75k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
9.75k
        auto f = Field(T);
195
9.75k
        f.template create_concrete<T>(data);
196
9.75k
        return f;
197
9.75k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
19.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
19.5k
        auto f = Field(T);
195
19.5k
        f.template create_concrete<T>(data);
196
19.5k
        return f;
197
19.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.65k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
8.65k
        auto f = Field(T);
195
8.65k
        f.template create_concrete<T>(data);
196
8.65k
        return f;
197
8.65k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
22.1k
        auto f = Field(T);
195
22.1k
        f.template create_concrete<T>(data);
196
22.1k
        return f;
197
22.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
34.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
34.9k
        auto f = Field(T);
195
34.9k
        f.template create_concrete<T>(data);
196
34.9k
        return f;
197
34.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
404
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
404
        auto f = Field(T);
195
404
        f.template create_concrete<T>(data);
196
404
        return f;
197
404
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
22.3k
        auto f = Field(T);
195
22.3k
        f.template create_concrete<T>(data);
196
22.3k
        return f;
197
22.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
17
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
17
        auto f = Field(T);
195
17
        f.template create_concrete<T>(data);
196
17
        return f;
197
17
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
152
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
152
        auto f = Field(T);
195
152
        f.template create_concrete<T>(data);
196
152
        return f;
197
152
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.42k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
2.42k
        auto f = Field(T);
195
2.42k
        f.template create_concrete<T>(data);
196
2.42k
        return f;
197
2.42k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
26.7k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
26.7k
        auto f = Field(T);
195
26.7k
        f.template create_concrete<T>(data);
196
26.7k
        return f;
197
26.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.5k
        auto f = Field(T);
195
24.5k
        f.template create_concrete<T>(data);
196
24.5k
        return f;
197
24.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
48.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
48.0k
        auto f = Field(T);
195
48.0k
        f.template create_concrete<T>(data);
196
48.0k
        return f;
197
48.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
27.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
27.1k
        auto f = Field(T);
195
27.1k
        f.template create_concrete<T>(data);
196
27.1k
        return f;
197
27.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
24.6k
        auto f = Field(T);
195
24.6k
        f.template create_concrete<T>(data);
196
24.6k
        return f;
197
24.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
18.2k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
18.2k
        auto f = Field(T);
195
18.2k
        f.template create_concrete<T>(data);
196
18.2k
        return f;
197
18.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
13.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
13.5k
        auto f = Field(T);
195
13.5k
        f.template create_concrete<T>(data);
196
13.5k
        return f;
197
13.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
50.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
50.9k
        auto f = Field(T);
195
50.9k
        f.template create_concrete<T>(data);
196
50.9k
        return f;
197
50.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
32.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
32.6k
        auto f = Field(T);
195
32.6k
        f.template create_concrete<T>(data);
196
32.6k
        return f;
197
32.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.87k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
2.87k
        auto f = Field(T);
195
2.87k
        f.template create_concrete<T>(data);
196
2.87k
        return f;
197
2.87k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
18.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
18.0k
        auto f = Field(T);
195
18.0k
        f.template create_concrete<T>(data);
196
18.0k
        return f;
197
18.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
6.52k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
6.52k
        auto f = Field(T);
195
6.52k
        f.template create_concrete<T>(data);
196
6.52k
        return f;
197
6.52k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
35.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
35.3k
        auto f = Field(T);
195
35.3k
        f.template create_concrete<T>(data);
196
35.3k
        return f;
197
35.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
4
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
4
        auto f = Field(T);
195
4
        f.template create_concrete<T>(data);
196
4
        return f;
197
4
    }
198
    template <PrimitiveType T>
199
62.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
62.3M
        auto f = Field(T);
201
62.3M
        f.template create_concrete<T>(std::move(data));
202
62.3M
        return f;
203
62.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.41M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.41M
        auto f = Field(T);
201
2.41M
        f.template create_concrete<T>(std::move(data));
202
2.41M
        return f;
203
2.41M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
97.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
97.5k
        auto f = Field(T);
201
97.5k
        f.template create_concrete<T>(std::move(data));
202
97.5k
        return f;
203
97.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
23.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
23.5k
        auto f = Field(T);
201
23.5k
        f.template create_concrete<T>(std::move(data));
202
23.5k
        return f;
203
23.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.79k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.79k
        auto f = Field(T);
201
2.79k
        f.template create_concrete<T>(std::move(data));
202
2.79k
        return f;
203
2.79k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.32k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.32k
        auto f = Field(T);
201
1.32k
        f.template create_concrete<T>(std::move(data));
202
1.32k
        return f;
203
1.32k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
8.24k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
8.24k
        auto f = Field(T);
201
8.24k
        f.template create_concrete<T>(std::move(data));
202
8.24k
        return f;
203
8.24k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
923
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
923
        auto f = Field(T);
201
923
        f.template create_concrete<T>(std::move(data));
202
923
        return f;
203
923
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
901
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
901
        auto f = Field(T);
201
901
        f.template create_concrete<T>(std::move(data));
202
901
        return f;
203
901
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
13.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
13.5M
        auto f = Field(T);
201
13.5M
        f.template create_concrete<T>(std::move(data));
202
13.5M
        return f;
203
13.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10.4k
        auto f = Field(T);
201
10.4k
        f.template create_concrete<T>(std::move(data));
202
10.4k
        return f;
203
10.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
2.67k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
2.67k
        auto f = Field(T);
201
2.67k
        f.template create_concrete<T>(std::move(data));
202
2.67k
        return f;
203
2.67k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.42k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.42k
        auto f = Field(T);
201
1.42k
        f.template create_concrete<T>(std::move(data));
202
1.42k
        return f;
203
1.42k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
698
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
698
        auto f = Field(T);
201
698
        f.template create_concrete<T>(std::move(data));
202
698
        return f;
203
698
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.79M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.79M
        auto f = Field(T);
201
1.79M
        f.template create_concrete<T>(std::move(data));
202
1.79M
        return f;
203
1.79M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
30
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
30
        auto f = Field(T);
201
30
        f.template create_concrete<T>(std::move(data));
202
30
        return f;
203
30
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
28.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
28.3M
        auto f = Field(T);
201
28.3M
        f.template create_concrete<T>(std::move(data));
202
28.3M
        return f;
203
28.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
54.9k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
54.9k
        auto f = Field(T);
201
54.9k
        f.template create_concrete<T>(std::move(data));
202
54.9k
        return f;
203
54.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.01k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.01k
        auto f = Field(T);
201
1.01k
        f.template create_concrete<T>(std::move(data));
202
1.01k
        return f;
203
1.01k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
872k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
872k
        auto f = Field(T);
201
872k
        f.template create_concrete<T>(std::move(data));
202
872k
        return f;
203
872k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
15.0M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
15.0M
        auto f = Field(T);
201
15.0M
        f.template create_concrete<T>(std::move(data));
202
15.0M
        return f;
203
15.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
996
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
996
        auto f = Field(T);
201
996
        f.template create_concrete<T>(std::move(data));
202
996
        return f;
203
996
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
1.24k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
1.24k
        auto f = Field(T);
201
1.24k
        f.template create_concrete<T>(std::move(data));
202
1.24k
        return f;
203
1.24k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
117k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
117k
        auto f = Field(T);
201
117k
        f.template create_concrete<T>(std::move(data));
202
117k
        return f;
203
117k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
4
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
4
        auto f = Field(T);
201
4
        f.template create_concrete<T>(std::move(data));
202
4
        return f;
203
4
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
3.36k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
3.36k
        auto f = Field(T);
201
3.36k
        f.template create_concrete<T>(std::move(data));
202
3.36k
        return f;
203
3.36k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
86.2k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
86.2k
        auto f = Field(T);
201
86.2k
        f.template create_concrete<T>(std::move(data));
202
86.2k
        return f;
203
86.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
710
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
710
        auto f = Field(T);
201
710
        f.template create_concrete<T>(std::move(data));
202
710
        return f;
203
710
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10
        auto f = Field(T);
201
10
        f.template create_concrete<T>(std::move(data));
202
10
        return f;
203
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
681
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
681
        auto f = Field(T);
201
681
        f.template create_concrete<T>(std::move(data));
202
681
        return f;
203
681
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
618
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
618
        auto f = Field(T);
201
618
        f.template create_concrete<T>(std::move(data));
202
618
        return f;
203
618
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
12
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
12
        auto f = Field(T);
201
12
        f.template create_concrete<T>(std::move(data));
202
12
        return f;
203
12
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
10
        auto f = Field(T);
201
10
        f.template create_concrete<T>(std::move(data));
202
10
        return f;
203
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
643
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
643
        auto f = Field(T);
201
643
        f.template create_concrete<T>(std::move(data));
202
643
        return f;
203
643
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
199
12.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
200
12.7k
        auto f = Field(T);
201
12.7k
        f.template create_concrete<T>(std::move(data));
202
12.7k
        return f;
203
12.7k
    }
204
205
    template <PrimitiveType PType, typename ValType = std::conditional_t<
206
                                           doris::is_string_type(PType), StringRef,
207
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
208
50.6k
    static Field create_field_from_olap_value(const ValType& data) {
209
50.6k
        auto f = Field(PType);
210
50.6k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
50.6k
        if constexpr (is_string_type(PType)) {
212
19.2k
            cpp_value = String(data.data, data.size);
213
19.2k
        } else if constexpr (is_date_or_datetime(PType)) {
214
686
            if constexpr (PType == TYPE_DATE) {
215
335
                cpp_value.from_olap_date(data);
216
351
            } else {
217
351
                cpp_value.from_olap_datetime(data);
218
351
            }
219
686
        } else if constexpr (is_decimalv2(PType)) {
220
337
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
30.4k
        } else {
222
30.4k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
30.4k
        }
224
50.6k
        f.template create_concrete<PType>(std::move(cpp_value));
225
50.6k
        return f;
226
50.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
208
3.73k
    static Field create_field_from_olap_value(const ValType& data) {
209
3.73k
        auto f = Field(PType);
210
3.73k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
3.73k
        } else {
222
3.73k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
3.73k
        }
224
3.73k
        f.template create_concrete<PType>(std::move(cpp_value));
225
3.73k
        return f;
226
3.73k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
208
343
    static Field create_field_from_olap_value(const ValType& data) {
209
343
        auto f = Field(PType);
210
343
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
343
        } else {
222
343
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
343
        }
224
343
        f.template create_concrete<PType>(std::move(cpp_value));
225
343
        return f;
226
343
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
208
18.1k
    static Field create_field_from_olap_value(const ValType& data) {
209
18.1k
        auto f = Field(PType);
210
18.1k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
18.1k
        } else {
222
18.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
18.1k
        }
224
18.1k
        f.template create_concrete<PType>(std::move(cpp_value));
225
18.1k
        return f;
226
18.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
208
3.84k
    static Field create_field_from_olap_value(const ValType& data) {
209
3.84k
        auto f = Field(PType);
210
3.84k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
3.84k
        } else {
222
3.84k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
3.84k
        }
224
3.84k
        f.template create_concrete<PType>(std::move(cpp_value));
225
3.84k
        return f;
226
3.84k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
208
321
    static Field create_field_from_olap_value(const ValType& data) {
209
321
        auto f = Field(PType);
210
321
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
321
        } else {
222
321
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
321
        }
224
321
        f.template create_concrete<PType>(std::move(cpp_value));
225
321
        return f;
226
321
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
208
41
    static Field create_field_from_olap_value(const ValType& data) {
209
41
        auto f = Field(PType);
210
41
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
41
        } else {
222
41
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
41
        }
224
41
        f.template create_concrete<PType>(std::move(cpp_value));
225
41
        return f;
226
41
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
208
157
    static Field create_field_from_olap_value(const ValType& data) {
209
157
        auto f = Field(PType);
210
157
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
157
        } else {
222
157
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
157
        }
224
157
        f.template create_concrete<PType>(std::move(cpp_value));
225
157
        return f;
226
157
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
327
    static Field create_field_from_olap_value(const ValType& data) {
209
327
        auto f = Field(PType);
210
327
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
327
        if constexpr (is_string_type(PType)) {
212
327
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
327
        f.template create_concrete<PType>(std::move(cpp_value));
225
327
        return f;
226
327
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
208
335
    static Field create_field_from_olap_value(const ValType& data) {
209
335
        auto f = Field(PType);
210
335
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
335
        } else if constexpr (is_date_or_datetime(PType)) {
214
335
            if constexpr (PType == TYPE_DATE) {
215
335
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
335
        f.template create_concrete<PType>(std::move(cpp_value));
225
335
        return f;
226
335
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
208
351
    static Field create_field_from_olap_value(const ValType& data) {
209
351
        auto f = Field(PType);
210
351
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
351
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
351
            } else {
217
351
                cpp_value.from_olap_datetime(data);
218
351
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
351
        f.template create_concrete<PType>(std::move(cpp_value));
225
351
        return f;
226
351
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
208
341
    static Field create_field_from_olap_value(const ValType& data) {
209
341
        auto f = Field(PType);
210
341
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
341
        } else {
222
341
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
341
        }
224
341
        f.template create_concrete<PType>(std::move(cpp_value));
225
341
        return f;
226
341
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
208
818
    static Field create_field_from_olap_value(const ValType& data) {
209
818
        auto f = Field(PType);
210
818
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
818
        } else {
222
818
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
818
        }
224
818
        f.template create_concrete<PType>(std::move(cpp_value));
225
818
        return f;
226
818
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
208
353
    static Field create_field_from_olap_value(const ValType& data) {
209
353
        auto f = Field(PType);
210
353
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
353
        } else {
222
353
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
353
        }
224
353
        f.template create_concrete<PType>(std::move(cpp_value));
225
353
        return f;
226
353
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
208
311
    static Field create_field_from_olap_value(const ValType& data) {
209
311
        auto f = Field(PType);
210
311
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
311
        } else {
222
311
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
311
        }
224
311
        f.template create_concrete<PType>(std::move(cpp_value));
225
311
        return f;
226
311
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
208
311
    static Field create_field_from_olap_value(const ValType& data) {
209
311
        auto f = Field(PType);
210
311
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
311
        } else {
222
311
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
311
        }
224
311
        f.template create_concrete<PType>(std::move(cpp_value));
225
311
        return f;
226
311
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
5.45k
    static Field create_field_from_olap_value(const ValType& data) {
209
5.45k
        auto f = Field(PType);
210
5.45k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
5.45k
        if constexpr (is_string_type(PType)) {
212
5.45k
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
5.45k
        f.template create_concrete<PType>(std::move(cpp_value));
225
5.45k
        return f;
226
5.45k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
208
13.4k
    static Field create_field_from_olap_value(const ValType& data) {
209
13.4k
        auto f = Field(PType);
210
13.4k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
13.4k
        if constexpr (is_string_type(PType)) {
212
13.4k
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
13.4k
        f.template create_concrete<PType>(std::move(cpp_value));
225
13.4k
        return f;
226
13.4k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
208
324
    static Field create_field_from_olap_value(const ValType& data) {
209
324
        auto f = Field(PType);
210
324
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
324
        } else {
222
324
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
324
        }
224
324
        f.template create_concrete<PType>(std::move(cpp_value));
225
324
        return f;
226
324
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
208
318
    static Field create_field_from_olap_value(const ValType& data) {
209
318
        auto f = Field(PType);
210
318
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
318
        } else {
222
318
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
318
        }
224
318
        f.template create_concrete<PType>(std::move(cpp_value));
225
318
        return f;
226
318
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
208
321
    static Field create_field_from_olap_value(const ValType& data) {
209
321
        auto f = Field(PType);
210
321
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
321
        } else {
222
321
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
321
        }
224
321
        f.template create_concrete<PType>(std::move(cpp_value));
225
321
        return f;
226
321
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
208
315
    static Field create_field_from_olap_value(const ValType& data) {
209
315
        auto f = Field(PType);
210
315
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
315
        } else {
222
315
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
315
        }
224
315
        f.template create_concrete<PType>(std::move(cpp_value));
225
315
        return f;
226
315
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
208
337
    static Field create_field_from_olap_value(const ValType& data) {
209
337
        auto f = Field(PType);
210
337
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
337
        } else if constexpr (is_decimalv2(PType)) {
220
337
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
        } else {
222
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
        }
224
337
        f.template create_concrete<PType>(std::move(cpp_value));
225
337
        return f;
226
337
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
208
447
    static Field create_field_from_olap_value(const ValType& data) {
209
447
        auto f = Field(PType);
210
447
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
211
        if constexpr (is_string_type(PType)) {
212
            cpp_value = String(data.data, data.size);
213
        } else if constexpr (is_date_or_datetime(PType)) {
214
            if constexpr (PType == TYPE_DATE) {
215
                cpp_value.from_olap_date(data);
216
            } else {
217
                cpp_value.from_olap_datetime(data);
218
            }
219
        } else if constexpr (is_decimalv2(PType)) {
220
            cpp_value = DecimalV2Value(data.integer, data.fraction);
221
447
        } else {
222
447
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
223
447
        }
224
447
        f.template create_concrete<PType>(std::move(cpp_value));
225
447
        return f;
226
447
    }
227
228
    /** Despite the presence of a template constructor, this constructor is still needed,
229
      *  since, in its absence, the compiler will still generate the default constructor.
230
      */
231
    Field(const Field& rhs);
232
233
    Field(Field&& rhs);
234
235
    Field& operator=(const Field& rhs);
236
237
1.67M
    bool is_complex_field() const {
238
1.67M
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
239
1.67M
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
240
1.67M
    }
241
242
37.5M
    Field& operator=(Field&& rhs) {
243
37.5M
        if (this != &rhs) {
244
37.5M
            if (type != rhs.type) {
245
24.8M
                destroy();
246
24.8M
                create(std::move(rhs));
247
24.8M
            } else {
248
12.7M
                assign(std::move(rhs));
249
12.7M
            }
250
37.5M
        }
251
37.5M
        return *this;
252
37.5M
    }
253
254
343M
    ~Field() { destroy(); }
255
256
49.8M
    PrimitiveType get_type() const { return type; }
257
    std::string get_type_name() const;
258
259
99.8M
    bool is_null() const { return type == PrimitiveType::TYPE_NULL; }
260
261
    // The template parameter T needs to be consistent with `which`.
262
    // If not, use NearestFieldType<> externally.
263
    // Maybe modify this in the future, reference: https://github.com/ClickHouse/ClickHouse/pull/22003
264
    template <PrimitiveType T>
265
    typename PrimitiveTypeTraits<T>::CppType& get();
266
267
    template <PrimitiveType T>
268
    const typename PrimitiveTypeTraits<T>::CppType& get() const;
269
270
8.45k
    bool is_nan() const {
271
        // Keep type dispatch with the value so callers cannot reinterpret Field storage using a
272
        // mismatched PrimitiveType.
273
8.45k
        if (type == PrimitiveType::TYPE_FLOAT) {
274
43
            return std::isnan(get<TYPE_FLOAT>());
275
43
        }
276
8.40k
        if (type == PrimitiveType::TYPE_DOUBLE) {
277
43
            return std::isnan(get<TYPE_DOUBLE>());
278
43
        }
279
8.36k
        return false;
280
8.40k
    }
281
282
319k
    bool operator==(const Field& rhs) const {
283
319k
        return operator<=>(rhs) == std::strong_ordering::equal;
284
319k
    }
285
286
    std::strong_ordering operator<=>(const Field& rhs) const;
287
288
    std::string_view as_string_view() const;
289
290
    // Return a human-readable representation of the stored value for debugging.
291
    // Unlike get_type_name() which returns the type, this prints the actual value.
292
    // For decimal types, caller can provide scale for accurate formatting.
293
    std::string to_debug_string(int scale) const;
294
295
private:
296
    std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
297
                         Int128, IPv6, Float64, String, JsonbField, StringView, Array, Struct, Map,
298
                         VariantField, Decimal32, Decimal64, DecimalV2Value, Decimal128V3,
299
                         Decimal256, BitmapValue, HyperLogLog, QuantileState>
300
            storage;
301
302
    PrimitiveType type;
303
304
    /// Assuming there was no allocated state or it was deallocated (see destroy).
305
    template <PrimitiveType Type>
306
    void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
307
    template <PrimitiveType Type>
308
    void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
309
    /// Assuming same types.
310
    template <PrimitiveType Type>
311
    void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
312
    template <PrimitiveType Type>
313
    void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
314
315
    void create(const Field& field);
316
    void create(Field&& field);
317
318
    void assign(const Field& x);
319
    void assign(Field&& x);
320
321
    void destroy();
322
323
    template <PrimitiveType T>
324
    void destroy();
325
};
326
327
struct FieldWithDataType {
328
    Field field;
329
    // used for nested type of array
330
    PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE;
331
    uint8_t num_dimensions = 0;
332
    int precision = -1;
333
    int scale = -1;
334
    // True when the array elements are mixed-type and must be converted to the common base
335
    // type on insert. Mirrors FieldInfo::need_convert so it survives the FieldWithDataType
336
    // round trip in the sparse read path.
337
    bool need_convert = false;
338
};
339
340
} // namespace doris
341
342
template <>
343
struct std::hash<doris::Field> {
344
0
    size_t operator()(const doris::Field& field) const {
345
0
        if (field.is_null()) {
346
0
            return 0;
347
0
        }
348
0
        std::hash<std::string_view> hasher;
349
0
        return hasher(field.as_string_view());
350
0
    }
351
};