Coverage Report

Created: 2026-10-07 08:42

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
138M
    Field() : type(PrimitiveType::TYPE_NULL) {}
190
    // set Types::Null explictly and avoid other types
191
9.40M
    Field(PrimitiveType w) : type(w) {}
192
    template <PrimitiveType T>
193
30.0M
    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.0M
        auto f = Field();
197
30.0M
        f.template create_concrete<T>(data);
198
30.0M
        return f;
199
30.0M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
1.00M
    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
1.00M
        auto f = Field();
197
1.00M
        f.template create_concrete<T>(data);
198
1.00M
        return f;
199
1.00M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE37EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
24.2k
    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.2k
        auto f = Field();
197
24.2k
        f.template create_concrete<T>(data);
198
24.2k
        return f;
199
24.2k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
51
    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
51
        auto f = Field();
197
51
        f.template create_concrete<T>(data);
198
51
        return f;
199
51
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
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_13PrimitiveTypeE17EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
52.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
52.8k
        auto f = Field();
197
52.8k
        f.template create_concrete<T>(data);
198
52.8k
        return f;
199
52.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
22.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
22.7k
        auto f = Field();
197
22.7k
        f.template create_concrete<T>(data);
198
22.7k
        return f;
199
22.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE29EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
27.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
27.9k
        auto f = Field();
197
27.9k
        f.template create_concrete<T>(data);
198
27.9k
        return f;
199
27.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE20EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
8.64k
    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.64k
        auto f = Field();
197
8.64k
        f.template create_concrete<T>(data);
198
8.64k
        return f;
199
8.64k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
27.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
27.8k
        auto f = Field();
197
27.8k
        f.template create_concrete<T>(data);
198
27.8k
        return f;
199
27.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
38.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
38.7k
        auto f = Field();
197
38.7k
        f.template create_concrete<T>(data);
198
38.7k
        return f;
199
38.7k
    }
_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_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_13PrimitiveTypeE27EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
191
    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
191
        auto f = Field();
197
191
        f.template create_concrete<T>(data);
198
191
        return f;
199
191
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
5.46k
    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
5.46k
        auto f = Field();
197
5.46k
        f.template create_concrete<T>(data);
198
5.46k
        return f;
199
5.46k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
16.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
16.8k
        auto f = Field();
197
16.8k
        f.template create_concrete<T>(data);
198
16.8k
        return f;
199
16.8k
    }
_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_13PrimitiveTypeE2EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
31.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
31.0k
        auto f = Field();
197
31.0k
        f.template create_concrete<T>(data);
198
31.0k
        return f;
199
31.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
455k
    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
455k
        auto f = Field();
197
455k
        f.template create_concrete<T>(data);
198
455k
        return f;
199
455k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
53.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
53.9k
        auto f = Field();
197
53.9k
        f.template create_concrete<T>(data);
198
53.9k
        return f;
199
53.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
177k
    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
177k
        auto f = Field();
197
177k
        f.template create_concrete<T>(data);
198
177k
        return f;
199
177k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
39.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
39.7k
        auto f = Field();
197
39.7k
        f.template create_concrete<T>(data);
198
39.7k
        return f;
199
39.7k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
44.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
44.3k
        auto f = Field();
197
44.3k
        f.template create_concrete<T>(data);
198
44.3k
        return f;
199
44.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
709k
    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
709k
        auto f = Field();
197
709k
        f.template create_concrete<T>(data);
198
709k
        return f;
199
709k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
33.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
33.3k
        auto f = Field();
197
33.3k
        f.template create_concrete<T>(data);
198
33.3k
        return f;
199
33.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE44EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
93.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
93.3k
        auto f = Field();
197
93.3k
        f.template create_concrete<T>(data);
198
93.3k
        return f;
199
93.3k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
15.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
15.6k
        auto f = Field();
197
15.6k
        f.template create_concrete<T>(data);
198
15.6k
        return f;
199
15.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
587k
    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
587k
        auto f = Field();
197
587k
        f.template create_concrete<T>(data);
198
587k
        return f;
199
587k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
13.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
13.9k
        auto f = Field();
197
13.9k
        f.template create_concrete<T>(data);
198
13.9k
        return f;
199
13.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
102k
    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
102k
        auto f = Field();
197
102k
        f.template create_concrete<T>(data);
198
102k
        return f;
199
102k
    }
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE38EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Unexecuted instantiation: _ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE39EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE15EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
1.46k
    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
1.46k
        auto f = Field();
197
1.46k
        f.template create_concrete<T>(data);
198
1.46k
        return f;
199
1.46k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_RKNS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
193
319k
    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
319k
        auto f = Field();
197
319k
        f.template create_concrete<T>(data);
198
319k
        return f;
199
319k
    }
_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
    }
200
    template <PrimitiveType T>
201
67.4M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
67.4M
        auto f = Field();
203
67.4M
        f.template create_concrete<T>(std::move(data));
204
67.4M
        return f;
205
67.4M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE23EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
2.03M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
2.03M
        auto f = Field();
203
2.03M
        f.template create_concrete<T>(std::move(data));
204
2.03M
        return f;
205
2.03M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE17EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
90.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
90.5k
        auto f = Field();
203
90.5k
        f.template create_concrete<T>(std::move(data));
204
90.5k
        return f;
205
90.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE1EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
88.6k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
88.6k
        auto f = Field();
203
88.6k
        f.template create_concrete<T>(std::move(data));
204
88.6k
        return f;
205
88.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE18EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
24.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
24.5k
        auto f = Field();
203
24.5k
        f.template create_concrete<T>(std::move(data));
204
24.5k
        return f;
205
24.5k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE25EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
205k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
205k
        auto f = Field();
203
205k
        f.template create_concrete<T>(std::move(data));
204
205k
        return f;
205
205k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE26EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
232k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
232k
        auto f = Field();
203
232k
        f.template create_concrete<T>(std::move(data));
204
232k
        return f;
205
232k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE12EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
4.83k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
4.83k
        auto f = Field();
203
4.83k
        f.template create_concrete<T>(std::move(data));
204
4.83k
        return f;
205
4.83k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE28EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
38.7k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
38.7k
        auto f = Field();
203
38.7k
        f.template create_concrete<T>(std::move(data));
204
38.7k
        return f;
205
38.7k
    }
_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_13PrimitiveTypeE20EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
10.8k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
10.8k
        auto f = Field();
203
10.8k
        f.template create_concrete<T>(std::move(data));
204
10.8k
        return f;
205
10.8k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE30EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
74.0k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
74.0k
        auto f = Field();
203
74.0k
        f.template create_concrete<T>(std::move(data));
204
74.0k
        return f;
205
74.0k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE35EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
9.33k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
9.33k
        auto f = Field();
203
9.33k
        f.template create_concrete<T>(std::move(data));
204
9.33k
        return f;
205
9.33k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE36EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
4.85k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
4.85k
        auto f = Field();
203
4.85k
        f.template create_concrete<T>(std::move(data));
204
4.85k
        return f;
205
4.85k
    }
_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_13PrimitiveTypeE44EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
9.62k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
9.62k
        auto f = Field();
203
9.62k
        f.template create_concrete<T>(std::move(data));
204
9.62k
        return f;
205
9.62k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE41EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
73
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
73
        auto f = Field();
203
73
        f.template create_concrete<T>(std::move(data));
204
73
        return f;
205
73
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE2EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
28.3M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
28.3M
        auto f = Field();
203
28.3M
        f.template create_concrete<T>(std::move(data));
204
28.3M
        return f;
205
28.3M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE3EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
4.72M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
4.72M
        auto f = Field();
203
4.72M
        f.template create_concrete<T>(std::move(data));
204
4.72M
        return f;
205
4.72M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE4EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
90.9k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
90.9k
        auto f = Field();
203
90.9k
        f.template create_concrete<T>(std::move(data));
204
90.9k
        return f;
205
90.9k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE5EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
1.72M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
1.72M
        auto f = Field();
203
1.72M
        f.template create_concrete<T>(std::move(data));
204
1.72M
        return f;
205
1.72M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE6EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
14.9M
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
14.9M
        auto f = Field();
203
14.9M
        f.template create_concrete<T>(std::move(data));
204
14.9M
        return f;
205
14.9M
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE7EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
131k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
131k
        auto f = Field();
203
131k
        f.template create_concrete<T>(std::move(data));
204
131k
        return f;
205
131k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE8EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
47.6k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
47.6k
        auto f = Field();
203
47.6k
        f.template create_concrete<T>(std::move(data));
204
47.6k
        return f;
205
47.6k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE9EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
56.3k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
56.3k
        auto f = Field();
203
56.3k
        f.template create_concrete<T>(std::move(data));
204
56.3k
        return f;
205
56.3k
    }
_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_13PrimitiveTypeE16EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
4.45k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
4.45k
        auto f = Field();
203
4.45k
        f.template create_concrete<T>(std::move(data));
204
4.45k
        return f;
205
4.45k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE32EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
6.68k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
6.68k
        auto f = Field();
203
6.68k
        f.template create_concrete<T>(std::move(data));
204
6.68k
        return f;
205
6.68k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE11EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
4.01k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
4.01k
        auto f = Field();
203
4.01k
        f.template create_concrete<T>(std::move(data));
204
4.01k
        return f;
205
4.01k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE22EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
62
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
62
        auto f = Field();
203
62
        f.template create_concrete<T>(std::move(data));
204
62
        return f;
205
62
    }
_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_13PrimitiveTypeE37EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
2.73k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
2.73k
        auto f = Field();
203
2.73k
        f.template create_concrete<T>(std::move(data));
204
2.73k
        return f;
205
2.73k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE43EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
735
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
735
        auto f = Field();
203
735
        f.template create_concrete<T>(std::move(data));
204
735
        return f;
205
735
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE42EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
25.5k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
25.5k
        auto f = Field();
203
25.5k
        f.template create_concrete<T>(std::move(data));
204
25.5k
        return f;
205
25.5k
    }
_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_13PrimitiveTypeE15EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
54.4k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
54.4k
        auto f = Field();
203
54.4k
        f.template create_concrete<T>(std::move(data));
204
54.4k
        return f;
205
54.4k
    }
_ZN5doris5Field12create_fieldILNS_13PrimitiveTypeE10EEES0_ONS_19PrimitiveTypeTraitsIXT_EE7CppTypeE
Line
Count
Source
201
760k
    static Field create_field(typename PrimitiveTypeTraits<T>::CppType&& data) {
202
760k
        auto f = Field();
203
760k
        f.template create_concrete<T>(std::move(data));
204
760k
        return f;
205
760k
    }
206
207
    template <PrimitiveType PType, typename ValType = std::conditional_t<
208
                                           doris::is_string_type(PType), StringRef,
209
                                           typename PrimitiveTypeTraits<PType>::StorageFieldType>>
210
1.40M
    static Field create_field_from_olap_value(const ValType& data) {
211
1.40M
        auto f = Field(PType);
212
1.40M
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
1.40M
        if constexpr (is_string_type(PType)) {
214
466k
            cpp_value = String(data.data, data.size);
215
466k
        } else if constexpr (is_date_or_datetime(PType)) {
216
1.67k
            if constexpr (PType == TYPE_DATE) {
217
697
                cpp_value.from_olap_date(data);
218
977
            } else {
219
977
                cpp_value.from_olap_datetime(data);
220
977
            }
221
1.67k
        } else if constexpr (is_decimalv2(PType)) {
222
429
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
933k
        } else {
224
933k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
933k
        }
226
1.40M
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.40M
        return f;
228
1.40M
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE3EaEES0_RKT0_
Line
Count
Source
210
82.6k
    static Field create_field_from_olap_value(const ValType& data) {
211
82.6k
        auto f = Field(PType);
212
82.6k
        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
82.6k
        } else {
224
82.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
82.6k
        }
226
82.6k
        f.template create_concrete<PType>(std::move(cpp_value));
227
82.6k
        return f;
228
82.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE4EsEES0_RKT0_
Line
Count
Source
210
22.6k
    static Field create_field_from_olap_value(const ValType& data) {
211
22.6k
        auto f = Field(PType);
212
22.6k
        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
22.6k
        } else {
224
22.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
22.6k
        }
226
22.6k
        f.template create_concrete<PType>(std::move(cpp_value));
227
22.6k
        return f;
228
22.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE5EiEES0_RKT0_
Line
Count
Source
210
204k
    static Field create_field_from_olap_value(const ValType& data) {
211
204k
        auto f = Field(PType);
212
204k
        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
204k
        } else {
224
204k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
204k
        }
226
204k
        f.template create_concrete<PType>(std::move(cpp_value));
227
204k
        return f;
228
204k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE6ElEES0_RKT0_
Line
Count
Source
210
342k
    static Field create_field_from_olap_value(const ValType& data) {
211
342k
        auto f = Field(PType);
212
342k
        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
342k
        } else {
224
342k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
342k
        }
226
342k
        f.template create_concrete<PType>(std::move(cpp_value));
227
342k
        return f;
228
342k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE7EnEES0_RKT0_
Line
Count
Source
210
34.0k
    static Field create_field_from_olap_value(const ValType& data) {
211
34.0k
        auto f = Field(PType);
212
34.0k
        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
34.0k
        } else {
224
34.0k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
34.0k
        }
226
34.0k
        f.template create_concrete<PType>(std::move(cpp_value));
227
34.0k
        return f;
228
34.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE8EfEES0_RKT0_
Line
Count
Source
210
14.0k
    static Field create_field_from_olap_value(const ValType& data) {
211
14.0k
        auto f = Field(PType);
212
14.0k
        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
14.0k
        } else {
224
14.0k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
14.0k
        }
226
14.0k
        f.template create_concrete<PType>(std::move(cpp_value));
227
14.0k
        return f;
228
14.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE9EdEES0_RKT0_
Line
Count
Source
210
19.1k
    static Field create_field_from_olap_value(const ValType& data) {
211
19.1k
        auto f = Field(PType);
212
19.1k
        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
19.1k
        } else {
224
19.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
19.1k
        }
226
19.1k
        f.template create_concrete<PType>(std::move(cpp_value));
227
19.1k
        return f;
228
19.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE15ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
35.5k
    static Field create_field_from_olap_value(const ValType& data) {
211
35.5k
        auto f = Field(PType);
212
35.5k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
35.5k
        if constexpr (is_string_type(PType)) {
214
35.5k
            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
35.5k
        f.template create_concrete<PType>(std::move(cpp_value));
227
35.5k
        return f;
228
35.5k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE11ENS_8uint24_tEEES0_RKT0_
Line
Count
Source
210
697
    static Field create_field_from_olap_value(const ValType& data) {
211
697
        auto f = Field(PType);
212
697
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
697
        } else if constexpr (is_date_or_datetime(PType)) {
216
697
            if constexpr (PType == TYPE_DATE) {
217
697
                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
697
        f.template create_concrete<PType>(std::move(cpp_value));
227
697
        return f;
228
697
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE12EmEES0_RKT0_
Line
Count
Source
210
977
    static Field create_field_from_olap_value(const ValType& data) {
211
977
        auto f = Field(PType);
212
977
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
        if constexpr (is_string_type(PType)) {
214
            cpp_value = String(data.data, data.size);
215
977
        } else if constexpr (is_date_or_datetime(PType)) {
216
            if constexpr (PType == TYPE_DATE) {
217
                cpp_value.from_olap_date(data);
218
977
            } else {
219
977
                cpp_value.from_olap_datetime(data);
220
977
            }
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
977
        f.template create_concrete<PType>(std::move(cpp_value));
227
977
        return f;
228
977
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE25EjEES0_RKT0_
Line
Count
Source
210
60.6k
    static Field create_field_from_olap_value(const ValType& data) {
211
60.6k
        auto f = Field(PType);
212
60.6k
        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
60.6k
        } else {
224
60.6k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
60.6k
        }
226
60.6k
        f.template create_concrete<PType>(std::move(cpp_value));
227
60.6k
        return f;
228
60.6k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE26EmEES0_RKT0_
Line
Count
Source
210
66.1k
    static Field create_field_from_olap_value(const ValType& data) {
211
66.1k
        auto f = Field(PType);
212
66.1k
        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
66.1k
        } else {
224
66.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
66.1k
        }
226
66.1k
        f.template create_concrete<PType>(std::move(cpp_value));
227
66.1k
        return f;
228
66.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE43ElEES0_RKT0_
Line
Count
Source
210
298
    static Field create_field_from_olap_value(const ValType& data) {
211
298
        auto f = Field(PType);
212
298
        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
298
        } else {
224
298
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
298
        }
226
298
        f.template create_concrete<PType>(std::move(cpp_value));
227
298
        return f;
228
298
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE42EmEES0_RKT0_
Line
Count
Source
210
7.06k
    static Field create_field_from_olap_value(const ValType& data) {
211
7.06k
        auto f = Field(PType);
212
7.06k
        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
7.06k
        } else {
224
7.06k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
7.06k
        }
226
7.06k
        f.template create_concrete<PType>(std::move(cpp_value));
227
7.06k
        return f;
228
7.06k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE36EjEES0_RKT0_
Line
Count
Source
210
1.03k
    static Field create_field_from_olap_value(const ValType& data) {
211
1.03k
        auto f = Field(PType);
212
1.03k
        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.03k
        } else {
224
1.03k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
1.03k
        }
226
1.03k
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.03k
        return f;
228
1.03k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE37EoEES0_RKT0_
Line
Count
Source
210
1.06k
    static Field create_field_from_olap_value(const ValType& data) {
211
1.06k
        auto f = Field(PType);
212
1.06k
        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.06k
        } else {
224
1.06k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
1.06k
        }
226
1.06k
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.06k
        return f;
228
1.06k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE44EoEES0_RKT0_
Line
Count
Source
210
877
    static Field create_field_from_olap_value(const ValType& data) {
211
877
        auto f = Field(PType);
212
877
        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
877
        } else {
224
877
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
877
        }
226
877
        f.template create_concrete<PType>(std::move(cpp_value));
227
877
        return f;
228
877
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE10ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
303k
    static Field create_field_from_olap_value(const ValType& data) {
211
303k
        auto f = Field(PType);
212
303k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
303k
        if constexpr (is_string_type(PType)) {
214
303k
            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
303k
        f.template create_concrete<PType>(std::move(cpp_value));
227
303k
        return f;
228
303k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE23ENS_9StringRefEEES0_RKT0_
Line
Count
Source
210
127k
    static Field create_field_from_olap_value(const ValType& data) {
211
127k
        auto f = Field(PType);
212
127k
        typename PrimitiveTypeTraits<PType>::CppType cpp_value;
213
127k
        if constexpr (is_string_type(PType)) {
214
127k
            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
127k
        f.template create_concrete<PType>(std::move(cpp_value));
227
127k
        return f;
228
127k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE28EiEES0_RKT0_
Line
Count
Source
210
6.91k
    static Field create_field_from_olap_value(const ValType& data) {
211
6.91k
        auto f = Field(PType);
212
6.91k
        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
6.91k
        } else {
224
6.91k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
6.91k
        }
226
6.91k
        f.template create_concrete<PType>(std::move(cpp_value));
227
6.91k
        return f;
228
6.91k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE29ElEES0_RKT0_
Line
Count
Source
210
33.1k
    static Field create_field_from_olap_value(const ValType& data) {
211
33.1k
        auto f = Field(PType);
212
33.1k
        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
33.1k
        } else {
224
33.1k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
33.1k
        }
226
33.1k
        f.template create_concrete<PType>(std::move(cpp_value));
227
33.1k
        return f;
228
33.1k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE30EnEES0_RKT0_
Line
Count
Source
210
20.0k
    static Field create_field_from_olap_value(const ValType& data) {
211
20.0k
        auto f = Field(PType);
212
20.0k
        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
20.0k
        } else {
224
20.0k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
20.0k
        }
226
20.0k
        f.template create_concrete<PType>(std::move(cpp_value));
227
20.0k
        return f;
228
20.0k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE35EN4wide7integerILm256EiEEEES0_RKT0_
Line
Count
Source
210
1.16k
    static Field create_field_from_olap_value(const ValType& data) {
211
1.16k
        auto f = Field(PType);
212
1.16k
        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.16k
        } else {
224
1.16k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
1.16k
        }
226
1.16k
        f.template create_concrete<PType>(std::move(cpp_value));
227
1.16k
        return f;
228
1.16k
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE20ENS_11decimal12_tEEES0_RKT0_
Line
Count
Source
210
429
    static Field create_field_from_olap_value(const ValType& data) {
211
429
        auto f = Field(PType);
212
429
        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
429
        } else if constexpr (is_decimalv2(PType)) {
222
429
            cpp_value = DecimalV2Value(data.integer, data.fraction);
223
        } else {
224
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
        }
226
429
        f.template create_concrete<PType>(std::move(cpp_value));
227
429
        return f;
228
429
    }
_ZN5doris5Field28create_field_from_olap_valueILNS_13PrimitiveTypeE2EhEES0_RKT0_
Line
Count
Source
210
15.7k
    static Field create_field_from_olap_value(const ValType& data) {
211
15.7k
        auto f = Field(PType);
212
15.7k
        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
15.7k
        } else {
224
15.7k
            cpp_value = typename PrimitiveTypeTraits<PType>::CppType(data);
225
15.7k
        }
226
15.7k
        f.template create_concrete<PType>(std::move(cpp_value));
227
15.7k
        return f;
228
15.7k
    }
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
37.4M
    Field& operator=(Field&& rhs) {
245
37.4M
        if (this != &rhs) {
246
37.4M
            if (type != rhs.type) {
247
35.1M
                destroy();
248
35.1M
                type = TYPE_NULL;
249
35.1M
                create(std::move(rhs));
250
35.1M
            } else {
251
2.35M
                assign(std::move(rhs));
252
2.35M
            }
253
37.4M
        }
254
37.4M
        return *this;
255
37.4M
    }
256
257
359M
    ~Field() { destroy(); }
258
259
30.1M
    PrimitiveType get_type() const { return type; }
260
    std::string get_type_name() const;
261
262
146M
    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
6.91k
    bool is_nan() const {
274
        // Keep type dispatch with the value so callers cannot reinterpret Field storage using a
275
        // mismatched PrimitiveType.
276
6.91k
        if (type == PrimitiveType::TYPE_FLOAT) {
277
40
            return std::isnan(get<TYPE_FLOAT>());
278
40
        }
279
6.87k
        if (type == PrimitiveType::TYPE_DOUBLE) {
280
40
            return std::isnan(get<TYPE_DOUBLE>());
281
40
        }
282
6.83k
        return false;
283
6.87k
    }
284
285
7.71M
    bool operator==(const Field& rhs) const {
286
7.71M
        return operator<=>(rhs) == std::strong_ordering::equal;
287
7.71M
    }
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
1.89k
    size_t operator()(const doris::Field& field) const {
348
1.89k
        if (field.is_null()) {
349
136
            return 0;
350
136
        }
351
1.76k
        std::hash<std::string_view> hasher;
352
1.76k
        return hasher(field.as_string_view());
353
1.89k
    }
354
};