Coverage Report

Created: 2026-09-30 15:42

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
2.24M
    void full_encode_ascending(const void* value, std::string* buf) const {
61
2.24M
        _full_encode_ascending(value, buf);
62
2.24M
    }
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
19.9k
    void encode_ascending(const void* value, size_t index_size, std::string* buf) const {
67
19.9k
        _encode_ascending(value, index_size, buf);
68
19.9k
    }
69
70
    // Only used for test, should delete it in the future
71
2.15k
    Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) const {
72
2.15k
        return _decode_ascending(encoded_key, index_size, cell_ptr);
73
2.15k
    }
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
2.07M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
2.07M
        UnsignedCppType unsigned_val;
97
2.07M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
2.07M
        if (IsSigned<CppType>::value) {
100
1.81M
            unsigned_val ^=
101
1.81M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
1.81M
        }
103
        // make it bigendian
104
2.07M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
2.07M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
2.07M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
173k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
173k
        UnsignedCppType unsigned_val;
97
173k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
173k
        if (IsSigned<CppType>::value) {
100
173k
            unsigned_val ^=
101
173k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
173k
        }
103
        // make it bigendian
104
173k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
173k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
173k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
1.21M
    static void full_encode_ascending(const void* value, std::string* buf) {
96
1.21M
        UnsignedCppType unsigned_val;
97
1.21M
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
1.21M
        if (IsSigned<CppType>::value) {
100
1.21M
            unsigned_val ^=
101
1.21M
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
1.21M
        }
103
        // make it bigendian
104
1.21M
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
1.21M
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
1.21M
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
63.5k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
63.5k
        UnsignedCppType unsigned_val;
97
63.5k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
63.5k
        if (IsSigned<CppType>::value) {
100
63.5k
            unsigned_val ^=
101
63.5k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
63.5k
        }
103
        // make it bigendian
104
63.5k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
63.5k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
63.5k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
49.9k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
49.9k
        UnsignedCppType unsigned_val;
97
49.9k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
49.9k
        if (IsSigned<CppType>::value) {
100
49.9k
            unsigned_val ^=
101
49.9k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
49.9k
        }
103
        // make it bigendian
104
49.9k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
49.9k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
49.9k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
51.2k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
51.2k
        UnsignedCppType unsigned_val;
97
51.2k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
51.2k
        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.2k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
51.2k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
51.2k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
60.8k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
60.8k
        UnsignedCppType unsigned_val;
97
60.8k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
60.8k
        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
60.8k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
60.8k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
60.8k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
64.9k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
64.9k
        UnsignedCppType unsigned_val;
97
64.9k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
64.9k
        if (IsSigned<CppType>::value) {
100
64.9k
            unsigned_val ^=
101
64.9k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
64.9k
        }
103
        // make it bigendian
104
64.9k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
64.9k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
64.9k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
48.8k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
48.8k
        UnsignedCppType unsigned_val;
97
48.8k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
48.8k
        if (IsSigned<CppType>::value) {
100
48.8k
            unsigned_val ^=
101
48.8k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
48.8k
        }
103
        // make it bigendian
104
48.8k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
48.8k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
48.8k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
49.4k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
49.4k
        UnsignedCppType unsigned_val;
97
49.4k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
49.4k
        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
49.4k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
49.4k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
49.4k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
755
    static void full_encode_ascending(const void* value, std::string* buf) {
96
755
        UnsignedCppType unsigned_val;
97
755
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
755
        if (IsSigned<CppType>::value) {
100
755
            unsigned_val ^=
101
755
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
755
        }
103
        // make it bigendian
104
755
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
755
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
755
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
49.7k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
49.7k
        UnsignedCppType unsigned_val;
97
49.7k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
49.7k
        if (IsSigned<CppType>::value) {
100
49.7k
            unsigned_val ^=
101
49.7k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
49.7k
        }
103
        // make it bigendian
104
49.7k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
49.7k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
49.7k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE21full_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
50.1k
            unsigned_val ^=
101
50.1k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
50.1k
        }
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_9FieldTypeE33EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
51.2k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
51.2k
        UnsignedCppType unsigned_val;
97
51.2k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
51.2k
        if (IsSigned<CppType>::value) {
100
51.2k
            unsigned_val ^=
101
51.2k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
51.2k
        }
103
        // make it bigendian
104
51.2k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
51.2k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
51.2k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
49.4k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
49.4k
        UnsignedCppType unsigned_val;
97
49.4k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
49.4k
        if (IsSigned<CppType>::value) {
100
49.4k
            unsigned_val ^=
101
49.4k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
102
49.4k
        }
103
        // make it bigendian
104
49.4k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
49.4k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
49.4k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
49.6k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
49.6k
        UnsignedCppType unsigned_val;
97
49.6k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
49.6k
        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
49.6k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
49.6k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
49.6k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
50.8k
    static void full_encode_ascending(const void* value, std::string* buf) {
96
50.8k
        UnsignedCppType unsigned_val;
97
50.8k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
50.8k
        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.8k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
50.8k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
50.8k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
95
27
    static void full_encode_ascending(const void* value, std::string* buf) {
96
27
        UnsignedCppType unsigned_val;
97
27
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
98
        // swap MSB to encode integer
99
27
        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
27
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
105
106
27
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
107
27
    }
108
109
17.5k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
17.5k
        full_encode_ascending(value, buf);
111
17.5k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
629
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
629
        full_encode_ascending(value, buf);
111
629
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
632
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
632
        full_encode_ascending(value, buf);
111
632
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
11.7k
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
11.7k
        full_encode_ascending(value, buf);
111
11.7k
    }
_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
577
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
577
        full_encode_ascending(value, buf);
111
577
    }
_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
573
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
573
        full_encode_ascending(value, buf);
111
573
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
222
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
222
        full_encode_ascending(value, buf);
111
222
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
222
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
222
        full_encode_ascending(value, buf);
111
222
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
109
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
110
370
        full_encode_ascending(value, buf);
111
370
    }
Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
112
113
22.4k
    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
22.4k
        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
22.4k
        UnsignedCppType unsigned_val;
121
22.4k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
22.4k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
22.4k
        if (IsSigned<CppType>::value) {
124
1.69k
            unsigned_val ^=
125
1.69k
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
1.69k
        }
127
22.4k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
22.4k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
22.4k
        return Status::OK();
130
22.4k
    }
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
1.15k
    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
1.15k
        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
1.15k
        UnsignedCppType unsigned_val;
121
1.15k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
1.15k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
1.15k
        if (IsSigned<CppType>::value) {
124
1.15k
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
1.15k
        }
127
1.15k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
1.15k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
1.15k
        return Status::OK();
130
1.15k
    }
_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
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
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
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_9FieldTypeE8EvE16decode_ascendingEPNS_5SliceEmPh
Line
Count
Source
113
20.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
20.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
20.5k
        UnsignedCppType unsigned_val;
121
20.5k
        memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType));
122
20.5k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
123
20.5k
        if (IsSigned<CppType>::value) {
124
0
            unsigned_val ^=
125
                    (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1));
126
0
        }
127
20.5k
        memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType));
128
20.5k
        encoded_key->remove_prefix(sizeof(UnsignedCppType));
129
20.5k
        return Status::OK();
130
20.5k
    }
_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
48.8k
    static void full_encode_ascending(const void* value, std::string* buf) {
142
48.8k
        UnsignedCppType unsigned_val;
143
48.8k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
144
        // make it bigendian
145
48.8k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
146
48.8k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
147
48.8k
    }
148
149
223
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
150
223
        full_encode_ascending(value, buf);
151
223
    }
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
49.6k
    static void full_encode_ascending(const void* value, std::string* buf) {
176
49.6k
        UnsignedCppType unsigned_val;
177
49.6k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
178
        // make it bigendian
179
49.6k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
180
49.6k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
181
49.6k
    }
182
183
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
184
370
        full_encode_ascending(value, buf);
185
370
    }
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
49.9k
    static void full_encode_ascending(const void* value, std::string* buf) {
211
49.9k
        UnsignedCppType unsigned_val;
212
49.9k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
213
        // make it bigendian
214
49.9k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
215
49.9k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
216
49.9k
    }
217
218
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
219
370
        full_encode_ascending(value, buf);
220
370
    }
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
49.4k
    static void full_encode_ascending(const void* value, std::string* buf) {
246
49.4k
        UnsignedCppType unsigned_val;
247
49.4k
        memcpy(&unsigned_val, value, sizeof(unsigned_val));
248
        // make it bigendian
249
49.4k
        unsigned_val = to_endian<std::endian::big>(unsigned_val);
250
49.4k
        buf->append((char*)&unsigned_val, sizeof(unsigned_val));
251
49.4k
    }
252
253
370
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
254
370
        full_encode_ascending(value, buf);
255
370
    }
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.6k
    static void full_encode_ascending(const void* value, std::string* buf) {
276
48.6k
        decimal12_t decimal_val;
277
48.6k
        memcpy(&decimal_val, value, sizeof(decimal12_t));
278
48.6k
        KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::full_encode_ascending(
279
48.6k
                &decimal_val.integer, buf);
280
48.6k
        KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::full_encode_ascending(&decimal_val.fraction,
281
48.6k
                                                                              buf);
282
48.6k
    } // namespace doris
283
284
24
    static void encode_ascending(const void* value, size_t index_size, std::string* buf) {
285
24
        full_encode_ascending(value, buf);
286
24
    }
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
940
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
303
940
        auto slice = reinterpret_cast<const Slice*>(value);
304
940
        buf->append(slice->get_data(), slice->get_size());
305
940
    }
306
307
    NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size,
308
423
                                                       std::string* buf) {
309
423
        const Slice* slice = (const Slice*)value;
310
423
        CHECK(index_size <= slice->size)
311
0
                << "index size is larger than char size, index=" << index_size
312
0
                << ", char=" << slice->size;
313
423
        buf->append(slice->data, index_size);
314
423
    }
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
1.91k
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
325
1.91k
        auto slice = reinterpret_cast<const Slice*>(value);
326
1.91k
        buf->append(slice->get_data(), slice->get_size());
327
1.91k
    }
328
329
    NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size,
330
555
                                                       std::string* buf) {
331
555
        const Slice* slice = (const Slice*)value;
332
555
        size_t copy_size = std::min(index_size, slice->size);
333
555
        buf->append(slice->data, copy_size);
334
555
    }
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
885
    NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) {
345
885
        auto slice = reinterpret_cast<const Slice*>(value);
346
885
        buf->append(slice->get_data(), slice->get_size());
347
885
    }
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.1k
    static UnsignedCppType sortable_float_bits(UnsignedCppType bits) {
418
97.1k
        constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1;
419
97.1k
        constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift;
420
97.1k
        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.1k
    }
_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.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
3.04k
            return bits ^ (sign_bit - 1);
422
45.5k
        } else {
423
45.5k
            return bits;
424
45.5k
        }
425
48.5k
    }
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
21
    M(OLAP_FIELD_TYPE_BOOL)                               \
451
21
    M(OLAP_FIELD_TYPE_TINYINT)                            \
452
18
    M(OLAP_FIELD_TYPE_SMALLINT)                           \
453
372k
    M(OLAP_FIELD_TYPE_INT)                                \
454
372k
    M(OLAP_FIELD_TYPE_BIGINT)                             \
455
37
    M(OLAP_FIELD_TYPE_LARGEINT)                           \
456
23
    M(OLAP_FIELD_TYPE_FLOAT)                              \
457
23
    M(OLAP_FIELD_TYPE_DOUBLE)                             \
458
21
    M(OLAP_FIELD_TYPE_DECIMAL)                            \
459
19
    M(OLAP_FIELD_TYPE_DECIMAL32)                          \
460
19
    M(OLAP_FIELD_TYPE_DECIMAL64)                          \
461
18
    M(OLAP_FIELD_TYPE_DECIMAL128I)                        \
462
18
    M(OLAP_FIELD_TYPE_DECIMAL256)                         \
463
20
    M(OLAP_FIELD_TYPE_DATE)                               \
464
21
    M(OLAP_FIELD_TYPE_DATETIME)                           \
465
23
    M(OLAP_FIELD_TYPE_DATEV2)                             \
466
25
    M(OLAP_FIELD_TYPE_DATETIMEV2)                         \
467
25
    M(OLAP_FIELD_TYPE_TIMESTAMP_NS)                       \
468
39
    M(OLAP_FIELD_TYPE_TIMESTAMPTZ)                        \
469
39
    M(OLAP_FIELD_TYPE_IPV4)                               \
470
15
    M(OLAP_FIELD_TYPE_IPV6)                               \
471
15
    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
372k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
372k
    static_assert(is_key_encodable_non_string_type(FT),
496
372k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
372k
                  "strings have their own path in RowCursor that calls "
498
372k
                  "storage_field->full_encode_ascending directly, and nested / "
499
372k
                  "aggregate types are not key-encodable");
500
372k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
372k
    coder->full_encode_ascending(&v, buf);
502
372k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE31EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
34
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
34
    static_assert(is_key_encodable_non_string_type(FT),
496
34
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
34
                  "strings have their own path in RowCursor that calls "
498
34
                  "storage_field->full_encode_ascending directly, and nested / "
499
34
                  "aggregate types are not key-encodable");
500
34
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
34
    coder->full_encode_ascending(&v, buf);
502
34
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE32EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
30
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
30
    static_assert(is_key_encodable_non_string_type(FT),
496
30
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
30
                  "strings have their own path in RowCursor that calls "
498
30
                  "storage_field->full_encode_ascending directly, and nested / "
499
30
                  "aggregate types are not key-encodable");
500
30
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
30
    coder->full_encode_ascending(&v, buf);
502
30
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE33EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
25
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
25
    static_assert(is_key_encodable_non_string_type(FT),
496
25
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
25
                  "strings have their own path in RowCursor that calls "
498
25
                  "storage_field->full_encode_ascending directly, and nested / "
499
25
                  "aggregate types are not key-encodable");
500
25
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
25
    coder->full_encode_ascending(&v, buf);
502
25
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE37EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
25
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
25
    static_assert(is_key_encodable_non_string_type(FT),
496
25
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
25
                  "strings have their own path in RowCursor that calls "
498
25
                  "storage_field->full_encode_ascending directly, and nested / "
499
25
                  "aggregate types are not key-encodable");
500
25
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
25
    coder->full_encode_ascending(&v, buf);
502
25
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE16EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
21
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
21
    static_assert(is_key_encodable_non_string_type(FT),
496
21
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
21
                  "strings have their own path in RowCursor that calls "
498
21
                  "storage_field->full_encode_ascending directly, and nested / "
499
21
                  "aggregate types are not key-encodable");
500
21
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
21
    coder->full_encode_ascending(&v, buf);
502
21
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE28EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
23
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
23
    static_assert(is_key_encodable_non_string_type(FT),
496
23
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
23
                  "strings have their own path in RowCursor that calls "
498
23
                  "storage_field->full_encode_ascending directly, and nested / "
499
23
                  "aggregate types are not key-encodable");
500
23
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
23
    coder->full_encode_ascending(&v, buf);
502
23
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE29EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
33
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
33
    static_assert(is_key_encodable_non_string_type(FT),
496
33
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
33
                  "strings have their own path in RowCursor that calls "
498
33
                  "storage_field->full_encode_ascending directly, and nested / "
499
33
                  "aggregate types are not key-encodable");
500
33
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
33
    coder->full_encode_ascending(&v, buf);
502
33
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE40EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
34
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
34
    static_assert(is_key_encodable_non_string_type(FT),
496
34
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
34
                  "strings have their own path in RowCursor that calls "
498
34
                  "storage_field->full_encode_ascending directly, and nested / "
499
34
                  "aggregate types are not key-encodable");
500
34
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
34
    coder->full_encode_ascending(&v, buf);
502
34
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE24EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
19
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
19
    static_assert(is_key_encodable_non_string_type(FT),
496
19
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
19
                  "strings have their own path in RowCursor that calls "
498
19
                  "storage_field->full_encode_ascending directly, and nested / "
499
19
                  "aggregate types are not key-encodable");
500
19
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
19
    coder->full_encode_ascending(&v, buf);
502
19
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE1EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
19
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
19
    static_assert(is_key_encodable_non_string_type(FT),
496
19
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
19
                  "strings have their own path in RowCursor that calls "
498
19
                  "storage_field->full_encode_ascending directly, and nested / "
499
19
                  "aggregate types are not key-encodable");
500
19
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
19
    coder->full_encode_ascending(&v, buf);
502
19
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE3EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
19
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
19
    static_assert(is_key_encodable_non_string_type(FT),
496
19
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
19
                  "strings have their own path in RowCursor that calls "
498
19
                  "storage_field->full_encode_ascending directly, and nested / "
499
19
                  "aggregate types are not key-encodable");
500
19
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
19
    coder->full_encode_ascending(&v, buf);
502
19
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE5EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
372k
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
372k
    static_assert(is_key_encodable_non_string_type(FT),
496
372k
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
372k
                  "strings have their own path in RowCursor that calls "
498
372k
                  "storage_field->full_encode_ascending directly, and nested / "
499
372k
                  "aggregate types are not key-encodable");
500
372k
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
372k
    coder->full_encode_ascending(&v, buf);
502
372k
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE7EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
38
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
38
    static_assert(is_key_encodable_non_string_type(FT),
496
38
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
38
                  "strings have their own path in RowCursor that calls "
498
38
                  "storage_field->full_encode_ascending directly, and nested / "
499
38
                  "aggregate types are not key-encodable");
500
38
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
38
    coder->full_encode_ascending(&v, buf);
502
38
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE9EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
19
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
19
    static_assert(is_key_encodable_non_string_type(FT),
496
19
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
19
                  "strings have their own path in RowCursor that calls "
498
19
                  "storage_field->full_encode_ascending directly, and nested / "
499
19
                  "aggregate types are not key-encodable");
500
19
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
19
    coder->full_encode_ascending(&v, buf);
502
19
}
_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_9FieldTypeE14EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
20
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
20
    static_assert(is_key_encodable_non_string_type(FT),
496
20
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
20
                  "strings have their own path in RowCursor that calls "
498
20
                  "storage_field->full_encode_ascending directly, and nested / "
499
20
                  "aggregate types are not key-encodable");
500
20
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
20
    coder->full_encode_ascending(&v, buf);
502
20
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE15EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
21
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
21
    static_assert(is_key_encodable_non_string_type(FT),
496
21
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
21
                  "strings have their own path in RowCursor that calls "
498
21
                  "storage_field->full_encode_ascending directly, and nested / "
499
21
                  "aggregate types are not key-encodable");
500
21
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
21
    coder->full_encode_ascending(&v, buf);
502
21
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE38EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
16
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
16
    static_assert(is_key_encodable_non_string_type(FT),
496
16
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
16
                  "strings have their own path in RowCursor that calls "
498
16
                  "storage_field->full_encode_ascending directly, and nested / "
499
16
                  "aggregate types are not key-encodable");
500
16
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
16
    coder->full_encode_ascending(&v, buf);
502
16
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE39EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
16
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
16
    static_assert(is_key_encodable_non_string_type(FT),
496
16
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
16
                  "strings have their own path in RowCursor that calls "
498
16
                  "storage_field->full_encode_ascending directly, and nested / "
499
16
                  "aggregate types are not key-encodable");
500
16
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
16
    coder->full_encode_ascending(&v, buf);
502
16
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE42EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
17
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
17
    static_assert(is_key_encodable_non_string_type(FT),
496
17
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
17
                  "strings have their own path in RowCursor that calls "
498
17
                  "storage_field->full_encode_ascending directly, and nested / "
499
17
                  "aggregate types are not key-encodable");
500
17
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
17
    coder->full_encode_ascending(&v, buf);
502
17
}
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE41EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
Line
Count
Source
494
19
inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) {
495
19
    static_assert(is_key_encodable_non_string_type(FT),
496
19
                  "full_encode_field_as_key is for non-string scalar keys only; "
497
19
                  "strings have their own path in RowCursor that calls "
498
19
                  "storage_field->full_encode_ascending directly, and nested / "
499
19
                  "aggregate types are not key-encodable");
500
19
    const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>());
501
19
    coder->full_encode_ascending(&v, buf);
502
19
}
503
504
} // namespace doris