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/decimal12.h" |
34 | | #include "core/extended_types.h" |
35 | | #include "core/field.h" |
36 | | #include "core/types.h" |
37 | | #include "exec/common/endian.h" |
38 | | #include "storage/olap_common.h" |
39 | | #include "storage/types.h" |
40 | | #include "util/slice.h" |
41 | | |
42 | | namespace doris { |
43 | | |
44 | | // `char_len` is only used by CHAR — the declared CHAR(N) column length. |
45 | | // CHAR full-encoding zero-pads the slice up to char_len so the encoded |
46 | | // bytes are the fixed-width canonical form used by PK and segment min/max |
47 | | // indexes. All other types ignore this argument. |
48 | | using FullEncodeAscendingFunc = void (*)(const void* value, std::string* buf, size_t char_len); |
49 | | using EncodeAscendingFunc = void (*)(const void* value, size_t index_size, std::string* buf); |
50 | | using DecodeAscendingFunc = Status (*)(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr); |
51 | | |
52 | | // Order-preserving binary encoding for values of a particular type so that |
53 | | // those values can be compared by memcpy their encoded bytes. |
54 | | // |
55 | | // To obtain instance of this class, use the `get_key_coder(FieldType)` method. |
56 | | class KeyCoder { |
57 | | public: |
58 | | template <typename TraitsType> |
59 | | KeyCoder(TraitsType traits); |
60 | | |
61 | | // encode the provided `value` into `buf`. |
62 | 999k | void full_encode_ascending(const void* value, std::string* buf, size_t char_len = 0) const { |
63 | 999k | _full_encode_ascending(value, buf, char_len); |
64 | 999k | } |
65 | | |
66 | | // similar to `full_encode_ascending`, but only encode part (the first `index_size` bytes) of the value. |
67 | | // only applicable to string type |
68 | 12.0k | void encode_ascending(const void* value, size_t index_size, std::string* buf) const { |
69 | 12.0k | _encode_ascending(value, index_size, buf); |
70 | 12.0k | } |
71 | | |
72 | | // Only used for test, should delete it in the future |
73 | 2.02k | Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) const { |
74 | 2.02k | return _decode_ascending(encoded_key, index_size, cell_ptr); |
75 | 2.02k | } |
76 | | |
77 | | private: |
78 | | FullEncodeAscendingFunc _full_encode_ascending; |
79 | | EncodeAscendingFunc _encode_ascending; |
80 | | DecodeAscendingFunc _decode_ascending; |
81 | | }; |
82 | | |
83 | | extern const KeyCoder* get_key_coder(FieldType type); |
84 | | |
85 | | template <FieldType field_type, typename Enable = void> |
86 | | class KeyCoderTraits {}; |
87 | | |
88 | | template <FieldType field_type> |
89 | | class KeyCoderTraits<field_type, |
90 | | typename std::enable_if< |
91 | | IsIntegral<typename CppTypeTraits<field_type>::CppType>::value || |
92 | | IsDecimalNumber<typename CppTypeTraits<field_type>::CppType>>::type> { |
93 | | public: |
94 | | using CppType = typename CppTypeTraits<field_type>::CppType; |
95 | | using UnsignedCppType = typename CppTypeTraits<field_type>::UnsignedCppType; |
96 | | |
97 | 1.05M | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
98 | 1.05M | UnsignedCppType unsigned_val; |
99 | 1.05M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
100 | | // swap MSB to encode integer |
101 | 1.05M | if (IsSigned<CppType>::value) { |
102 | 1.00M | unsigned_val ^= |
103 | 1.00M | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); |
104 | 1.00M | } |
105 | | // make it bigendian |
106 | 1.05M | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
107 | | |
108 | 1.05M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
109 | 1.05M | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 31.0k | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 31.0k | UnsignedCppType unsigned_val; | 99 | 31.0k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 31.0k | if (IsSigned<CppType>::value) { | 102 | 31.0k | unsigned_val ^= | 103 | 31.0k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 31.0k | } | 105 | | // make it bigendian | 106 | 31.0k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 31.0k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 31.0k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 976k | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 976k | UnsignedCppType unsigned_val; | 99 | 976k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 976k | if (IsSigned<CppType>::value) { | 102 | 976k | unsigned_val ^= | 103 | 976k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 976k | } | 105 | | // make it bigendian | 106 | 976k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 976k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 976k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 43.7k | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 43.7k | UnsignedCppType unsigned_val; | 99 | 43.7k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 43.7k | if (IsSigned<CppType>::value) { | 102 | 0 | unsigned_val ^= | 103 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 0 | } | 105 | | // make it bigendian | 106 | 43.7k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 43.7k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 43.7k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 315 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 315 | UnsignedCppType unsigned_val; | 99 | 315 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 315 | if (IsSigned<CppType>::value) { | 102 | 315 | unsigned_val ^= | 103 | 315 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 315 | } | 105 | | // make it bigendian | 106 | 315 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 315 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 315 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 324 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 324 | UnsignedCppType unsigned_val; | 99 | 324 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 324 | if (IsSigned<CppType>::value) { | 102 | 324 | unsigned_val ^= | 103 | 324 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 324 | } | 105 | | // make it bigendian | 106 | 324 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 324 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 324 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 257 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 257 | UnsignedCppType unsigned_val; | 99 | 257 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 257 | if (IsSigned<CppType>::value) { | 102 | 0 | unsigned_val ^= | 103 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 0 | } | 105 | | // make it bigendian | 106 | 257 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 257 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 257 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 288 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 288 | UnsignedCppType unsigned_val; | 99 | 288 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 288 | if (IsSigned<CppType>::value) { | 102 | 288 | unsigned_val ^= | 103 | 288 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 288 | } | 105 | | // make it bigendian | 106 | 288 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 288 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 288 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 307 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 307 | UnsignedCppType unsigned_val; | 99 | 307 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 307 | if (IsSigned<CppType>::value) { | 102 | 307 | unsigned_val ^= | 103 | 307 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 307 | } | 105 | | // make it bigendian | 106 | 307 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 307 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 307 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 81 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 81 | UnsignedCppType unsigned_val; | 99 | 81 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 81 | if (IsSigned<CppType>::value) { | 102 | 0 | unsigned_val ^= | 103 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 0 | } | 105 | | // make it bigendian | 106 | 81 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 81 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 81 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 95 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 95 | UnsignedCppType unsigned_val; | 99 | 95 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 95 | if (IsSigned<CppType>::value) { | 102 | 95 | unsigned_val ^= | 103 | 95 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 95 | } | 105 | | // make it bigendian | 106 | 95 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 95 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 95 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 91 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 91 | UnsignedCppType unsigned_val; | 99 | 91 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 91 | if (IsSigned<CppType>::value) { | 102 | 91 | unsigned_val ^= | 103 | 91 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 91 | } | 105 | | // make it bigendian | 106 | 91 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 91 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 91 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 86 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 86 | UnsignedCppType unsigned_val; | 99 | 86 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 86 | if (IsSigned<CppType>::value) { | 102 | 86 | unsigned_val ^= | 103 | 86 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 86 | } | 105 | | // make it bigendian | 106 | 86 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 86 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 86 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 86 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 86 | UnsignedCppType unsigned_val; | 99 | 86 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 86 | if (IsSigned<CppType>::value) { | 102 | 86 | unsigned_val ^= | 103 | 86 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 86 | } | 105 | | // make it bigendian | 106 | 86 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 86 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 86 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 77 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 77 | UnsignedCppType unsigned_val; | 99 | 77 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 77 | if (IsSigned<CppType>::value) { | 102 | 0 | unsigned_val ^= | 103 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 0 | } | 105 | | // make it bigendian | 106 | 77 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 77 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 77 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 97 | 77 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 98 | 77 | UnsignedCppType unsigned_val; | 99 | 77 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 100 | | // swap MSB to encode integer | 101 | 77 | if (IsSigned<CppType>::value) { | 102 | 0 | unsigned_val ^= | 103 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 104 | 0 | } | 105 | | // make it bigendian | 106 | 77 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 107 | | | 108 | 77 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 109 | 77 | } |
|
110 | | |
111 | 11.5k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
112 | 11.5k | full_encode_ascending(value, buf, /*char_len=*/0); |
113 | 11.5k | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 209 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 209 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 209 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 212 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 212 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 212 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 10.1k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 10.1k | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 10.1k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 202 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 202 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 202 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 203 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 203 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 203 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 202 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 202 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 202 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 203 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 203 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 203 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 111 | 202 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 112 | 202 | full_encode_ascending(value, buf, /*char_len=*/0); | 113 | 202 | } |
Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
114 | | |
115 | 22.1k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. |
117 | | // currently, we reduce the usage of this method. |
118 | 22.1k | if (encoded_key->size < sizeof(UnsignedCppType)) { |
119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", |
120 | 0 | sizeof(UnsignedCppType), encoded_key->size); |
121 | 0 | } |
122 | 22.1k | UnsignedCppType unsigned_val; |
123 | 22.1k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
124 | 22.1k | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
125 | 22.1k | if (IsSigned<CppType>::value) { |
126 | 1.56k | unsigned_val ^= |
127 | 1.56k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); |
128 | 1.56k | } |
129 | 22.1k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
130 | 22.1k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
131 | 22.1k | return Status::OK(); |
132 | 22.1k | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 1.02k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 1.02k | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 1.02k | UnsignedCppType unsigned_val; | 123 | 1.02k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 1.02k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 1.02k | if (IsSigned<CppType>::value) { | 126 | 1.02k | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 1.02k | } | 129 | 1.02k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 1.02k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 1.02k | return Status::OK(); | 132 | 1.02k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 117 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 117 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 117 | UnsignedCppType unsigned_val; | 123 | 117 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 117 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 117 | if (IsSigned<CppType>::value) { | 126 | 117 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 117 | } | 129 | 117 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 117 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 117 | return Status::OK(); | 132 | 117 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 20.4k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 20.4k | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 20.4k | UnsignedCppType unsigned_val; | 123 | 20.4k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 20.4k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 20.4k | if (IsSigned<CppType>::value) { | 126 | 0 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 0 | } | 129 | 20.4k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 20.4k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 20.4k | return Status::OK(); | 132 | 20.4k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 53 | UnsignedCppType unsigned_val; | 123 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 53 | if (IsSigned<CppType>::value) { | 126 | 53 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 53 | } | 129 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 53 | return Status::OK(); | 132 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 53 | UnsignedCppType unsigned_val; | 123 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 53 | if (IsSigned<CppType>::value) { | 126 | 53 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 53 | } | 129 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 53 | return Status::OK(); | 132 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 53 | UnsignedCppType unsigned_val; | 123 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 53 | if (IsSigned<CppType>::value) { | 126 | 0 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 0 | } | 129 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 53 | return Status::OK(); | 132 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 53 | UnsignedCppType unsigned_val; | 123 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 53 | if (IsSigned<CppType>::value) { | 126 | 53 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 53 | } | 129 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 53 | return Status::OK(); | 132 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 53 | UnsignedCppType unsigned_val; | 123 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 53 | if (IsSigned<CppType>::value) { | 126 | 53 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 53 | } | 129 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 53 | return Status::OK(); | 132 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 0 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 0 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 51 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 51 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 51 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 51 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 51 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 51 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 51 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 51 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 0 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 0 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 115 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 116 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 117 | | // currently, we reduce the usage of this method. | 118 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 119 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 120 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 121 | 0 | } | 122 | 51 | UnsignedCppType unsigned_val; | 123 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 124 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 125 | 51 | if (IsSigned<CppType>::value) { | 126 | 0 | unsigned_val ^= | 127 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 128 | 0 | } | 129 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 130 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 131 | 51 | return Status::OK(); | 132 | 51 | } |
|
133 | | }; |
134 | | |
135 | | template <> |
136 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATE> { |
137 | | public: |
138 | | using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::CppType; |
139 | | using UnsignedCppType = |
140 | | typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::UnsignedCppType; |
141 | | |
142 | | public: |
143 | 293 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
144 | 293 | UnsignedCppType unsigned_val; |
145 | 293 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
146 | | // make it bigendian |
147 | 293 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
148 | 293 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
149 | 293 | } |
150 | | |
151 | 203 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
152 | 203 | full_encode_ascending(value, buf, /*char_len=*/0); |
153 | 203 | } |
154 | | |
155 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
156 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
157 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", |
158 | 0 | sizeof(UnsignedCppType), encoded_key->size); |
159 | 0 | } |
160 | 53 | UnsignedCppType unsigned_val; |
161 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
162 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
163 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
164 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
165 | 53 | return Status::OK(); |
166 | 53 | } |
167 | | }; |
168 | | |
169 | | template <> |
170 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATEV2> { |
171 | | public: |
172 | | using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::CppType; |
173 | | using UnsignedCppType = |
174 | | typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::UnsignedCppType; |
175 | | |
176 | | public: |
177 | 86 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
178 | 86 | UnsignedCppType unsigned_val; |
179 | 86 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
180 | | // make it bigendian |
181 | 86 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
182 | 86 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
183 | 86 | } |
184 | | |
185 | 0 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
186 | 0 | full_encode_ascending(value, buf, /*char_len=*/0); |
187 | 0 | } |
188 | | |
189 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
190 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
191 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
192 | 0 | sizeof(UnsignedCppType), |
193 | 0 | encoded_key->size)); |
194 | 0 | } |
195 | 51 | UnsignedCppType unsigned_val; |
196 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
197 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
198 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
199 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
200 | 51 | return Status::OK(); |
201 | 51 | } |
202 | | }; |
203 | | |
204 | | template <> |
205 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2> { |
206 | | public: |
207 | | using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::CppType; |
208 | | using UnsignedCppType = |
209 | | typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::UnsignedCppType; |
210 | | |
211 | | public: |
212 | 94 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
213 | 94 | UnsignedCppType unsigned_val; |
214 | 94 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
215 | | // make it bigendian |
216 | 94 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
217 | 94 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
218 | 94 | } |
219 | | |
220 | 0 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
221 | 0 | full_encode_ascending(value, buf, /*char_len=*/0); |
222 | 0 | } |
223 | | |
224 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
225 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
226 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
227 | 0 | sizeof(UnsignedCppType), |
228 | 0 | encoded_key->size)); |
229 | 0 | } |
230 | 51 | UnsignedCppType unsigned_val; |
231 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
232 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
233 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
234 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
235 | 51 | return Status::OK(); |
236 | 51 | } |
237 | | }; |
238 | | |
239 | | template <> |
240 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ> { |
241 | | public: |
242 | | using CppType = typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::CppType; |
243 | | using UnsignedCppType = |
244 | | typename CppTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::UnsignedCppType; |
245 | | |
246 | | public: |
247 | 54 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
248 | 54 | UnsignedCppType unsigned_val; |
249 | 54 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
250 | | // make it bigendian |
251 | 54 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
252 | 54 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
253 | 54 | } |
254 | | |
255 | 0 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
256 | 0 | full_encode_ascending(value, buf, /*char_len=*/0); |
257 | 0 | } |
258 | | |
259 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
260 | 0 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
261 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
262 | 0 | sizeof(UnsignedCppType), |
263 | 0 | encoded_key->size)); |
264 | 0 | } |
265 | 0 | UnsignedCppType unsigned_val; |
266 | 0 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
267 | 0 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
268 | 0 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
269 | 0 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
270 | 0 | return Status::OK(); |
271 | 0 | } |
272 | | }; |
273 | | |
274 | | template <> |
275 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DECIMAL> { |
276 | | public: |
277 | 100 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
278 | 100 | decimal12_t decimal_val; |
279 | 100 | memcpy(&decimal_val, value, sizeof(decimal12_t)); |
280 | 100 | KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::full_encode_ascending( |
281 | 100 | &decimal_val.integer, buf, /*char_len=*/0); |
282 | 100 | KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::full_encode_ascending(&decimal_val.fraction, |
283 | 100 | buf, /*char_len=*/0); |
284 | 100 | } // namespace doris |
285 | | |
286 | 4 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
287 | 4 | full_encode_ascending(value, buf, /*char_len=*/0); |
288 | 4 | } |
289 | | |
290 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
291 | 64 | decimal12_t decimal_val = {0, 0}; |
292 | 64 | RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::decode_ascending( |
293 | 64 | encoded_key, sizeof(decimal_val.integer), (uint8_t*)&decimal_val.integer)); |
294 | 64 | RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::decode_ascending( |
295 | 64 | encoded_key, sizeof(decimal_val.fraction), (uint8_t*)&decimal_val.fraction)); |
296 | 64 | memcpy(cell_ptr, &decimal_val, sizeof(decimal12_t)); |
297 | 64 | return Status::OK(); |
298 | 64 | } |
299 | | }; |
300 | | |
301 | | template <> |
302 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_CHAR> { |
303 | | public: |
304 | | // Pad to char_len so the encoded bytes are the canonical fixed-width |
305 | | // form used by short-key / PK / segment min-max indexes. |
306 | | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf, |
307 | 57 | size_t char_len) { |
308 | 57 | const Slice* slice = reinterpret_cast<const Slice*>(value); |
309 | 57 | size_t copy_size = std::min(slice->size, char_len); |
310 | 57 | buf->append(slice->data, copy_size); |
311 | 57 | if (copy_size < char_len) { |
312 | 1 | buf->append(char_len - copy_size, '\0'); |
313 | 1 | } |
314 | 57 | } |
315 | | |
316 | | // For CHAR, FE guarantees column.length() == column.index_length(), so |
317 | | // the short-key encoding is just the full encoding with the same pad |
318 | | // length. Forward to keep the pad logic in one place. |
319 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
320 | 53 | std::string* buf) { |
321 | 53 | full_encode_ascending(value, buf, index_size); |
322 | 53 | } |
323 | | |
324 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
325 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
326 | 0 | } |
327 | | }; |
328 | | |
329 | | template <> |
330 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_VARCHAR> { |
331 | | public: |
332 | | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf, |
333 | 621 | size_t /*char_len*/) { |
334 | 621 | auto slice = reinterpret_cast<const Slice*>(value); |
335 | 621 | buf->append(slice->get_data(), slice->get_size()); |
336 | 621 | } |
337 | | |
338 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
339 | 185 | std::string* buf) { |
340 | 185 | const Slice* slice = (const Slice*)value; |
341 | 185 | size_t copy_size = std::min(index_size, slice->size); |
342 | 185 | buf->append(slice->data, copy_size); |
343 | 185 | } |
344 | | |
345 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
346 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
347 | 0 | } |
348 | | }; |
349 | | |
350 | | template <> |
351 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_STRING> { |
352 | | public: |
353 | | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf, |
354 | 885 | size_t /*char_len*/) { |
355 | 885 | auto slice = reinterpret_cast<const Slice*>(value); |
356 | 885 | buf->append(slice->get_data(), slice->get_size()); |
357 | 885 | } |
358 | | |
359 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
360 | 49 | std::string* buf) { |
361 | 49 | const Slice* slice = (const Slice*)value; |
362 | 49 | size_t copy_size = std::min(index_size, slice->size); |
363 | 49 | buf->append(slice->data, copy_size); |
364 | 49 | } |
365 | | |
366 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
367 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
368 | 0 | } |
369 | | }; |
370 | | |
371 | | template <FieldType field_type> |
372 | | class KeyCoderTraitsForFloat { |
373 | | public: |
374 | | using CppType = typename CppTypeTraits<field_type>::CppType; |
375 | | using UnsignedCppType = typename CppTypeTraits<field_type>::UnsignedCppType; |
376 | | |
377 | 589 | static UnsignedCppType encode_float(CppType value) { |
378 | 589 | return sortable_float_bits(float_to_int_bits(value)); |
379 | 589 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12encode_floatEf Line | Count | Source | 377 | 297 | static UnsignedCppType encode_float(CppType value) { | 378 | 297 | return sortable_float_bits(float_to_int_bits(value)); | 379 | 297 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12encode_floatEd Line | Count | Source | 377 | 292 | static UnsignedCppType encode_float(CppType value) { | 378 | 292 | return sortable_float_bits(float_to_int_bits(value)); | 379 | 292 | } |
|
380 | | |
381 | 128 | static CppType decode_float(UnsignedCppType sortable_bits) { |
382 | 128 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); |
383 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12decode_floatEj Line | Count | Source | 381 | 64 | static CppType decode_float(UnsignedCppType sortable_bits) { | 382 | 64 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); | 383 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12decode_floatEm Line | Count | Source | 381 | 64 | static CppType decode_float(UnsignedCppType sortable_bits) { | 382 | 64 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); | 383 | 64 | } |
|
384 | | |
385 | | // -infinity < -100.0 < -1.0 < -0.0 < 0.0 < 1.0 < 100.0 < infinity < NaN |
386 | 589 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { |
387 | 589 | CppType val; |
388 | 589 | std::memcpy(&val, value, sizeof(CppType)); |
389 | 589 | UnsignedCppType sortable_val = encode_float(val); |
390 | 589 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) |
391 | 589 | << (sizeof(UnsignedCppType) * 8 - 1); |
392 | 589 | sortable_val ^= sign_bit; |
393 | 589 | sortable_val = to_endian<std::endian::big>(sortable_val); |
394 | 589 | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); |
395 | 589 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 386 | 297 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 387 | 297 | CppType val; | 388 | 297 | std::memcpy(&val, value, sizeof(CppType)); | 389 | 297 | UnsignedCppType sortable_val = encode_float(val); | 390 | 297 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 391 | 297 | << (sizeof(UnsignedCppType) * 8 - 1); | 392 | 297 | sortable_val ^= sign_bit; | 393 | 297 | sortable_val = to_endian<std::endian::big>(sortable_val); | 394 | 297 | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); | 395 | 297 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm Line | Count | Source | 386 | 292 | static void full_encode_ascending(const void* value, std::string* buf, size_t /*char_len*/) { | 387 | 292 | CppType val; | 388 | 292 | std::memcpy(&val, value, sizeof(CppType)); | 389 | 292 | UnsignedCppType sortable_val = encode_float(val); | 390 | 292 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 391 | 292 | << (sizeof(UnsignedCppType) * 8 - 1); | 392 | 292 | sortable_val ^= sign_bit; | 393 | 292 | sortable_val = to_endian<std::endian::big>(sortable_val); | 394 | 292 | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); | 395 | 292 | } |
|
396 | | |
397 | 0 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
398 | 0 | full_encode_ascending(value, buf, /*char_len=*/0); |
399 | 0 | } Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
400 | | |
401 | 128 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
402 | 128 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
403 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
404 | 0 | sizeof(UnsignedCppType), |
405 | 0 | encoded_key->size)); |
406 | 0 | } |
407 | 128 | UnsignedCppType sortable_val; |
408 | 128 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); |
409 | 128 | sortable_val = to_endian<std::endian::big>(sortable_val); |
410 | 128 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) |
411 | 128 | << (sizeof(UnsignedCppType) * 8 - 1); |
412 | 128 | sortable_val ^= sign_bit; |
413 | 128 | CppType val = decode_float(sortable_val); |
414 | 128 | std::memcpy(cell_ptr, &val, sizeof(CppType)); |
415 | 128 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
416 | 128 | return Status::OK(); |
417 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 401 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 402 | 64 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 403 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", | 404 | 0 | sizeof(UnsignedCppType), | 405 | 0 | encoded_key->size)); | 406 | 0 | } | 407 | 64 | UnsignedCppType sortable_val; | 408 | 64 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); | 409 | 64 | sortable_val = to_endian<std::endian::big>(sortable_val); | 410 | 64 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 411 | 64 | << (sizeof(UnsignedCppType) * 8 - 1); | 412 | 64 | sortable_val ^= sign_bit; | 413 | 64 | CppType val = decode_float(sortable_val); | 414 | 64 | std::memcpy(cell_ptr, &val, sizeof(CppType)); | 415 | 64 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 416 | 64 | return Status::OK(); | 417 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 401 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 402 | 64 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 403 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", | 404 | 0 | sizeof(UnsignedCppType), | 405 | 0 | encoded_key->size)); | 406 | 0 | } | 407 | 64 | UnsignedCppType sortable_val; | 408 | 64 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); | 409 | 64 | sortable_val = to_endian<std::endian::big>(sortable_val); | 410 | 64 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 411 | 64 | << (sizeof(UnsignedCppType) * 8 - 1); | 412 | 64 | sortable_val ^= sign_bit; | 413 | 64 | CppType val = decode_float(sortable_val); | 414 | 64 | std::memcpy(cell_ptr, &val, sizeof(CppType)); | 415 | 64 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 416 | 64 | return Status::OK(); | 417 | 64 | } |
|
418 | | |
419 | | private: |
420 | 589 | static UnsignedCppType float_to_int_bits(CppType value) { |
421 | 589 | if (std::isnan(value)) { |
422 | 49 | if constexpr (std::is_same_v<CppType, float>) { |
423 | 24 | return 0x7FC00000U; |
424 | 25 | } else { |
425 | 25 | return 0x7FF8000000000000ULL; |
426 | 25 | } |
427 | 49 | } |
428 | | |
429 | 0 | UnsignedCppType result; |
430 | 589 | std::memcpy(&result, &value, sizeof(CppType)); |
431 | 589 | return result; |
432 | 589 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17float_to_int_bitsEf Line | Count | Source | 420 | 297 | static UnsignedCppType float_to_int_bits(CppType value) { | 421 | 297 | if (std::isnan(value)) { | 422 | 24 | if constexpr (std::is_same_v<CppType, float>) { | 423 | 24 | return 0x7FC00000U; | 424 | | } else { | 425 | | return 0x7FF8000000000000ULL; | 426 | | } | 427 | 24 | } | 428 | | | 429 | 0 | UnsignedCppType result; | 430 | 297 | std::memcpy(&result, &value, sizeof(CppType)); | 431 | 297 | return result; | 432 | 297 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17float_to_int_bitsEd Line | Count | Source | 420 | 292 | static UnsignedCppType float_to_int_bits(CppType value) { | 421 | 292 | if (std::isnan(value)) { | 422 | | if constexpr (std::is_same_v<CppType, float>) { | 423 | | return 0x7FC00000U; | 424 | 25 | } else { | 425 | 25 | return 0x7FF8000000000000ULL; | 426 | 25 | } | 427 | 25 | } | 428 | | | 429 | 0 | UnsignedCppType result; | 430 | 292 | std::memcpy(&result, &value, sizeof(CppType)); | 431 | 292 | return result; | 432 | 292 | } |
|
433 | | |
434 | 717 | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { |
435 | 717 | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; |
436 | 717 | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; |
437 | 717 | if ((bits & sign_bit) != 0) { |
438 | 212 | return bits ^ (sign_bit - 1); |
439 | 505 | } else { |
440 | 505 | return bits; |
441 | 505 | } |
442 | 717 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE19sortable_float_bitsEj Line | Count | Source | 434 | 361 | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { | 435 | 361 | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; | 436 | 361 | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; | 437 | 361 | if ((bits & sign_bit) != 0) { | 438 | 106 | return bits ^ (sign_bit - 1); | 439 | 255 | } else { | 440 | 255 | return bits; | 441 | 255 | } | 442 | 361 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE19sortable_float_bitsEm Line | Count | Source | 434 | 356 | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { | 435 | 356 | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; | 436 | 356 | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; | 437 | 356 | if ((bits & sign_bit) != 0) { | 438 | 106 | return bits ^ (sign_bit - 1); | 439 | 250 | } else { | 440 | 250 | return bits; | 441 | 250 | } | 442 | 356 | } |
|
443 | | |
444 | 128 | static CppType int_bits_to_float(UnsignedCppType bits) { |
445 | 128 | CppType result; |
446 | 128 | std::memcpy(&result, &bits, sizeof(CppType)); |
447 | 128 | return result; |
448 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17int_bits_to_floatEj Line | Count | Source | 444 | 64 | static CppType int_bits_to_float(UnsignedCppType bits) { | 445 | 64 | CppType result; | 446 | 64 | std::memcpy(&result, &bits, sizeof(CppType)); | 447 | 64 | return result; | 448 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17int_bits_to_floatEm Line | Count | Source | 444 | 64 | static CppType int_bits_to_float(UnsignedCppType bits) { | 445 | 64 | CppType result; | 446 | 64 | std::memcpy(&result, &bits, sizeof(CppType)); | 447 | 64 | return result; | 448 | 64 | } |
|
449 | | |
450 | 128 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { |
451 | 128 | return sortable_float_bits(sortable_bits); |
452 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21unsortable_float_bitsEj Line | Count | Source | 450 | 64 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { | 451 | 64 | return sortable_float_bits(sortable_bits); | 452 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21unsortable_float_bitsEm Line | Count | Source | 450 | 64 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { | 451 | 64 | return sortable_float_bits(sortable_bits); | 452 | 64 | } |
|
453 | | }; |
454 | | |
455 | | template <> |
456 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_FLOAT> |
457 | | : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_FLOAT> {}; |
458 | | |
459 | | template <> |
460 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DOUBLE> |
461 | | : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_DOUBLE> {}; |
462 | | |
463 | | // X-macro listing every (FieldType, PrimitiveType) pair that goes through KeyCoder |
464 | | // as a non-string scalar key. Strings are handled separately because they need |
465 | | // length / padding logic outside KeyCoder. Each entry: M(FT_suffix, PT_suffix). |
466 | | #define DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(M) \ |
467 | 18 | M(OLAP_FIELD_TYPE_BOOL, TYPE_BOOLEAN) \ |
468 | 18 | M(OLAP_FIELD_TYPE_TINYINT, TYPE_TINYINT) \ |
469 | 18 | M(OLAP_FIELD_TYPE_SMALLINT, TYPE_SMALLINT) \ |
470 | 322k | M(OLAP_FIELD_TYPE_INT, TYPE_INT) \ |
471 | 322k | M(OLAP_FIELD_TYPE_BIGINT, TYPE_BIGINT) \ |
472 | 20 | M(OLAP_FIELD_TYPE_LARGEINT, TYPE_LARGEINT) \ |
473 | 23 | M(OLAP_FIELD_TYPE_FLOAT, TYPE_FLOAT) \ |
474 | 23 | M(OLAP_FIELD_TYPE_DOUBLE, TYPE_DOUBLE) \ |
475 | 18 | M(OLAP_FIELD_TYPE_DECIMAL, TYPE_DECIMALV2) \ |
476 | 19 | M(OLAP_FIELD_TYPE_DECIMAL32, TYPE_DECIMAL32) \ |
477 | 19 | M(OLAP_FIELD_TYPE_DECIMAL64, TYPE_DECIMAL64) \ |
478 | 18 | M(OLAP_FIELD_TYPE_DECIMAL128I, TYPE_DECIMAL128I) \ |
479 | 18 | M(OLAP_FIELD_TYPE_DECIMAL256, TYPE_DECIMAL256) \ |
480 | 20 | M(OLAP_FIELD_TYPE_DATE, TYPE_DATE) \ |
481 | 21 | M(OLAP_FIELD_TYPE_DATETIME, TYPE_DATETIME) \ |
482 | 21 | M(OLAP_FIELD_TYPE_DATEV2, TYPE_DATEV2) \ |
483 | 22 | M(OLAP_FIELD_TYPE_DATETIMEV2, TYPE_DATETIMEV2) \ |
484 | 39 | M(OLAP_FIELD_TYPE_TIMESTAMPTZ, TYPE_TIMESTAMPTZ) \ |
485 | 39 | M(OLAP_FIELD_TYPE_IPV4, TYPE_IPV4) \ |
486 | 15 | M(OLAP_FIELD_TYPE_IPV6, TYPE_IPV6) |
487 | | |
488 | | // True for exactly the PrimitiveTypes listed in |
489 | | // DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES. Strings (CHAR/VARCHAR/STRING/ |
490 | | // VARBINARY) have their own short-key code path in row_cursor.cpp that calls |
491 | | // storage_field->full_encode_ascending directly, and nested/aggregate types |
492 | | // (ARRAY/MAP/STRUCT/VARIANT/HLL/BITMAP/JSONB/QUANTILE_STATE/AGG_STATE) are not |
493 | | // key-encodable at all -- both groups must never reach the helpers below. |
494 | 0 | constexpr bool is_key_encodable_non_string_type(PrimitiveType pt) { |
495 | 0 | switch (pt) { |
496 | 0 | #define DORIS_KEY_ENCODABLE_CASE(FT, PT) \ |
497 | 0 | case PrimitiveType::PT: \ |
498 | 0 | return true; |
499 | 0 | DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(DORIS_KEY_ENCODABLE_CASE) |
500 | 0 | #undef DORIS_KEY_ENCODABLE_CASE |
501 | 0 | default: |
502 | 0 | return false; |
503 | 0 | } |
504 | 0 | } |
505 | | |
506 | | // Convert a Field value to its storage representation (via PrimitiveTypeConvertor) |
507 | | // and full-encode it as a byte-comparable ascending key via KeyCoder. |
508 | | template <PrimitiveType PT> |
509 | 323k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { |
510 | 323k | static_assert(is_key_encodable_non_string_type(PT), |
511 | 323k | "full_encode_field_as_key is for non-string scalar keys only; " |
512 | 323k | "strings have their own path in RowCursor that calls " |
513 | 323k | "storage_field->full_encode_ascending directly, and nested / " |
514 | 323k | "aggregate types are not key-encodable"); |
515 | 323k | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); |
516 | 323k | coder->full_encode_ascending(&v, buf); |
517 | 323k | } _ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE28EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 34 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 34 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 34 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 34 | "strings have their own path in RowCursor that calls " | 513 | 34 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 34 | "aggregate types are not key-encodable"); | 515 | 34 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 34 | coder->full_encode_ascending(&v, buf); | 517 | 34 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE29EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 30 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 30 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 30 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 30 | "strings have their own path in RowCursor that calls " | 513 | 30 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 30 | "aggregate types are not key-encodable"); | 515 | 30 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 30 | coder->full_encode_ascending(&v, buf); | 517 | 30 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE30EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 25 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 25 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 25 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 25 | "strings have their own path in RowCursor that calls " | 513 | 25 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 25 | "aggregate types are not key-encodable"); | 515 | 25 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 25 | coder->full_encode_ascending(&v, buf); | 517 | 25 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE35EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 25 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 25 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 25 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 25 | "strings have their own path in RowCursor that calls " | 513 | 25 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 25 | "aggregate types are not key-encodable"); | 515 | 25 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 25 | coder->full_encode_ascending(&v, buf); | 517 | 25 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE20EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 21 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 21 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 21 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 21 | "strings have their own path in RowCursor that calls " | 513 | 21 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 21 | "aggregate types are not key-encodable"); | 515 | 21 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 21 | coder->full_encode_ascending(&v, buf); | 517 | 21 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE25EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 20 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 20 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 20 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 20 | "strings have their own path in RowCursor that calls " | 513 | 20 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 20 | "aggregate types are not key-encodable"); | 515 | 20 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 20 | coder->full_encode_ascending(&v, buf); | 517 | 20 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE26EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 30 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 30 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 30 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 30 | "strings have their own path in RowCursor that calls " | 513 | 30 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 30 | "aggregate types are not key-encodable"); | 515 | 30 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 30 | coder->full_encode_ascending(&v, buf); | 517 | 30 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE42EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 34 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 34 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 34 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 34 | "strings have their own path in RowCursor that calls " | 513 | 34 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 34 | "aggregate types are not key-encodable"); | 515 | 34 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 34 | coder->full_encode_ascending(&v, buf); | 517 | 34 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE2EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 16 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 16 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 16 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 16 | "strings have their own path in RowCursor that calls " | 513 | 16 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 16 | "aggregate types are not key-encodable"); | 515 | 16 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 16 | coder->full_encode_ascending(&v, buf); | 517 | 16 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE3EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 19 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 19 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 19 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 19 | "strings have their own path in RowCursor that calls " | 513 | 19 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 19 | "aggregate types are not key-encodable"); | 515 | 19 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 19 | coder->full_encode_ascending(&v, buf); | 517 | 19 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE4EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 19 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 19 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 19 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 19 | "strings have their own path in RowCursor that calls " | 513 | 19 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 19 | "aggregate types are not key-encodable"); | 515 | 19 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 19 | coder->full_encode_ascending(&v, buf); | 517 | 19 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE5EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 322k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 322k | static_assert(is_key_encodable_non_string_type(PT), | 511 | 322k | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 322k | "strings have their own path in RowCursor that calls " | 513 | 322k | "storage_field->full_encode_ascending directly, and nested / " | 514 | 322k | "aggregate types are not key-encodable"); | 515 | 322k | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 322k | coder->full_encode_ascending(&v, buf); | 517 | 322k | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE6EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 21 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 21 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 21 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 21 | "strings have their own path in RowCursor that calls " | 513 | 21 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 21 | "aggregate types are not key-encodable"); | 515 | 21 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 21 | coder->full_encode_ascending(&v, buf); | 517 | 21 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE7EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 19 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 19 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 19 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 19 | "strings have their own path in RowCursor that calls " | 513 | 19 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 19 | "aggregate types are not key-encodable"); | 515 | 19 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 19 | coder->full_encode_ascending(&v, buf); | 517 | 19 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE8EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 28 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 28 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 28 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 28 | "strings have their own path in RowCursor that calls " | 513 | 28 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 28 | "aggregate types are not key-encodable"); | 515 | 28 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 28 | coder->full_encode_ascending(&v, buf); | 517 | 28 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE9EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 23 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 23 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 23 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 23 | "strings have their own path in RowCursor that calls " | 513 | 23 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 23 | "aggregate types are not key-encodable"); | 515 | 23 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 23 | coder->full_encode_ascending(&v, buf); | 517 | 23 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE11EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 20 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 20 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 20 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 20 | "strings have their own path in RowCursor that calls " | 513 | 20 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 20 | "aggregate types are not key-encodable"); | 515 | 20 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 20 | coder->full_encode_ascending(&v, buf); | 517 | 20 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE12EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 21 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 21 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 21 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 21 | "strings have their own path in RowCursor that calls " | 513 | 21 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 21 | "aggregate types are not key-encodable"); | 515 | 21 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 21 | coder->full_encode_ascending(&v, buf); | 517 | 21 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE36EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 16 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 16 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 16 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 16 | "strings have their own path in RowCursor that calls " | 513 | 16 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 16 | "aggregate types are not key-encodable"); | 515 | 16 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 16 | coder->full_encode_ascending(&v, buf); | 517 | 16 | } |
_ZN5doris24full_encode_field_as_keyILNS_13PrimitiveTypeE37EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 509 | 16 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 510 | 16 | static_assert(is_key_encodable_non_string_type(PT), | 511 | 16 | "full_encode_field_as_key is for non-string scalar keys only; " | 512 | 16 | "strings have their own path in RowCursor that calls " | 513 | 16 | "storage_field->full_encode_ascending directly, and nested / " | 514 | 16 | "aggregate types are not key-encodable"); | 515 | 16 | auto v = PrimitiveTypeConvertor<PT>::to_storage_field_type(f.get<PT>()); | 516 | 16 | coder->full_encode_ascending(&v, buf); | 517 | 16 | } |
|
518 | | |
519 | | } // namespace doris |