Coverage Report

Created: 2026-09-22 10:55

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
43.9k
    JsonbField() = default;
83
175k
    ~JsonbField() = default; // unique_ptr will handle cleanup automatically
84
85
43.9k
    JsonbField(const char* ptr, size_t len) : size(len) {
86
43.9k
        data = std::make_unique<char[]>(size);
87
43.9k
        if (!data) {
88
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
89
0
        }
90
43.9k
        if (size > 0) {
91
43.4k
            memcpy(data.get(), ptr, size);
92
43.4k
        }
93
43.9k
    }
94
95
12
    JsonbField(const JsonbField& x) : size(x.size) {
96
12
        data = std::make_unique<char[]>(size);
97
12
        if (!data) {
98
0
            throw Exception(Status::FatalError("new data buffer failed, size: {}", size));
99
0
        }
100
12
        if (size > 0) {
101
12
            memcpy(data.get(), x.data.get(), size);
102
12
        }
103
12
    }
104
105
87.9k
    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
43.9k
    JsonbField& operator=(JsonbField&& x) noexcept {
123
43.9k
        if (this != &x) {
124
43.9k
            data = std::move(x.data);
125
43.9k
            size = x.size;
126
43.9k
            x.size = 0;
127
43.9k
        }
128
43.9k
        return *this;
129
43.9k
    }
130
131
44.0k
    const char* get_value() const { return data.get(); }
132
44.0k
    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
109M
    Field() : type(PrimitiveType::TYPE_NULL) {}
190
    // set Types::Null explictly and avoid other types
191
129k
    Field(PrimitiveType w) : type(w) {}
192
    template <PrimitiveType T>
193
26.1M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
26.1M
        auto f = Field();
197
26.1M
        f.template create_concrete<T>(data);
198
26.1M
        return f;
199
26.1M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
332k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
332k
        auto f = Field();
197
332k
        f.template create_concrete<T>(data);
198
332k
        return f;
199
332k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
21.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
21.8k
        auto f = Field();
197
21.8k
        f.template create_concrete<T>(data);
198
21.8k
        return f;
199
21.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
15
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
15
        auto f = Field();
197
15
        f.template create_concrete<T>(data);
198
15
        return f;
199
15
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
25.3M
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
25.3M
        auto f = Field();
197
25.3M
        f.template create_concrete<T>(data);
198
25.3M
        return f;
199
25.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.42k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
2.42k
        auto f = Field();
197
2.42k
        f.template create_concrete<T>(data);
198
2.42k
        return f;
199
2.42k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
22.3k
        auto f = Field();
197
22.3k
        f.template create_concrete<T>(data);
198
22.3k
        return f;
199
22.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
404
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
404
        auto f = Field();
197
404
        f.template create_concrete<T>(data);
198
404
        return f;
199
404
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
30.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
30.1k
        auto f = Field();
197
30.1k
        f.template create_concrete<T>(data);
198
30.1k
        return f;
199
30.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
555
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
555
        auto f = Field();
197
555
        f.template create_concrete<T>(data);
198
555
        return f;
199
555
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
28
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
28
        auto f = Field();
197
28
        f.template create_concrete<T>(data);
198
28
        return f;
199
28
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
32.6k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
32.6k
        auto f = Field();
197
32.6k
        f.template create_concrete<T>(data);
198
32.6k
        return f;
199
32.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
4
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
4
        auto f = Field();
197
4
        f.template create_concrete<T>(data);
198
4
        return f;
199
4
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
50.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
50.9k
        auto f = Field();
197
50.9k
        f.template create_concrete<T>(data);
198
50.9k
        return f;
199
50.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
26.7k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
26.7k
        auto f = Field();
197
26.7k
        f.template create_concrete<T>(data);
198
26.7k
        return f;
199
26.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
25.0k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
25.0k
        auto f = Field();
197
25.0k
        f.template create_concrete<T>(data);
198
25.0k
        return f;
199
25.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
32.9k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
32.9k
        auto f = Field();
197
32.9k
        f.template create_concrete<T>(data);
198
32.9k
        return f;
199
32.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
17.8k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
17.8k
        auto f = Field();
197
17.8k
        f.template create_concrete<T>(data);
198
17.8k
        return f;
199
17.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
27.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
27.3k
        auto f = Field();
197
27.3k
        f.template create_concrete<T>(data);
198
27.3k
        return f;
199
27.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
24.1k
        auto f = Field();
197
24.1k
        f.template create_concrete<T>(data);
198
24.1k
        return f;
199
24.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
134
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
134
        auto f = Field();
197
134
        f.template create_concrete<T>(data);
198
134
        return f;
199
134
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2.62k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
2.62k
        auto f = Field();
197
2.62k
        f.template create_concrete<T>(data);
198
2.62k
        return f;
199
2.62k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
86
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
86
        auto f = Field();
197
86
        f.template create_concrete<T>(data);
198
86
        return f;
199
86
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.56k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
8.56k
        auto f = Field();
197
8.56k
        f.template create_concrete<T>(data);
198
8.56k
        return f;
199
8.56k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.73k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
8.73k
        auto f = Field();
197
8.73k
        f.template create_concrete<T>(data);
198
8.73k
        return f;
199
8.73k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
13.3k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
13.3k
        auto f = Field();
197
13.3k
        f.template create_concrete<T>(data);
198
13.3k
        return f;
199
13.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
6.51k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
6.51k
        auto f = Field();
197
6.51k
        f.template create_concrete<T>(data);
198
6.51k
        return f;
199
6.51k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
13
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
13
        auto f = Field();
197
13
        f.template create_concrete<T>(data);
198
13
        return f;
199
13
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
9.74k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
9.74k
        auto f = Field();
197
9.74k
        f.template create_concrete<T>(data);
198
9.74k
        return f;
199
9.74k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
19.5k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
19.5k
        auto f = Field();
197
19.5k
        f.template create_concrete<T>(data);
198
19.5k
        return f;
199
19.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.1k
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
22.1k
        auto f = Field();
197
22.1k
        f.template create_concrete<T>(data);
198
22.1k
        return f;
199
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
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
34.9k
        auto f = Field();
197
34.9k
        f.template create_concrete<T>(data);
198
34.9k
        return f;
199
34.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
2
    static Field create_field(const typename PrimitiveTypeTraits<T>::CppType& data) {
194
        // Publish the type only after construction succeeds, so allocation failures cannot
195
        // destroy uninitialized owned storage (including long binary values).
196
2
        auto f = Field();
197
2
        f.template create_concrete<T>(data);
198
2
        return f;
199
2
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
200
    template <PrimitiveType T>
201
58.2M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
58.2M
        auto f = Field();
203
58.2M
        f.template create_concrete<T>(std::move(data));
204
58.2M
        return f;
205
58.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.38M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.38M
        auto f = Field();
203
1.38M
        f.template create_concrete<T>(std::move(data));
204
1.38M
        return f;
205
1.38M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
806k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
806k
        auto f = Field();
203
806k
        f.template create_concrete<T>(std::move(data));
204
806k
        return f;
205
806k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
14.0M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
14.0M
        auto f = Field();
203
14.0M
        f.template create_concrete<T>(std::move(data));
204
14.0M
        return f;
205
14.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
39.1k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
39.1k
        auto f = Field();
203
39.1k
        f.template create_concrete<T>(std::move(data));
204
39.1k
        return f;
205
39.1k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
53
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
53
        auto f = Field();
203
53
        f.template create_concrete<T>(std::move(data));
204
53
        return f;
205
53
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
28.2M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
28.2M
        auto f = Field();
203
28.2M
        f.template create_concrete<T>(std::move(data));
204
28.2M
        return f;
205
28.2M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
13.5M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
13.5M
        auto f = Field();
203
13.5M
        f.template create_concrete<T>(std::move(data));
204
13.5M
        return f;
205
13.5M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE31EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
87.9k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
87.9k
        auto f = Field();
203
87.9k
        f.template create_concrete<T>(std::move(data));
204
87.9k
        return f;
205
87.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
2.00k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
2.00k
        auto f = Field();
203
2.00k
        f.template create_concrete<T>(std::move(data));
204
2.00k
        return f;
205
2.00k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
2.27k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
2.27k
        auto f = Field();
203
2.27k
        f.template create_concrete<T>(std::move(data));
204
2.27k
        return f;
205
2.27k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
884
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
884
        auto f = Field();
203
884
        f.template create_concrete<T>(std::move(data));
204
884
        return f;
205
884
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
12
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
12
        auto f = Field();
203
12
        f.template create_concrete<T>(std::move(data));
204
12
        return f;
205
12
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
796
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
796
        auto f = Field();
203
796
        f.template create_concrete<T>(std::move(data));
204
796
        return f;
205
796
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
10.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
10.0k
        auto f = Field();
203
10.0k
        f.template create_concrete<T>(std::move(data));
204
10.0k
        return f;
205
10.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.35k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.35k
        auto f = Field();
203
1.35k
        f.template create_concrete<T>(std::move(data));
204
1.35k
        return f;
205
1.35k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE19EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
10
        auto f = Field();
203
10
        f.template create_concrete<T>(std::move(data));
204
10
        return f;
205
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
618
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
618
        auto f = Field();
203
618
        f.template create_concrete<T>(std::move(data));
204
618
        return f;
205
618
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
538
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
538
        auto f = Field();
203
538
        f.template create_concrete<T>(std::move(data));
204
538
        return f;
205
538
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
598
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
598
        auto f = Field();
203
598
        f.template create_concrete<T>(std::move(data));
204
598
        return f;
205
598
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
6.39k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
6.39k
        auto f = Field();
203
6.39k
        f.template create_concrete<T>(std::move(data));
204
6.39k
        return f;
205
6.39k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE24EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
10
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
10
        auto f = Field();
203
10
        f.template create_concrete<T>(std::move(data));
204
10
        return f;
205
10
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
33
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
33
        auto f = Field();
203
33
        f.template create_concrete<T>(std::move(data));
204
33
        return f;
205
33
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.71k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.71k
        auto f = Field();
203
1.71k
        f.template create_concrete<T>(std::move(data));
204
1.71k
        return f;
205
1.71k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.43k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.43k
        auto f = Field();
203
1.43k
        f.template create_concrete<T>(std::move(data));
204
1.43k
        return f;
205
1.43k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.05k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.05k
        auto f = Field();
203
1.05k
        f.template create_concrete<T>(std::move(data));
204
1.05k
        return f;
205
1.05k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
632
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
632
        auto f = Field();
203
632
        f.template create_concrete<T>(std::move(data));
204
632
        return f;
205
632
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
40
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
40
        auto f = Field();
203
40
        f.template create_concrete<T>(std::move(data));
204
40
        return f;
205
40
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
613
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
613
        auto f = Field();
203
613
        f.template create_concrete<T>(std::move(data));
204
613
        return f;
205
613
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
18.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
18.5k
        auto f = Field();
203
18.5k
        f.template create_concrete<T>(std::move(data));
204
18.5k
        return f;
205
18.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
598
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
598
        auto f = Field();
203
598
        f.template create_concrete<T>(std::move(data));
204
598
        return f;
205
598
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
627
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
627
        auto f = Field();
203
627
        f.template create_concrete<T>(std::move(data));
204
627
        return f;
205
627
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
569
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
569
        auto f = Field();
203
569
        f.template create_concrete<T>(std::move(data));
204
569
        return f;
205
569
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE27EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1
        auto f = Field();
203
1
        f.template create_concrete<T>(std::move(data));
204
1
        return f;
205
1
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
57
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
57
        auto f = Field();
203
57
        f.template create_concrete<T>(std::move(data));
204
57
        return f;
205
57
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
3.69k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
3.69k
        auto f = Field();
203
3.69k
        f.template create_concrete<T>(std::move(data));
204
3.69k
        return f;
205
3.69k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
564
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
564
        auto f = Field();
203
564
        f.template create_concrete<T>(std::move(data));
204
564
        return f;
205
564
    }
206
207
    template <PrimitiveType PType, typename ValType = std::conditional_t<
208
                                           doris::is_string_type(PType), StringRef,
209
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
210
44.0k
    static Field create_field_from_olap_value(const ValType& data) {
211
44.0k
        auto f = Field(PType);
212
44.0k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
44.0k
        if constexpr (is_string_type(PType)) {
214
15.2k
            cpp_value = String(data.data, data.size);
215
15.2k
        } else if constexpr (is_date_or_datetime(PType)) {
216
606
            if constexpr (PType == TYPE_DATE) {
217
295
                cpp_value.from_olap_date(data);
218
311
            } else {
219
311
                cpp_value.from_olap_datetime(data);
220
311
            }
221
606
        } else if constexpr (is_decimalv2(PType)) {
222
297
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
27.8k
        } else {
224
27.8k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
27.8k
        }
226
44.0k
        f.template create_concrete<PType>(std::move(cpp_value));
227
44.0k
        return f;
228
44.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
289
    static Field create_field_from_olap_value(const ValType& data) {
211
289
        auto f = Field(PType);
212
289
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
289
        if constexpr (is_string_type(PType)) {
214
289
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
289
        f.template create_concrete<PType>(std::move(cpp_value));
227
289
        return f;
228
289
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
1.98k
    static Field create_field_from_olap_value(const ValType& data) {
211
1.98k
        auto f = Field(PType);
212
1.98k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
1.98k
        if constexpr (is_string_type(PType)) {
214
1.98k
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
1.98k
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.98k
        return f;
228
1.98k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
210
295
    static Field create_field_from_olap_value(const ValType& data) {
211
295
        auto f = Field(PType);
212
295
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
295
        } else if constexpr (is_date_or_datetime(PType)) {
216
295
            if constexpr (PType == TYPE_DATE) {
217
295
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
295
        f.template create_concrete<PType>(std::move(cpp_value));
227
295
        return f;
228
295
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
210
311
    static Field create_field_from_olap_value(const ValType& data) {
211
311
        auto f = Field(PType);
212
311
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
311
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
311
            } else {
219
311
                cpp_value.from_olap_datetime(data);
220
311
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
311
        f.template create_concrete<PType>(std::move(cpp_value));
227
311
        return f;
228
311
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
210
297
    static Field create_field_from_olap_value(const ValType& data) {
211
297
        auto f = Field(PType);
212
297
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
297
        } else {
224
297
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
297
        }
226
297
        f.template create_concrete<PType>(std::move(cpp_value));
227
297
        return f;
228
297
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
210
324
    static Field create_field_from_olap_value(const ValType& data) {
211
324
        auto f = Field(PType);
212
324
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
324
        } else {
224
324
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
324
        }
226
324
        f.template create_concrete<PType>(std::move(cpp_value));
227
324
        return f;
228
324
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
210
297
    static Field create_field_from_olap_value(const ValType& data) {
211
297
        auto f = Field(PType);
212
297
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
297
        } else if constexpr (is_decimalv2(PType)) {
222
297
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
297
        f.template create_concrete<PType>(std::move(cpp_value));
227
297
        return f;
228
297
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
210
280
    static Field create_field_from_olap_value(const ValType& data) {
211
280
        auto f = Field(PType);
212
280
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
280
        } else {
224
280
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
280
        }
226
280
        f.template create_concrete<PType>(std::move(cpp_value));
227
280
        return f;
228
280
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
210
278
    static Field create_field_from_olap_value(const ValType& data) {
211
278
        auto f = Field(PType);
212
278
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
278
        } else {
224
278
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
278
        }
226
278
        f.template create_concrete<PType>(std::move(cpp_value));
227
278
        return f;
228
278
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
210
277
    static Field create_field_from_olap_value(const ValType& data) {
211
277
        auto f = Field(PType);
212
277
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
277
        } else {
224
277
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
277
        }
226
277
        f.template create_concrete<PType>(std::move(cpp_value));
227
277
        return f;
228
277
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
210
277
    static Field create_field_from_olap_value(const ValType& data) {
211
277
        auto f = Field(PType);
212
277
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
277
        } else {
224
277
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
277
        }
226
277
        f.template create_concrete<PType>(std::move(cpp_value));
227
277
        return f;
228
277
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
210
301
    static Field create_field_from_olap_value(const ValType& data) {
211
301
        auto f = Field(PType);
212
301
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
301
        } else {
224
301
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
301
        }
226
301
        f.template create_concrete<PType>(std::move(cpp_value));
227
301
        return f;
228
301
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
210
18.5k
    static Field create_field_from_olap_value(const ValType& data) {
211
18.5k
        auto f = Field(PType);
212
18.5k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
18.5k
        } else {
224
18.5k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
18.5k
        }
226
18.5k
        f.template create_concrete<PType>(std::move(cpp_value));
227
18.5k
        return f;
228
18.5k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
210
1.82k
    static Field create_field_from_olap_value(const ValType& data) {
211
1.82k
        auto f = Field(PType);
212
1.82k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
1.82k
        } else {
224
1.82k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
1.82k
        }
226
1.82k
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.82k
        return f;
228
1.82k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
210
303
    static Field create_field_from_olap_value(const ValType& data) {
211
303
        auto f = Field(PType);
212
303
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
303
        } else {
224
303
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
303
        }
226
303
        f.template create_concrete<PType>(std::move(cpp_value));
227
303
        return f;
228
303
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
210
3.20k
    static Field create_field_from_olap_value(const ValType& data) {
211
3.20k
        auto f = Field(PType);
212
3.20k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
3.20k
        } else {
224
3.20k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
3.20k
        }
226
3.20k
        f.template create_concrete<PType>(std::move(cpp_value));
227
3.20k
        return f;
228
3.20k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
210
281
    static Field create_field_from_olap_value(const ValType& data) {
211
281
        auto f = Field(PType);
212
281
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
281
        } else {
224
281
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
281
        }
226
281
        f.template create_concrete<PType>(std::move(cpp_value));
227
281
        return f;
228
281
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
210
393
    static Field create_field_from_olap_value(const ValType& data) {
211
393
        auto f = Field(PType);
212
393
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
393
        } else {
224
393
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
393
        }
226
393
        f.template create_concrete<PType>(std::move(cpp_value));
227
393
        return f;
228
393
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
210
295
    static Field create_field_from_olap_value(const ValType& data) {
211
295
        auto f = Field(PType);
212
295
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
295
        } else {
224
295
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
295
        }
226
295
        f.template create_concrete<PType>(std::move(cpp_value));
227
295
        return f;
228
295
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
210
399
    static Field create_field_from_olap_value(const ValType& data) {
211
399
        auto f = Field(PType);
212
399
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
399
        } else {
224
399
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
399
        }
226
399
        f.template create_concrete<PType>(std::move(cpp_value));
227
399
        return f;
228
399
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
210
271
    static Field create_field_from_olap_value(const ValType& data) {
211
271
        auto f = Field(PType);
212
271
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
271
        } else {
224
271
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
271
        }
226
271
        f.template create_concrete<PType>(std::move(cpp_value));
227
271
        return f;
228
271
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
210
271
    static Field create_field_from_olap_value(const ValType& data) {
211
271
        auto f = Field(PType);
212
271
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
271
        } else {
224
271
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
271
        }
226
271
        f.template create_concrete<PType>(std::move(cpp_value));
227
271
        return f;
228
271
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE43ElEES0_RKT0_
Line
Count
Source
210
4
    static Field create_field_from_olap_value(const ValType& data) {
211
4
        auto f = Field(PType);
212
4
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
4
        } else {
224
4
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
4
        }
226
4
        f.template create_concrete<PType>(std::move(cpp_value));
227
4
        return f;
228
4
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
13.0k
    static Field create_field_from_olap_value(const ValType& data) {
211
13.0k
        auto f = Field(PType);
212
13.0k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
13.0k
        if constexpr (is_string_type(PType)) {
214
13.0k
            cpp_value = String(data.data, data.size);
215
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
            } else {
219
                cpp_value.from_olap_datetime(data);
220
            }
221
        } else if constexpr (is_decimalv2(PType)) {
222
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
13.0k
        f.template create_concrete<PType>(std::move(cpp_value));
227
13.0k
        return f;
228
13.0k
    }
229
230
    /** Despite the presence of a template constructor, this constructor is still needed,
231
      *  since, in its absence, the compiler will still generate the default constructor.
232
      */
233
    Field(const Field& rhs);
234
235
    Field(Field&& rhs);
236
237
    Field& operator=(const Field& rhs);
238
239
0
    bool is_complex_field() const {
240
0
        return type == PrimitiveType::TYPE_ARRAY || type == PrimitiveType::TYPE_MAP ||
241
0
               type == PrimitiveType::TYPE_STRUCT || type == PrimitiveType::TYPE_VARIANT;
242
0
    }
243
244
26.0M
    Field& operator=(Field&& rhs) {
245
26.0M
        if (this != &rhs) {
246
26.0M
            if (type != rhs.type) {
247
25.1M
                destroy();
248
25.1M
                type = TYPE_NULL;
249
25.1M
                create(std::move(rhs));
250
25.1M
            } else {
251
822k
                assign(std::move(rhs));
252
822k
            }
253
26.0M
        }
254
26.0M
        return *this;
255
26.0M
    }
256
257
312M
    ~Field() { destroy(); }
258
259
27.5M
    PrimitiveType get_type() const { return type; }
260
    std::string get_type_name() const;
261
262
96.3M
    bool is_null() const { return type == PrimitiveType::TYPE_NULL; }
263
264
    // The template parameter T needs to be consistent with `which`.
265
    // If not, use NearestFieldType<> externally.
266
    // Maybe modify this in the future, reference: https://github.com/ClickHouse/ClickHouse/pull/22003
267
    template <PrimitiveType T>
268
    typename PrimitiveTypeTraits<T>::CppType& get();
269
270
    template <PrimitiveType T>
271
    const typename PrimitiveTypeTraits<T>::CppType& get() const;
272
273
223
    bool is_nan() const {
274
        // Keep type dispatch with the value so callers cannot reinterpret Field storage using a
275
        // mismatched PrimitiveType.
276
223
        if (type == PrimitiveType::TYPE_FLOAT) {
277
40
            return std::isnan(get<TYPE_FLOAT>());
278
40
        }
279
183
        if (type == PrimitiveType::TYPE_DOUBLE) {
280
40
            return std::isnan(get<TYPE_DOUBLE>());
281
40
        }
282
143
        return false;
283
183
    }
284
285
130k
    bool operator==(const Field& rhs) const {
286
130k
        return operator<=>(rhs) == std::strong_ordering::equal;
287
130k
    }
288
289
    std::strong_ordering operator<=>(const Field& rhs) const;
290
291
    std::string_view as_string_view() const;
292
293
    // Return a human-readable representation of the stored value for debugging.
294
    // Unlike get_type_name() which returns the type, this prints the actual value.
295
    // For decimal types, caller can provide scale for accurate formatting.
296
    std::string to_debug_string(int scale) const;
297
298
private:
299
    std::aligned_union_t<DBMS_MIN_FIELD_SIZE - sizeof(PrimitiveType), Null, UInt64, UInt128, Int64,
300
                         Int128, IPv6, Float64, String, JsonbField, StringView, Array, Struct, Map,
301
                         VariantField, Decimal32, Decimal64, DecimalV2Value, Decimal128V3,
302
                         Decimal256, BitmapValue, HyperLogLog, QuantileState>
303
            storage;
304
305
    PrimitiveType type;
306
307
    /// Assuming there was no allocated state or it was deallocated (see destroy).
308
    template <PrimitiveType Type>
309
    void create_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
310
    template <PrimitiveType Type>
311
    void create_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
312
    /// Assuming same types.
313
    template <PrimitiveType Type>
314
    void assign_concrete(typename PrimitiveTypeTraits<Type>::CppType&& x);
315
    template <PrimitiveType Type>
316
    void assign_concrete(const typename PrimitiveTypeTraits<Type>::CppType& x);
317
318
    void create(const Field& field);
319
    void create(Field&& field);
320
321
    void assign(const Field& x);
322
    void assign(Field&& x);
323
324
    void destroy();
325
326
    template <PrimitiveType T>
327
    void destroy();
328
};
329
330
struct FieldWithDataType {
331
    Field field;
332
    // used for nested type of array
333
    PrimitiveType base_scalar_type_id = PrimitiveType::INVALID_TYPE;
334
    uint8_t num_dimensions = 0;
335
    int precision = -1;
336
    int scale = -1;
337
    // True when the array elements are mixed-type and must be converted to the common base
338
    // type on insert. Mirrors FieldInfo::need_convert so it survives the FieldWithDataType
339
    // round trip in the sparse read path.
340
    bool need_convert = false;
341
};
342
343
} // namespace doris
344
345
template <>
346
struct std::hash<doris::Field> {
347
0
    size_t operator()(const doris::Field& field) const {
348
0
        if (field.is_null()) {
349
0
            return 0;
350
0
        }
351
0
        std::hash<std::string_view> hasher;
352
0
        return hasher(field.as_string_view());
353
0
    }
354
};