Coverage Report

Created: 2026-09-30 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/storage/key_coder.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
18
#pragma once
19
20
#include <glog/logging.h>
21
#include <limits.h>
22
#include <stdint.h>
23
#include <string.h>
24
25
#include <algorithm>
26
#include <ostream>
27
#include <string>
28
#include <type_traits>
29
30
#include "absl/strings/substitute.h"
31
#include "common/status.h"
32
#include "core/data_type/primitive_type.h"
33
#include "core/data_type/storage_field_type.h"
34
#include "core/decimal12.h"
35
#include "core/extended_types.h"
36
#include "core/field.h"
37
#include "core/types.h"
38
#include "exec/common/endian.h"
39
#include "storage/olap_common.h"
40
#include "storage/storage_layout.h"
41
#include "storage/types.h"
42
#include "util/slice.h"
43
44
namespace doris {
45
46
using FullEncodeAscendingFunc = void (*)(const void* value, std::string* buf);
47
using EncodeAscendingFunc = void (*)(const void* value, size_t index_size, std::string* buf);
48
using DecodeAscendingFunc = Status (*)(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr);
49
50
// Order-preserving binary encoding for values of a particular type so that
51
// those values can be compared by memcpy their encoded bytes.
52
//
53
// To obtain instance of this class, use the `get_key_coder(FieldType)` method.
54
class KeyCoder {
55
public:
56
    template <typename TraitsType>
57
    KeyCoder(TraitsType traits);
58
59
    // encode the provided `value` into `buf`.
60
52.6M
    void full_encode_ascending(const void* value, std::string* buf) const {
61
52.6M
        _full_encode_ascending(value, buf);
62
52.6M
    }
63
64
    // similar to `full_encode_ascending`, but only encode part (the first `index_size` bytes) of the value.
65
    // only applicable to string type
66
157k
    void encode_ascending(const void* value, size_t index_size, std::string* buf) const {
67
157k
        _encode_ascending(value, index_size, buf);
68
157k
    }
69
70
    // Only used for test, should delete it in the future
71
158k
    Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) const {
72
158k
        return _decode_ascending(encoded_key, index_size, cell_ptr);
73
158k
    }
74
75
private:
76
    FullEncodeAscendingFunc _full_encode_ascending;
77
    EncodeAscendingFunc _encode_ascending;
78
    DecodeAscendingFunc _decode_ascending;
79
};
80
81
extern const KeyCoder* get_key_coder(FieldType type);
82
83
template <FieldType field_type, typename Enable = void>
84
class KeyCoderTraits {};
85
86
template <FieldType field_type>
87
class KeyCoderTraits<field_type,
88
                     typename std::enable_if<
89
                             IsIntegral<typename CppTypeTraits<field_type>::CppType>::value ||
90
                             IsDecimalNumber<typename CppTypeTraits<field_type>::CppType>>::type> {
91
public:
92
    using CppType = typename CppTypeTraits<field_type>::CppType;
93
    using UnsignedCppType = typename CppTypeTraits<field_type>::UnsignedCppType;
94
95
39.3M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
39.3M
        UnsignedCppType unsigned_val;
97
39.3M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
39.3M
        if (IsSigned<CppType>::value) {
100
35.6M
            unsigned_val ^=
101
35.6M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
35.6M
        }
103
        // make it bigendian
104
39.3M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
39.3M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
39.3M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
11.3M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
11.3M
        UnsignedCppType unsigned_val;
97
11.3M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
11.3M
        if (IsSigned<CppType>::value) {
100
11.3M
            unsigned_val ^=
101
11.3M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
11.3M
        }
103
        // make it bigendian
104
11.3M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
11.3M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
11.3M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
20.2M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
20.2M
        UnsignedCppType unsigned_val;
97
20.2M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
20.2M
        if (IsSigned<CppType>::value) {
100
20.2M
            unsigned_val ^=
101
20.2M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
20.2M
        }
103
        // make it bigendian
104
20.2M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
20.2M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
20.2M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
750k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
750k
        UnsignedCppType unsigned_val;
97
750k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
750k
        if (IsSigned<CppType>::value) {
100
750k
            unsigned_val ^=
101
750k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
750k
        }
103
        // make it bigendian
104
750k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
750k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
750k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
688k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
688k
        UnsignedCppType unsigned_val;
97
688k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
688k
        if (IsSigned<CppType>::value) {
100
688k
            unsigned_val ^=
101
688k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
688k
        }
103
        // make it bigendian
104
688k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
688k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
688k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
1.26M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
1.26M
        UnsignedCppType unsigned_val;
97
1.26M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
1.26M
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
1.26M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
1.26M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
1.26M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
1.85M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
1.85M
        UnsignedCppType unsigned_val;
97
1.85M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
1.85M
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
1.85M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
1.85M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
1.85M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
510k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
510k
        UnsignedCppType unsigned_val;
97
510k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
510k
        if (IsSigned<CppType>::value) {
100
510k
            unsigned_val ^=
101
510k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
510k
        }
103
        // make it bigendian
104
510k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
510k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
510k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
449k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
449k
        UnsignedCppType unsigned_val;
97
449k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
449k
        if (IsSigned<CppType>::value) {
100
449k
            unsigned_val ^=
101
449k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
449k
        }
103
        // make it bigendian
104
449k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
449k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
449k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
500k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
500k
        UnsignedCppType unsigned_val;
97
500k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
500k
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
500k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
500k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
500k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
9.41k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
9.41k
        UnsignedCppType unsigned_val;
97
9.41k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
9.41k
        if (IsSigned<CppType>::value) {
100
9.41k
            unsigned_val ^=
101
9.41k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
9.41k
        }
103
        // make it bigendian
104
9.41k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
9.41k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
9.41k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
61.5k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
61.5k
        UnsignedCppType unsigned_val;
97
61.5k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
61.5k
        if (IsSigned<CppType>::value) {
100
61.5k
            unsigned_val ^=
101
61.5k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
61.5k
        }
103
        // make it bigendian
104
61.5k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
61.5k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
61.5k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
54.9k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
54.9k
        UnsignedCppType unsigned_val;
97
54.9k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
54.9k
        if (IsSigned<CppType>::value) {
100
54.9k
            unsigned_val ^=
101
54.9k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
54.9k
        }
103
        // make it bigendian
104
54.9k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
54.9k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
54.9k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
1.48M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
1.48M
        UnsignedCppType unsigned_val;
97
1.48M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
1.48M
        if (IsSigned<CppType>::value) {
100
1.48M
            unsigned_val ^=
101
1.48M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
1.48M
        }
103
        // make it bigendian
104
1.48M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
1.48M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
1.48M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
50.6k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
50.6k
        UnsignedCppType unsigned_val;
97
50.6k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
50.6k
        if (IsSigned<CppType>::value) {
100
50.6k
            unsigned_val ^=
101
50.6k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
50.6k
        }
103
        // make it bigendian
104
50.6k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
50.6k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
50.6k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
50.1k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
50.1k
        UnsignedCppType unsigned_val;
97
50.1k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
50.1k
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
50.1k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
50.1k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
50.1k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
51.3k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
51.3k
        UnsignedCppType unsigned_val;
97
51.3k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
51.3k
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
51.3k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
51.3k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
51.3k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
580
    static void full_encode_ascending(const void* value, std::string* buf) {
96
580
        UnsignedCppType unsigned_val;
97
580
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
580
        if (IsSigned<CppType>::value) {
100
0
            unsigned_val ^=
101
0
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
0
        }
103
        // make it bigendian
104
580
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
580
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
580
    }
108
109
125k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
125k
        full_encode_ascending(value, buf);
111
125k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
2.54k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
2.54k
        full_encode_ascending(value, buf);
111
2.54k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
2.72k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
2.72k
        full_encode_ascending(value, buf);
111
2.72k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
89.1k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
89.1k
        full_encode_ascending(value, buf);
111
89.1k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
202
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
202
        full_encode_ascending(value, buf);
111
202
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
17.2k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
17.2k
        full_encode_ascending(value, buf);
111
17.2k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
202
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
202
        full_encode_ascending(value, buf);
111
202
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
7.01k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
7.01k
        full_encode_ascending(value, buf);
111
7.01k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
254
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
254
        full_encode_ascending(value, buf);
111
254
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
950
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
950
        full_encode_ascending(value, buf);
111
950
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
258
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
258
        full_encode_ascending(value, buf);
111
258
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
521
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
521
        full_encode_ascending(value, buf);
111
521
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
634
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
634
        full_encode_ascending(value, buf);
111
634
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
2.15k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
2.15k
        full_encode_ascending(value, buf);
111
2.15k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
499
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
499
        full_encode_ascending(value, buf);
111
499
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
452
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
452
        full_encode_ascending(value, buf);
111
452
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
449
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
449
        full_encode_ascending(value, buf);
111
449
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
59
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
59
        full_encode_ascending(value, buf);
111
59
    }
112
113
316k
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
316k
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
316k
        UnsignedCppType unsigned_val;
121
316k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
316k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
316k
        if (IsSigned<CppType>::value) {
124
16.0k
            unsigned_val ^=
125
16.0k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
16.0k
        }
127
316k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
316k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
316k
        return Status::OK();
130
316k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
15.5k
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
15.5k
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
15.5k
        UnsignedCppType unsigned_val;
121
15.5k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
15.5k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
15.5k
        if (IsSigned<CppType>::value) {
124
15.5k
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
15.5k
        }
127
15.5k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
15.5k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
15.5k
        return Status::OK();
130
15.5k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
117
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
117
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
117
        UnsignedCppType unsigned_val;
121
117
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
117
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
117
        if (IsSigned<CppType>::value) {
124
117
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
117
        }
127
117
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
117
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
117
        return Status::OK();
130
117
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
53
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
53
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
53
        UnsignedCppType unsigned_val;
121
53
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
53
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
53
        if (IsSigned<CppType>::value) {
124
53
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
53
        }
127
53
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
53
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
53
        return Status::OK();
130
53
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
53
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
53
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
53
        UnsignedCppType unsigned_val;
121
53
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
53
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
53
        if (IsSigned<CppType>::value) {
124
53
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
53
        }
127
53
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
53
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
53
        return Status::OK();
130
53
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
142k
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
142k
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
142k
        UnsignedCppType unsigned_val;
121
142k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
142k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
142k
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
142k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
142k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
142k
        return Status::OK();
130
142k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
158k
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
158k
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
158k
        UnsignedCppType unsigned_val;
121
158k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
158k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
158k
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
158k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
158k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
158k
        return Status::OK();
130
158k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
53
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
53
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
53
        UnsignedCppType unsigned_val;
121
53
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
53
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
53
        if (IsSigned<CppType>::value) {
124
53
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
53
        }
127
53
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
53
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
53
        return Status::OK();
130
53
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
53
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
53
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
53
        UnsignedCppType unsigned_val;
121
53
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
53
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
53
        if (IsSigned<CppType>::value) {
124
53
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
53
        }
127
53
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
53
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
53
        return Status::OK();
130
53
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
2
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
2
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
2
        UnsignedCppType unsigned_val;
121
2
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
2
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
2
        if (IsSigned<CppType>::value) {
124
2
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
2
        }
127
2
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
2
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
2
        return Status::OK();
130
2
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
51
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
51
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
51
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
51
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
51
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
51
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
51
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
51
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
114
        // decode_ascending only used in orinal index page, maybe should remove it in the future.
115
        // currently, we reduce the usage of this method.
116
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
117
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
118
0
                                           sizeof(UnsignedCppType), encoded_key->size);
119
0
        }
120
51
        UnsignedCppType unsigned_val;
121
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
51
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
51
        return Status::OK();
130
51
    }
Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE16decode_ascendingEPNS_5SliceEmPh
131
};
132
133
template <>
134
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATE> {
135
public:
136
    using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::CppType;
137
    using UnsignedCppType =
138
            typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::UnsignedCppType;
139
140
public:
141
450k
    static void full_encode_ascending(const void* value, std::string* buf) {
142
450k
        UnsignedCppType unsigned_val;
143
450k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
144
        // make it bigendian
145
450k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
146
450k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
147
450k
    }
148
149
250
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
150
250
        full_encode_ascending(value, buf);
151
250
    }
152
153
53
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
154
53
        if (encoded_key->size < sizeof(UnsignedCppType)) {
155
0
            return Status::InvalidArgument("Key too short, need={} vs real={}",
156
0
                                           sizeof(UnsignedCppType), encoded_key->size);
157
0
        }
158
53
        UnsignedCppType unsigned_val;
159
53
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
160
53
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
161
53
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
162
53
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
163
53
        return Status::OK();
164
53
    }
165
};
166
167
template <>
168
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATEV2> {
169
public:
170
    using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::CppType;
171
    using UnsignedCppType =
172
            typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::UnsignedCppType;
173
174
public:
175
838k
    static void full_encode_ascending(const void* value, std::string* buf) {
176
838k
        UnsignedCppType unsigned_val;
177
838k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
178
        // make it bigendian
179
838k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
180
838k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
181
838k
    }
182
183
6.05k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
184
6.05k
        full_encode_ascending(value, buf);
185
6.05k
    }
186
187
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
188
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
189
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
190
0
                                                            sizeof(UnsignedCppType),
191
0
                                                            encoded_key->size));
192
0
        }
193
51
        UnsignedCppType unsigned_val;
194
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
195
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
196
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
197
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
198
51
        return Status::OK();
199
51
    }
200
};
201
202
template <>
203
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2> {
204
public:
205
    using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::CppType;
206
    using UnsignedCppType =
207
            typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::UnsignedCppType;
208
209
public:
210
1.13M
    static void full_encode_ascending(const void* value, std::string* buf) {
211
1.13M
        UnsignedCppType unsigned_val;
212
1.13M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
213
        // make it bigendian
214
1.13M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
215
1.13M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
216
1.13M
    }
217
218
2.37k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
219
2.37k
        full_encode_ascending(value, buf);
220
2.37k
    }
221
222
51
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
223
51
        if (encoded_key->size < sizeof(UnsignedCppType)) {
224
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
225
0
                                                            sizeof(UnsignedCppType),
226
0
                                                            encoded_key->size));
227
0
        }
228
51
        UnsignedCppType unsigned_val;
229
51
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
230
51
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
231
51
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
232
51
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
233
51
        return Status::OK();
234
51
    }
235
};
236
237
template <>
238
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ> {
239
public:
240
    using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::CppType;
241
    using UnsignedCppType =
242
            typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::UnsignedCppType;
243
244
public:
245
64.0k
    static void full_encode_ascending(const void* value, std::string* buf) {
246
64.0k
        UnsignedCppType unsigned_val;
247
64.0k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
248
        // make it bigendian
249
64.0k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
250
64.0k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
251
64.0k
    }
252
253
1.78k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
254
1.78k
        full_encode_ascending(value, buf);
255
1.78k
    }
256
257
0
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
258
0
        if (encoded_key->size < sizeof(UnsignedCppType)) {
259
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
260
0
                                                            sizeof(UnsignedCppType),
261
0
                                                            encoded_key->size));
262
0
        }
263
0
        UnsignedCppType unsigned_val;
264
0
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
265
0
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
266
0
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
267
0
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
268
0
        return Status::OK();
269
0
    }
270
};
271
272
template <>
273
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DECIMAL> {
274
public:
275
48.7k
    static void full_encode_ascending(const void* value, std::string* buf) {
276
48.7k
        decimal12_t decimal_val;
277
48.7k
        memcpy(&decimal_val, value, sizeof(decimal12_t));
278
48.7k
        KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::full_encode_ascending(
279
48.7k
                &decimal_val.integer, buf);
280
48.7k
        KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::full_encode_ascending(&decimal_val.fraction,
281
48.7k
                                                                              buf);
282
48.7k
    } // namespace doris
283
284
71
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
285
71
        full_encode_ascending(value, buf);
286
71
    }
287
288
64
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
289
64
        decimal12_t decimal_val = {0, 0};
290
64
        RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::decode_ascending(
291
64
                encoded_key, sizeof(decimal_val.integer), (uint8_t*)&decimal_val.integer));
292
64
        RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::decode_ascending(
293
64
                encoded_key, sizeof(decimal_val.fraction), (uint8_t*)&decimal_val.fraction));
294
64
        memcpy(cell_ptr, &decimal_val, sizeof(decimal12_t));
295
64
        return Status::OK();
296
64
    }
297
};
298
299
template <>
300
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_CHAR> {
301
public:
302
3.32k
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
303
3.32k
        auto slice = reinterpret_cast<const Slice*>(value);
304
3.32k
        buf->append(slice->get_data(), slice->get_size());
305
3.32k
    }
306
307
    NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size,
308
1.50k
                                                       std::string* buf) {
309
1.50k
        const Slice* slice = (const Slice*)value;
310
1.50k
        CHECK(index_size <= slice->size)
311
0
                << "index size is larger than char size, index=" << index_size
312
0
                << ", char=" << slice->size;
313
1.50k
        buf->append(slice->data, index_size);
314
1.50k
    }
315
316
0
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
317
0
        throw Exception(Status::FatalError("decode_ascending is not implemented"));
318
0
    }
319
};
320
321
template <>
322
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_VARCHAR> {
323
public:
324
13.0M
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
325
13.0M
        auto slice = reinterpret_cast<const Slice*>(value);
326
13.0M
        buf->append(slice->get_data(), slice->get_size());
327
13.0M
    }
328
329
    NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size,
330
19.9k
                                                       std::string* buf) {
331
19.9k
        const Slice* slice = (const Slice*)value;
332
19.9k
        size_t copy_size = std::min(index_size, slice->size);
333
19.9k
        buf->append(slice->data, copy_size);
334
19.9k
    }
335
336
0
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
337
0
        throw Exception(Status::FatalError("decode_ascending is not implemented"));
338
0
    }
339
};
340
341
template <>
342
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_STRING> {
343
public:
344
889
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
345
889
        auto slice = reinterpret_cast<const Slice*>(value);
346
889
        buf->append(slice->get_data(), slice->get_size());
347
889
    }
348
349
    NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size,
350
49
                                                       std::string* buf) {
351
49
        const Slice* slice = (const Slice*)value;
352
49
        size_t copy_size = std::min(index_size, slice->size);
353
49
        buf->append(slice->data, copy_size);
354
49
    }
355
356
0
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
357
0
        throw Exception(Status::FatalError("decode_ascending is not implemented"));
358
0
    }
359
};
360
361
template <FieldType field_type>
362
class KeyCoderTraitsForFloat {
363
public:
364
    using CppType = typename CppTypeTraits<field_type>::CppType;
365
    using UnsignedCppType = typename CppTypeTraits<field_type>::UnsignedCppType;
366
367
97.0k
    static UnsignedCppType encode_float(CppType value) {
368
97.0k
        return sortable_float_bits(float_to_int_bits(value));
369
97.0k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12encode_floatEf
Line
Count
Source
367
48.5k
    static UnsignedCppType encode_float(CppType value) {
368
48.5k
        return sortable_float_bits(float_to_int_bits(value));
369
48.5k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12encode_floatEd
Line
Count
Source
367
48.5k
    static UnsignedCppType encode_float(CppType value) {
368
48.5k
        return sortable_float_bits(float_to_int_bits(value));
369
48.5k
    }
370
371
128
    static CppType decode_float(UnsignedCppType sortable_bits) {
372
128
        return int_bits_to_float(unsortable_float_bits(sortable_bits));
373
128
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12decode_floatEj
Line
Count
Source
371
64
    static CppType decode_float(UnsignedCppType sortable_bits) {
372
64
        return int_bits_to_float(unsortable_float_bits(sortable_bits));
373
64
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12decode_floatEm
Line
Count
Source
371
64
    static CppType decode_float(UnsignedCppType sortable_bits) {
372
64
        return int_bits_to_float(unsortable_float_bits(sortable_bits));
373
64
    }
374
375
    // -infinity < -100.0 < -1.0 < -0.0 < 0.0 < 1.0 < 100.0 < infinity < NaN
376
97.0k
    static void full_encode_ascending(const void* value, std::string* buf) {
377
97.0k
        CppType val;
378
97.0k
        std::memcpy(&val, value, sizeof(CppType));
379
97.0k
        UnsignedCppType sortable_val = encode_float(val);
380
97.0k
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
381
97.0k
                                             << (sizeof(UnsignedCppType) * 8 - 1);
382
97.0k
        sortable_val ^= sign_bit;
383
97.0k
        sortable_val = to_endian<std::endian::big>(sortable_val);
384
97.0k
        buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType));
385
97.0k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
376
48.5k
    static void full_encode_ascending(const void* value, std::string* buf) {
377
48.5k
        CppType val;
378
48.5k
        std::memcpy(&val, value, sizeof(CppType));
379
48.5k
        UnsignedCppType sortable_val = encode_float(val);
380
48.5k
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
381
48.5k
                                             << (sizeof(UnsignedCppType) * 8 - 1);
382
48.5k
        sortable_val ^= sign_bit;
383
48.5k
        sortable_val = to_endian<std::endian::big>(sortable_val);
384
48.5k
        buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType));
385
48.5k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
376
48.5k
    static void full_encode_ascending(const void* value, std::string* buf) {
377
48.5k
        CppType val;
378
48.5k
        std::memcpy(&val, value, sizeof(CppType));
379
48.5k
        UnsignedCppType sortable_val = encode_float(val);
380
48.5k
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
381
48.5k
                                             << (sizeof(UnsignedCppType) * 8 - 1);
382
48.5k
        sortable_val ^= sign_bit;
383
48.5k
        sortable_val = to_endian<std::endian::big>(sortable_val);
384
48.5k
        buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType));
385
48.5k
    }
386
387
0
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
388
0
        full_encode_ascending(value, buf);
389
0
    }
Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
390
391
128
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
392
128
        if (encoded_key->size < sizeof(UnsignedCppType)) {
393
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
394
0
                                                            sizeof(UnsignedCppType),
395
0
                                                            encoded_key->size));
396
0
        }
397
128
        UnsignedCppType sortable_val;
398
128
        std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType));
399
128
        sortable_val = to_endian<std::endian::big>(sortable_val);
400
128
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
401
128
                                             << (sizeof(UnsignedCppType) * 8 - 1);
402
128
        sortable_val ^= sign_bit;
403
128
        CppType val = decode_float(sortable_val);
404
128
        std::memcpy(cell_ptr, &val, sizeof(CppType));
405
128
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
406
128
        return Status::OK();
407
128
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
391
64
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
392
64
        if (encoded_key->size < sizeof(UnsignedCppType)) {
393
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
394
0
                                                            sizeof(UnsignedCppType),
395
0
                                                            encoded_key->size));
396
0
        }
397
64
        UnsignedCppType sortable_val;
398
64
        std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType));
399
64
        sortable_val = to_endian<std::endian::big>(sortable_val);
400
64
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
401
64
                                             << (sizeof(UnsignedCppType) * 8 - 1);
402
64
        sortable_val ^= sign_bit;
403
64
        CppType val = decode_float(sortable_val);
404
64
        std::memcpy(cell_ptr, &val, sizeof(CppType));
405
64
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
406
64
        return Status::OK();
407
64
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
391
64
    static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) {
392
64
        if (encoded_key->size < sizeof(UnsignedCppType)) {
393
0
            return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1",
394
0
                                                            sizeof(UnsignedCppType),
395
0
                                                            encoded_key->size));
396
0
        }
397
64
        UnsignedCppType sortable_val;
398
64
        std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType));
399
64
        sortable_val = to_endian<std::endian::big>(sortable_val);
400
64
        constexpr UnsignedCppType sign_bit = UnsignedCppType(1)
401
64
                                             << (sizeof(UnsignedCppType) * 8 - 1);
402
64
        sortable_val ^= sign_bit;
403
64
        CppType val = decode_float(sortable_val);
404
64
        std::memcpy(cell_ptr, &val, sizeof(CppType));
405
64
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
406
64
        return Status::OK();
407
64
    }
408
409
private:
410
97.0k
    static UnsignedCppType float_to_int_bits(CppType value) {
411
97.0k
        const CppType stored = StorageLayout<field_type>::to_storage(value);
412
97.0k
        UnsignedCppType result;
413
97.0k
        std::memcpy(&result, &stored, sizeof(CppType));
414
97.0k
        return result;
415
97.0k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17float_to_int_bitsEf
Line
Count
Source
410
48.5k
    static UnsignedCppType float_to_int_bits(CppType value) {
411
48.5k
        const CppType stored = StorageLayout<field_type>::to_storage(value);
412
48.5k
        UnsignedCppType result;
413
48.5k
        std::memcpy(&result, &stored, sizeof(CppType));
414
48.5k
        return result;
415
48.5k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17float_to_int_bitsEd
Line
Count
Source
410
48.5k
    static UnsignedCppType float_to_int_bits(CppType value) {
411
48.5k
        const CppType stored = StorageLayout<field_type>::to_storage(value);
412
48.5k
        UnsignedCppType result;
413
48.5k
        std::memcpy(&result, &stored, sizeof(CppType));
414
48.5k
        return result;
415
48.5k
    }
416
417
97.2k
    static UnsignedCppType sortable_float_bits(UnsignedCppType bits) {
418
97.2k
        constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1;
419
97.2k
        constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift;
420
97.2k
        if ((bits & sign_bit) != 0) {
421
6.03k
            return bits ^ (sign_bit - 1);
422
91.1k
        } else {
423
91.1k
            return bits;
424
91.1k
        }
425
97.2k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE19sortable_float_bitsEj
Line
Count
Source
417
48.5k
    static UnsignedCppType sortable_float_bits(UnsignedCppType bits) {
418
48.5k
        constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1;
419
48.5k
        constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift;
420
48.5k
        if ((bits & sign_bit) != 0) {
421
2.98k
            return bits ^ (sign_bit - 1);
422
45.5k
        } else {
423
45.5k
            return bits;
424
45.5k
        }
425
48.5k
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE19sortable_float_bitsEm
Line
Count
Source
417
48.6k
    static UnsignedCppType sortable_float_bits(UnsignedCppType bits) {
418
48.6k
        constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1;
419
48.6k
        constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift;
420
48.6k
        if ((bits & sign_bit) != 0) {
421
3.04k
            return bits ^ (sign_bit - 1);
422
45.5k
        } else {
423
45.5k
            return bits;
424
45.5k
        }
425
48.6k
    }
426
427
128
    static CppType int_bits_to_float(UnsignedCppType bits) {
428
128
        CppType result;
429
128
        std::memcpy(&result, &bits, sizeof(CppType));
430
128
        return result;
431
128
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17int_bits_to_floatEj
Line
Count
Source
427
64
    static CppType int_bits_to_float(UnsignedCppType bits) {
428
64
        CppType result;
429
64
        std::memcpy(&result, &bits, sizeof(CppType));
430
64
        return result;
431
64
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17int_bits_to_floatEm
Line
Count
Source
427
64
    static CppType int_bits_to_float(UnsignedCppType bits) {
428
64
        CppType result;
429
64
        std::memcpy(&result, &bits, sizeof(CppType));
430
64
        return result;
431
64
    }
432
433
128
    static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) {
434
128
        return sortable_float_bits(sortable_bits);
435
128
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21unsortable_float_bitsEj
Line
Count
Source
433
64
    static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) {
434
64
        return sortable_float_bits(sortable_bits);
435
64
    }
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21unsortable_float_bitsEm
Line
Count
Source
433
64
    static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) {
434
64
        return sortable_float_bits(sortable_bits);
435
64
    }
436
};
437
438
template <>
439
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_FLOAT>
440
        : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_FLOAT> {};
441
442
template <>
443
class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DOUBLE>
444
        : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_DOUBLE> {};
445
446
// Every FieldType that goes through KeyCoder as a non-string scalar key.
447
// Strings are handled separately because they need length / padding logic
448
// outside KeyCoder.
449
#define DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(M) \
450
11.8k
    M(OLAP_FIELD_TYPE_BOOL)                               \
451
152k
    M(OLAP_FIELD_TYPE_TINYINT)                            \
452
152k
    M(OLAP_FIELD_TYPE_SMALLINT)                           \
453
712k
    M(OLAP_FIELD_TYPE_INT)                                \
454
712k
    M(OLAP_FIELD_TYPE_BIGINT)                             \
455
35.3k
    M(OLAP_FIELD_TYPE_LARGEINT)                           \
456
13.5k
    M(OLAP_FIELD_TYPE_FLOAT)                              \
457
23
    M(OLAP_FIELD_TYPE_DOUBLE)                             \
458
55
    M(OLAP_FIELD_TYPE_DECIMAL)                            \
459
439
    M(OLAP_FIELD_TYPE_DECIMAL32)                          \
460
439
    M(OLAP_FIELD_TYPE_DECIMAL64)                          \
461
1.11k
    M(OLAP_FIELD_TYPE_DECIMAL128I)                        \
462
1.11k
    M(OLAP_FIELD_TYPE_DECIMAL256)                         \
463
2.73k
    M(OLAP_FIELD_TYPE_DATE)                               \
464
2.73k
    M(OLAP_FIELD_TYPE_DATETIME)                           \
465
286k
    M(OLAP_FIELD_TYPE_DATEV2)                             \
466
286k
    M(OLAP_FIELD_TYPE_DATETIMEV2)                         \
467
6.46k
    M(OLAP_FIELD_TYPE_TIMESTAMP_NS)                       \
468
8.48k
    M(OLAP_FIELD_TYPE_TIMESTAMPTZ)                        \
469
8.48k
    M(OLAP_FIELD_TYPE_IPV4)                               \
470
195
    M(OLAP_FIELD_TYPE_IPV6)                               \
471
381
    M(OLAP_FIELD_TYPE_UUID)
472
473
// True for exactly the FieldTypes listed in
474
// DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES. Strings (CHAR/VARCHAR/STRING/
475
// VARBINARY) have their own short-key code path in row_cursor.cpp that calls
476
// storage_field->full_encode_ascending directly, and nested/aggregate types
477
// (ARRAY/MAP/STRUCT/VARIANT/HLL/BITMAP/JSONB/QUANTILE_STATE/AGG_STATE) are not
478
// key-encodable at all -- both groups must never reach the helpers below.
479
0
constexpr bool is_key_encodable_non_string_type(FieldType ft) {
480
0
    switch (ft) {
481
0
#define DORIS_KEY_ENCODABLE_CASE(FT) \
482
0
    case FieldType::FT:              \
483
0
        return true;
484
0
        DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(DORIS_KEY_ENCODABLE_CASE)
485
0
#undef DORIS_KEY_ENCODABLE_CASE
486
0
    default:
487
0
        return false;
488
0
    }
489
0
}
490
491
// Convert a Field value to its StorageValue (via StorageLayout)
492
// and full-encode it as a byte-comparable ascending key via KeyCoder.
493
template <FieldType FT>
494
1.23M
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
1.23M
    static_assert(is_key_encodable_non_string_type(FT),
496
1.23M
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
1.23M
                  "strings have their own path in RowCursor that calls "
498
1.23M
                  "storage_field->full_encode_ascending directly, and nested / "
499
1.23M
                  "aggregate types are not key-encodable");
500
1.23M
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
1.23M
    coder->full_encode_ascending(&v, buf);
502
1.23M
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE24EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
11.8k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
11.8k
    static_assert(is_key_encodable_non_string_type(FT),
496
11.8k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
11.8k
                  "strings have their own path in RowCursor that calls "
498
11.8k
                  "storage_field->full_encode_ascending directly, and nested / "
499
11.8k
                  "aggregate types are not key-encodable");
500
11.8k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
11.8k
    coder->full_encode_ascending(&v, buf);
502
11.8k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE1EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
152k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
152k
    static_assert(is_key_encodable_non_string_type(FT),
496
152k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
152k
                  "strings have their own path in RowCursor that calls "
498
152k
                  "storage_field->full_encode_ascending directly, and nested / "
499
152k
                  "aggregate types are not key-encodable");
500
152k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
152k
    coder->full_encode_ascending(&v, buf);
502
152k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE3EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
5.50k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
5.50k
    static_assert(is_key_encodable_non_string_type(FT),
496
5.50k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
5.50k
                  "strings have their own path in RowCursor that calls "
498
5.50k
                  "storage_field->full_encode_ascending directly, and nested / "
499
5.50k
                  "aggregate types are not key-encodable");
500
5.50k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
5.50k
    coder->full_encode_ascending(&v, buf);
502
5.50k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE5EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
711k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
711k
    static_assert(is_key_encodable_non_string_type(FT),
496
711k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
711k
                  "strings have their own path in RowCursor that calls "
498
711k
                  "storage_field->full_encode_ascending directly, and nested / "
499
711k
                  "aggregate types are not key-encodable");
500
711k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
711k
    coder->full_encode_ascending(&v, buf);
502
711k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE7EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
35.3k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
35.3k
    static_assert(is_key_encodable_non_string_type(FT),
496
35.3k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
35.3k
                  "strings have their own path in RowCursor that calls "
498
35.3k
                  "storage_field->full_encode_ascending directly, and nested / "
499
35.3k
                  "aggregate types are not key-encodable");
500
35.3k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
35.3k
    coder->full_encode_ascending(&v, buf);
502
35.3k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE9EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
13.5k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
13.5k
    static_assert(is_key_encodable_non_string_type(FT),
496
13.5k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
13.5k
                  "strings have their own path in RowCursor that calls "
498
13.5k
                  "storage_field->full_encode_ascending directly, and nested / "
499
13.5k
                  "aggregate types are not key-encodable");
500
13.5k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
13.5k
    coder->full_encode_ascending(&v, buf);
502
13.5k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE10EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
28
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
28
    static_assert(is_key_encodable_non_string_type(FT),
496
28
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
28
                  "strings have their own path in RowCursor that calls "
498
28
                  "storage_field->full_encode_ascending directly, and nested / "
499
28
                  "aggregate types are not key-encodable");
500
28
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
28
    coder->full_encode_ascending(&v, buf);
502
28
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE11EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
26
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
26
    static_assert(is_key_encodable_non_string_type(FT),
496
26
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
26
                  "strings have their own path in RowCursor that calls "
498
26
                  "storage_field->full_encode_ascending directly, and nested / "
499
26
                  "aggregate types are not key-encodable");
500
26
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
26
    coder->full_encode_ascending(&v, buf);
502
26
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE16EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
58
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
58
    static_assert(is_key_encodable_non_string_type(FT),
496
58
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
58
                  "strings have their own path in RowCursor that calls "
498
58
                  "storage_field->full_encode_ascending directly, and nested / "
499
58
                  "aggregate types are not key-encodable");
500
58
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
58
    coder->full_encode_ascending(&v, buf);
502
58
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE31EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
454
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
454
    static_assert(is_key_encodable_non_string_type(FT),
496
454
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
454
                  "strings have their own path in RowCursor that calls "
498
454
                  "storage_field->full_encode_ascending directly, and nested / "
499
454
                  "aggregate types are not key-encodable");
500
454
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
454
    coder->full_encode_ascending(&v, buf);
502
454
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE32EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
397
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
397
    static_assert(is_key_encodable_non_string_type(FT),
496
397
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
397
                  "strings have their own path in RowCursor that calls "
498
397
                  "storage_field->full_encode_ascending directly, and nested / "
499
397
                  "aggregate types are not key-encodable");
500
397
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
397
    coder->full_encode_ascending(&v, buf);
502
397
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE33EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
1.12k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
1.12k
    static_assert(is_key_encodable_non_string_type(FT),
496
1.12k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
1.12k
                  "strings have their own path in RowCursor that calls "
498
1.12k
                  "storage_field->full_encode_ascending directly, and nested / "
499
1.12k
                  "aggregate types are not key-encodable");
500
1.12k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
1.12k
    coder->full_encode_ascending(&v, buf);
502
1.12k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE37EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
781
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
781
    static_assert(is_key_encodable_non_string_type(FT),
496
781
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
781
                  "strings have their own path in RowCursor that calls "
498
781
                  "storage_field->full_encode_ascending directly, and nested / "
499
781
                  "aggregate types are not key-encodable");
500
781
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
781
    coder->full_encode_ascending(&v, buf);
502
781
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE14EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
2.73k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
2.73k
    static_assert(is_key_encodable_non_string_type(FT),
496
2.73k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
2.73k
                  "strings have their own path in RowCursor that calls "
498
2.73k
                  "storage_field->full_encode_ascending directly, and nested / "
499
2.73k
                  "aggregate types are not key-encodable");
500
2.73k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
2.73k
    coder->full_encode_ascending(&v, buf);
502
2.73k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE15EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
526
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
526
    static_assert(is_key_encodable_non_string_type(FT),
496
526
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
526
                  "strings have their own path in RowCursor that calls "
498
526
                  "storage_field->full_encode_ascending directly, and nested / "
499
526
                  "aggregate types are not key-encodable");
500
526
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
526
    coder->full_encode_ascending(&v, buf);
502
526
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE28EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
286k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
286k
    static_assert(is_key_encodable_non_string_type(FT),
496
286k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
286k
                  "strings have their own path in RowCursor that calls "
498
286k
                  "storage_field->full_encode_ascending directly, and nested / "
499
286k
                  "aggregate types are not key-encodable");
500
286k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
286k
    coder->full_encode_ascending(&v, buf);
502
286k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE29EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
6.46k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
6.46k
    static_assert(is_key_encodable_non_string_type(FT),
496
6.46k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
6.46k
                  "strings have their own path in RowCursor that calls "
498
6.46k
                  "storage_field->full_encode_ascending directly, and nested / "
499
6.46k
                  "aggregate types are not key-encodable");
500
6.46k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
6.46k
    coder->full_encode_ascending(&v, buf);
502
6.46k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE41EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
344
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
344
    static_assert(is_key_encodable_non_string_type(FT),
496
344
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
344
                  "strings have their own path in RowCursor that calls "
498
344
                  "storage_field->full_encode_ascending directly, and nested / "
499
344
                  "aggregate types are not key-encodable");
500
344
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
344
    coder->full_encode_ascending(&v, buf);
502
344
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE40EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
8.46k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
8.46k
    static_assert(is_key_encodable_non_string_type(FT),
496
8.46k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
8.46k
                  "strings have their own path in RowCursor that calls "
498
8.46k
                  "storage_field->full_encode_ascending directly, and nested / "
499
8.46k
                  "aggregate types are not key-encodable");
500
8.46k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
8.46k
    coder->full_encode_ascending(&v, buf);
502
8.46k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE38EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
186
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
186
    static_assert(is_key_encodable_non_string_type(FT),
496
186
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
186
                  "strings have their own path in RowCursor that calls "
498
186
                  "storage_field->full_encode_ascending directly, and nested / "
499
186
                  "aggregate types are not key-encodable");
500
186
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
186
    coder->full_encode_ascending(&v, buf);
502
186
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE39EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
165
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
165
    static_assert(is_key_encodable_non_string_type(FT),
496
165
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
165
                  "strings have their own path in RowCursor that calls "
498
165
                  "storage_field->full_encode_ascending directly, and nested / "
499
165
                  "aggregate types are not key-encodable");
500
165
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
165
    coder->full_encode_ascending(&v, buf);
502
165
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE42EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
383
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
383
    static_assert(is_key_encodable_non_string_type(FT),
496
383
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
383
                  "strings have their own path in RowCursor that calls "
498
383
                  "storage_field->full_encode_ascending directly, and nested / "
499
383
                  "aggregate types are not key-encodable");
500
383
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
383
    coder->full_encode_ascending(&v, buf);
502
383
}
503
504
} // namespace doris