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 | 24.9M | void full_encode_ascending(const void* value, std::string* buf) const { |
61 | 24.9M | _full_encode_ascending(value, buf); |
62 | 24.9M | } |
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 | 29.3k | void encode_ascending(const void* value, size_t index_size, std::string* buf) const { |
67 | 29.3k | _encode_ascending(value, index_size, buf); |
68 | 29.3k | } |
69 | | |
70 | | // Only used for test, should delete it in the future |
71 | 165k | Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) const { |
72 | 165k | return _decode_ascending(encoded_key, index_size, cell_ptr); |
73 | 165k | } |
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< |
88 | | field_type, |
89 | | typename std::enable_if< |
90 | | IsIntegral<typename StorageTypeTraits<field_type>::StorageType>::value || |
91 | | IsDecimalNumber<typename StorageTypeTraits<field_type>::StorageType>>::type> { |
92 | | public: |
93 | | using CppType = typename StorageTypeTraits<field_type>::StorageType; |
94 | | using UnsignedCppType = typename StorageTypeTraits<field_type>::UnsignedStorageType; |
95 | | |
96 | 41.9M | static void full_encode_ascending(const void* value, std::string* buf) { |
97 | 41.9M | UnsignedCppType unsigned_val; |
98 | 41.9M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
99 | | // swap MSB to encode integer |
100 | 41.9M | if (IsSigned<CppType>::value) { |
101 | 38.3M | unsigned_val ^= |
102 | 38.3M | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); |
103 | 38.3M | } |
104 | | // make it bigendian |
105 | 41.9M | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
106 | | |
107 | 41.9M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
108 | 41.9M | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 12.6M | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 12.6M | UnsignedCppType unsigned_val; | 98 | 12.6M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 12.6M | if (IsSigned<CppType>::value) { | 101 | 12.6M | unsigned_val ^= | 102 | 12.6M | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 12.6M | } | 104 | | // make it bigendian | 105 | 12.6M | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 12.6M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 12.6M | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 21.5M | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 21.5M | UnsignedCppType unsigned_val; | 98 | 21.5M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 21.5M | if (IsSigned<CppType>::value) { | 101 | 21.5M | unsigned_val ^= | 102 | 21.5M | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 21.5M | } | 104 | | // make it bigendian | 105 | 21.5M | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 21.5M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 21.5M | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 749k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 749k | UnsignedCppType unsigned_val; | 98 | 749k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 749k | if (IsSigned<CppType>::value) { | 101 | 749k | unsigned_val ^= | 102 | 749k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 749k | } | 104 | | // make it bigendian | 105 | 749k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 749k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 749k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 669k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 669k | UnsignedCppType unsigned_val; | 98 | 669k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 669k | if (IsSigned<CppType>::value) { | 101 | 669k | unsigned_val ^= | 102 | 669k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 669k | } | 104 | | // make it bigendian | 105 | 669k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 669k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 669k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 1.27M | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 1.27M | UnsignedCppType unsigned_val; | 98 | 1.27M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 1.27M | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 1.27M | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 1.27M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 1.27M | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 1.80M | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 1.80M | UnsignedCppType unsigned_val; | 98 | 1.80M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 1.80M | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 1.80M | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 1.80M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 1.80M | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 510k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 510k | UnsignedCppType unsigned_val; | 98 | 510k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 510k | if (IsSigned<CppType>::value) { | 101 | 510k | unsigned_val ^= | 102 | 510k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 510k | } | 104 | | // make it bigendian | 105 | 510k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 510k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 510k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 448k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 448k | UnsignedCppType unsigned_val; | 98 | 448k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 448k | if (IsSigned<CppType>::value) { | 101 | 448k | unsigned_val ^= | 102 | 448k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 448k | } | 104 | | // make it bigendian | 105 | 448k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 448k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 448k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 502k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 502k | UnsignedCppType unsigned_val; | 98 | 502k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 502k | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 502k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 502k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 502k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 9.40k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 9.40k | UnsignedCppType unsigned_val; | 98 | 9.40k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 9.40k | if (IsSigned<CppType>::value) { | 101 | 9.40k | unsigned_val ^= | 102 | 9.40k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 9.40k | } | 104 | | // make it bigendian | 105 | 9.40k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 9.40k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 9.40k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 61.5k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 61.5k | UnsignedCppType unsigned_val; | 98 | 61.5k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 61.5k | if (IsSigned<CppType>::value) { | 101 | 61.5k | unsigned_val ^= | 102 | 61.5k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 61.5k | } | 104 | | // make it bigendian | 105 | 61.5k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 61.5k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 61.5k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 55.1k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 55.1k | UnsignedCppType unsigned_val; | 98 | 55.1k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 55.1k | if (IsSigned<CppType>::value) { | 101 | 55.1k | unsigned_val ^= | 102 | 55.1k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 55.1k | } | 104 | | // make it bigendian | 105 | 55.1k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 55.1k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 55.1k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 1.48M | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 1.48M | UnsignedCppType unsigned_val; | 98 | 1.48M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 1.48M | if (IsSigned<CppType>::value) { | 101 | 1.48M | unsigned_val ^= | 102 | 1.48M | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 1.48M | } | 104 | | // make it bigendian | 105 | 1.48M | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 1.48M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 1.48M | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 50.6k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 50.6k | UnsignedCppType unsigned_val; | 98 | 50.6k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 50.6k | if (IsSigned<CppType>::value) { | 101 | 50.6k | unsigned_val ^= | 102 | 50.6k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 50.6k | } | 104 | | // make it bigendian | 105 | 50.6k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 50.6k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 50.6k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 50.1k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 50.1k | UnsignedCppType unsigned_val; | 98 | 50.1k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 50.1k | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 50.1k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 50.1k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 50.1k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 51.3k | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 51.3k | UnsignedCppType unsigned_val; | 98 | 51.3k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 51.3k | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 51.3k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 51.3k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 51.3k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 96 | 924 | static void full_encode_ascending(const void* value, std::string* buf) { | 97 | 924 | UnsignedCppType unsigned_val; | 98 | 924 | memcpy(&unsigned_val, value, sizeof(unsigned_val)); | 99 | | // swap MSB to encode integer | 100 | 924 | if (IsSigned<CppType>::value) { | 101 | 0 | unsigned_val ^= | 102 | 0 | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 103 | 0 | } | 104 | | // make it bigendian | 105 | 924 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 106 | | | 107 | 924 | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); | 108 | 924 | } |
|
109 | | |
110 | 129k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
111 | 129k | full_encode_ascending(value, buf); |
112 | 129k | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 2.52k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 2.52k | full_encode_ascending(value, buf); | 112 | 2.52k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 2.62k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 2.62k | full_encode_ascending(value, buf); | 112 | 2.62k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 92.9k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 92.9k | full_encode_ascending(value, buf); | 112 | 92.9k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 202 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 202 | full_encode_ascending(value, buf); | 112 | 202 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 17.6k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 17.6k | full_encode_ascending(value, buf); | 112 | 17.6k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 202 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 202 | full_encode_ascending(value, buf); | 112 | 202 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 7.33k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 7.33k | full_encode_ascending(value, buf); | 112 | 7.33k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 252 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 252 | full_encode_ascending(value, buf); | 112 | 252 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 956 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 956 | full_encode_ascending(value, buf); | 112 | 956 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 257 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 257 | full_encode_ascending(value, buf); | 112 | 257 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 521 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 521 | full_encode_ascending(value, buf); | 112 | 521 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 632 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 632 | full_encode_ascending(value, buf); | 112 | 632 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 2.15k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 2.15k | full_encode_ascending(value, buf); | 112 | 2.15k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 499 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 499 | full_encode_ascending(value, buf); | 112 | 499 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 452 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 452 | full_encode_ascending(value, buf); | 112 | 452 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 449 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 449 | full_encode_ascending(value, buf); | 112 | 449 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 110 | 59 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { | 111 | 59 | full_encode_ascending(value, buf); | 112 | 59 | } |
|
113 | | |
114 | 439k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. |
116 | | // currently, we reduce the usage of this method. |
117 | 439k | if (encoded_key->size < sizeof(UnsignedCppType)) { |
118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", |
119 | 0 | sizeof(UnsignedCppType), encoded_key->size); |
120 | 0 | } |
121 | 439k | UnsignedCppType unsigned_val; |
122 | 439k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
123 | 439k | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
124 | 439k | if (IsSigned<CppType>::value) { |
125 | 32.9k | unsigned_val ^= |
126 | 32.9k | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); |
127 | 32.9k | } |
128 | 439k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
129 | 439k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
130 | 439k | return Status::OK(); |
131 | 439k | } _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE7EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 32.4k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 32.4k | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 32.4k | UnsignedCppType unsigned_val; | 122 | 32.4k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 32.4k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 32.4k | if (IsSigned<CppType>::value) { | 125 | 32.4k | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 32.4k | } | 128 | 32.4k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 32.4k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 32.4k | return Status::OK(); | 131 | 32.4k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE5EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 117 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 117 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 117 | UnsignedCppType unsigned_val; | 122 | 117 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 117 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 117 | if (IsSigned<CppType>::value) { | 125 | 117 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 117 | } | 128 | 117 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 117 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 117 | return Status::OK(); | 131 | 117 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE1EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 53 | UnsignedCppType unsigned_val; | 122 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 53 | if (IsSigned<CppType>::value) { | 125 | 53 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 53 | } | 128 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 53 | return Status::OK(); | 131 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE3EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 53 | UnsignedCppType unsigned_val; | 122 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 53 | if (IsSigned<CppType>::value) { | 125 | 53 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 53 | } | 128 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 53 | return Status::OK(); | 131 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE6EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 132k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 132k | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 132k | UnsignedCppType unsigned_val; | 122 | 132k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 132k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 132k | if (IsSigned<CppType>::value) { | 125 | 0 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 0 | } | 128 | 132k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 132k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 132k | return Status::OK(); | 131 | 132k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE8EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 273k | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 273k | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 273k | UnsignedCppType unsigned_val; | 122 | 273k | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 273k | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 273k | if (IsSigned<CppType>::value) { | 125 | 0 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 0 | } | 128 | 273k | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 273k | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 273k | return Status::OK(); | 131 | 273k | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE9EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 53 | UnsignedCppType unsigned_val; | 122 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 53 | if (IsSigned<CppType>::value) { | 125 | 53 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 53 | } | 128 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 53 | return Status::OK(); | 131 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE15EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 53 | UnsignedCppType unsigned_val; | 122 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 53 | if (IsSigned<CppType>::value) { | 125 | 53 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 53 | } | 128 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 53 | return Status::OK(); | 131 | 53 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE24EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 0 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 0 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE41EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 2 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 2 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 2 | UnsignedCppType unsigned_val; | 122 | 2 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 2 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 2 | if (IsSigned<CppType>::value) { | 125 | 2 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 2 | } | 128 | 2 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 2 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 2 | return Status::OK(); | 131 | 2 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE31EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 51 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 51 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE32EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 51 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 51 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE33EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 51 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 51 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE37EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 51 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 51 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE38EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 0 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 0 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
_ZN5doris14KeyCoderTraitsILNS_9FieldTypeE39EvE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 114 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 115 | | // decode_ascending only used in orinal index page, maybe should remove it in the future. | 116 | | // currently, we reduce the usage of this method. | 117 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 118 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", | 119 | 0 | sizeof(UnsignedCppType), encoded_key->size); | 120 | 0 | } | 121 | 51 | UnsignedCppType unsigned_val; | 122 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); | 123 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); | 124 | 51 | if (IsSigned<CppType>::value) { | 125 | 0 | unsigned_val ^= | 126 | | (static_cast<UnsignedCppType>(1) << (sizeof(UnsignedCppType) * CHAR_BIT - 1)); | 127 | 0 | } | 128 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); | 129 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 130 | 51 | return Status::OK(); | 131 | 51 | } |
Unexecuted instantiation: _ZN5doris14KeyCoderTraitsILNS_9FieldTypeE42EvE16decode_ascendingEPNS_5SliceEmPh |
132 | | }; |
133 | | |
134 | | template <> |
135 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATE> { |
136 | | public: |
137 | | using CppType = typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::StorageType; |
138 | | using UnsignedCppType = |
139 | | typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATE>::UnsignedStorageType; |
140 | | |
141 | | public: |
142 | 451k | static void full_encode_ascending(const void* value, std::string* buf) { |
143 | 451k | UnsignedCppType unsigned_val; |
144 | 451k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
145 | | // make it bigendian |
146 | 451k | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
147 | 451k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
148 | 451k | } |
149 | | |
150 | 251 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
151 | 251 | full_encode_ascending(value, buf); |
152 | 251 | } |
153 | | |
154 | 53 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
155 | 53 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
156 | 0 | return Status::InvalidArgument("Key too short, need={} vs real={}", |
157 | 0 | sizeof(UnsignedCppType), encoded_key->size); |
158 | 0 | } |
159 | 53 | UnsignedCppType unsigned_val; |
160 | 53 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
161 | 53 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
162 | 53 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
163 | 53 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
164 | 53 | return Status::OK(); |
165 | 53 | } |
166 | | }; |
167 | | |
168 | | template <> |
169 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATEV2> { |
170 | | public: |
171 | | using CppType = typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::StorageType; |
172 | | using UnsignedCppType = |
173 | | typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATEV2>::UnsignedStorageType; |
174 | | |
175 | | public: |
176 | 824k | static void full_encode_ascending(const void* value, std::string* buf) { |
177 | 824k | UnsignedCppType unsigned_val; |
178 | 824k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
179 | | // make it bigendian |
180 | 824k | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
181 | 824k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
182 | 824k | } |
183 | | |
184 | 6.01k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
185 | 6.01k | full_encode_ascending(value, buf); |
186 | 6.01k | } |
187 | | |
188 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
189 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
190 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
191 | 0 | sizeof(UnsignedCppType), |
192 | 0 | encoded_key->size)); |
193 | 0 | } |
194 | 51 | UnsignedCppType unsigned_val; |
195 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
196 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
197 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
198 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
199 | 51 | return Status::OK(); |
200 | 51 | } |
201 | | }; |
202 | | |
203 | | template <> |
204 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2> { |
205 | | public: |
206 | | using CppType = typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::StorageType; |
207 | | using UnsignedCppType = |
208 | | typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_DATETIMEV2>::UnsignedStorageType; |
209 | | |
210 | | public: |
211 | 1.14M | static void full_encode_ascending(const void* value, std::string* buf) { |
212 | 1.14M | UnsignedCppType unsigned_val; |
213 | 1.14M | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
214 | | // make it bigendian |
215 | 1.14M | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
216 | 1.14M | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
217 | 1.14M | } |
218 | | |
219 | 2.33k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
220 | 2.33k | full_encode_ascending(value, buf); |
221 | 2.33k | } |
222 | | |
223 | 51 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
224 | 51 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
225 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
226 | 0 | sizeof(UnsignedCppType), |
227 | 0 | encoded_key->size)); |
228 | 0 | } |
229 | 51 | UnsignedCppType unsigned_val; |
230 | 51 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
231 | 51 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
232 | 51 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
233 | 51 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
234 | 51 | return Status::OK(); |
235 | 51 | } |
236 | | }; |
237 | | |
238 | | template <> |
239 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ> { |
240 | | public: |
241 | | using CppType = typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::StorageType; |
242 | | using UnsignedCppType = |
243 | | typename StorageTypeTraits<FieldType::OLAP_FIELD_TYPE_TIMESTAMPTZ>::UnsignedStorageType; |
244 | | |
245 | | public: |
246 | 63.8k | static void full_encode_ascending(const void* value, std::string* buf) { |
247 | 63.8k | UnsignedCppType unsigned_val; |
248 | 63.8k | memcpy(&unsigned_val, value, sizeof(unsigned_val)); |
249 | | // make it bigendian |
250 | 63.8k | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
251 | 63.8k | buf->append((char*)&unsigned_val, sizeof(unsigned_val)); |
252 | 63.8k | } |
253 | | |
254 | 1.77k | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
255 | 1.77k | full_encode_ascending(value, buf); |
256 | 1.77k | } |
257 | | |
258 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
259 | 0 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
260 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
261 | 0 | sizeof(UnsignedCppType), |
262 | 0 | encoded_key->size)); |
263 | 0 | } |
264 | 0 | UnsignedCppType unsigned_val; |
265 | 0 | memcpy(&unsigned_val, encoded_key->data, sizeof(UnsignedCppType)); |
266 | 0 | unsigned_val = to_endian<std::endian::big>(unsigned_val); |
267 | 0 | memcpy(cell_ptr, &unsigned_val, sizeof(UnsignedCppType)); |
268 | 0 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
269 | 0 | return Status::OK(); |
270 | 0 | } |
271 | | }; |
272 | | |
273 | | template <> |
274 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DECIMAL> { |
275 | | public: |
276 | 48.7k | static void full_encode_ascending(const void* value, std::string* buf) { |
277 | 48.7k | decimal12_t decimal_val; |
278 | 48.7k | memcpy(&decimal_val, value, sizeof(decimal12_t)); |
279 | 48.7k | KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::full_encode_ascending( |
280 | 48.7k | &decimal_val.integer, buf); |
281 | 48.7k | KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::full_encode_ascending(&decimal_val.fraction, |
282 | 48.7k | buf); |
283 | 48.7k | } // namespace doris |
284 | | |
285 | 71 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
286 | 71 | full_encode_ascending(value, buf); |
287 | 71 | } |
288 | | |
289 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
290 | 64 | decimal12_t decimal_val = {0, 0}; |
291 | 64 | RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_BIGINT>::decode_ascending( |
292 | 64 | encoded_key, sizeof(decimal_val.integer), (uint8_t*)&decimal_val.integer)); |
293 | 64 | RETURN_IF_ERROR(KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_INT>::decode_ascending( |
294 | 64 | encoded_key, sizeof(decimal_val.fraction), (uint8_t*)&decimal_val.fraction)); |
295 | 64 | memcpy(cell_ptr, &decimal_val, sizeof(decimal12_t)); |
296 | 64 | return Status::OK(); |
297 | 64 | } |
298 | | }; |
299 | | |
300 | | template <> |
301 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_CHAR> { |
302 | | public: |
303 | 39 | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) { |
304 | 39 | auto slice = reinterpret_cast<const Slice*>(value); |
305 | 39 | buf->append(slice->get_data(), slice->get_size()); |
306 | 39 | } |
307 | | |
308 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
309 | 704 | std::string* buf) { |
310 | 704 | const Slice* slice = (const Slice*)value; |
311 | 18.4E | CHECK(index_size <= slice->size) |
312 | 18.4E | << "index size is larger than char size, index=" << index_size |
313 | 18.4E | << ", char=" << slice->size; |
314 | 704 | buf->append(slice->data, index_size); |
315 | 704 | } |
316 | | |
317 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
318 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
319 | 0 | } |
320 | | }; |
321 | | |
322 | | template <> |
323 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_VARCHAR> { |
324 | | public: |
325 | 13.4M | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) { |
326 | 13.4M | auto slice = reinterpret_cast<const Slice*>(value); |
327 | 13.4M | buf->append(slice->get_data(), slice->get_size()); |
328 | 13.4M | } |
329 | | |
330 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
331 | 35.8k | std::string* buf) { |
332 | 35.8k | const Slice* slice = (const Slice*)value; |
333 | 35.8k | size_t copy_size = std::min(index_size, slice->size); |
334 | 35.8k | buf->append(slice->data, copy_size); |
335 | 35.8k | } |
336 | | |
337 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
338 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
339 | 0 | } |
340 | | }; |
341 | | |
342 | | template <> |
343 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_STRING> { |
344 | | public: |
345 | 889 | NO_SANITIZE_UNDEFINED static void full_encode_ascending(const void* value, std::string* buf) { |
346 | 889 | auto slice = reinterpret_cast<const Slice*>(value); |
347 | 889 | buf->append(slice->get_data(), slice->get_size()); |
348 | 889 | } |
349 | | |
350 | | NO_SANITIZE_UNDEFINED static void encode_ascending(const void* value, size_t index_size, |
351 | 49 | std::string* buf) { |
352 | 49 | const Slice* slice = (const Slice*)value; |
353 | 49 | size_t copy_size = std::min(index_size, slice->size); |
354 | 49 | buf->append(slice->data, copy_size); |
355 | 49 | } |
356 | | |
357 | 0 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
358 | 0 | throw Exception(Status::FatalError("decode_ascending is not implemented")); |
359 | 0 | } |
360 | | }; |
361 | | |
362 | | template <FieldType field_type> |
363 | | class KeyCoderTraitsForFloat { |
364 | | public: |
365 | | using CppType = typename StorageTypeTraits<field_type>::StorageType; |
366 | | using UnsignedCppType = typename StorageTypeTraits<field_type>::UnsignedStorageType; |
367 | | |
368 | 97.0k | static UnsignedCppType encode_float(CppType value) { |
369 | 97.0k | return sortable_float_bits(float_to_int_bits(value)); |
370 | 97.0k | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12encode_floatEf Line | Count | Source | 368 | 48.5k | static UnsignedCppType encode_float(CppType value) { | 369 | 48.5k | return sortable_float_bits(float_to_int_bits(value)); | 370 | 48.5k | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12encode_floatEd Line | Count | Source | 368 | 48.5k | static UnsignedCppType encode_float(CppType value) { | 369 | 48.5k | return sortable_float_bits(float_to_int_bits(value)); | 370 | 48.5k | } |
|
371 | | |
372 | 128 | static CppType decode_float(UnsignedCppType sortable_bits) { |
373 | 128 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); |
374 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE12decode_floatEj Line | Count | Source | 372 | 64 | static CppType decode_float(UnsignedCppType sortable_bits) { | 373 | 64 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); | 374 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE12decode_floatEm Line | Count | Source | 372 | 64 | static CppType decode_float(UnsignedCppType sortable_bits) { | 373 | 64 | return int_bits_to_float(unsortable_float_bits(sortable_bits)); | 374 | 64 | } |
|
375 | | |
376 | | // -infinity < -100.0 < -1.0 < -0.0 < 0.0 < 1.0 < 100.0 < infinity < NaN |
377 | 97.0k | static void full_encode_ascending(const void* value, std::string* buf) { |
378 | 97.0k | CppType val; |
379 | 97.0k | std::memcpy(&val, value, sizeof(CppType)); |
380 | 97.0k | UnsignedCppType sortable_val = encode_float(val); |
381 | 97.0k | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) |
382 | 97.0k | << (sizeof(UnsignedCppType) * 8 - 1); |
383 | 97.0k | sortable_val ^= sign_bit; |
384 | 97.0k | sortable_val = to_endian<std::endian::big>(sortable_val); |
385 | 97.0k | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); |
386 | 97.0k | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 377 | 48.5k | static void full_encode_ascending(const void* value, std::string* buf) { | 378 | 48.5k | CppType val; | 379 | 48.5k | std::memcpy(&val, value, sizeof(CppType)); | 380 | 48.5k | UnsignedCppType sortable_val = encode_float(val); | 381 | 48.5k | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 382 | 48.5k | << (sizeof(UnsignedCppType) * 8 - 1); | 383 | 48.5k | sortable_val ^= sign_bit; | 384 | 48.5k | sortable_val = to_endian<std::endian::big>(sortable_val); | 385 | 48.5k | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); | 386 | 48.5k | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21full_encode_ascendingEPKvPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 377 | 48.5k | static void full_encode_ascending(const void* value, std::string* buf) { | 378 | 48.5k | CppType val; | 379 | 48.5k | std::memcpy(&val, value, sizeof(CppType)); | 380 | 48.5k | UnsignedCppType sortable_val = encode_float(val); | 381 | 48.5k | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 382 | 48.5k | << (sizeof(UnsignedCppType) * 8 - 1); | 383 | 48.5k | sortable_val ^= sign_bit; | 384 | 48.5k | sortable_val = to_endian<std::endian::big>(sortable_val); | 385 | 48.5k | buf->append(reinterpret_cast<const char*>(&sortable_val), sizeof(UnsignedCppType)); | 386 | 48.5k | } |
|
387 | | |
388 | 0 | static void encode_ascending(const void* value, size_t index_size, std::string* buf) { |
389 | 0 | full_encode_ascending(value, buf); |
390 | 0 | } Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16encode_ascendingEPKvmPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
391 | | |
392 | 128 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { |
393 | 128 | if (encoded_key->size < sizeof(UnsignedCppType)) { |
394 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", |
395 | 0 | sizeof(UnsignedCppType), |
396 | 0 | encoded_key->size)); |
397 | 0 | } |
398 | 128 | UnsignedCppType sortable_val; |
399 | 128 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); |
400 | 128 | sortable_val = to_endian<std::endian::big>(sortable_val); |
401 | 128 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) |
402 | 128 | << (sizeof(UnsignedCppType) * 8 - 1); |
403 | 128 | sortable_val ^= sign_bit; |
404 | 128 | CppType val = decode_float(sortable_val); |
405 | 128 | std::memcpy(cell_ptr, &val, sizeof(CppType)); |
406 | 128 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); |
407 | 128 | return Status::OK(); |
408 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 392 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 393 | 64 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 394 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", | 395 | 0 | sizeof(UnsignedCppType), | 396 | 0 | encoded_key->size)); | 397 | 0 | } | 398 | 64 | UnsignedCppType sortable_val; | 399 | 64 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); | 400 | 64 | sortable_val = to_endian<std::endian::big>(sortable_val); | 401 | 64 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 402 | 64 | << (sizeof(UnsignedCppType) * 8 - 1); | 403 | 64 | sortable_val ^= sign_bit; | 404 | 64 | CppType val = decode_float(sortable_val); | 405 | 64 | std::memcpy(cell_ptr, &val, sizeof(CppType)); | 406 | 64 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 407 | 64 | return Status::OK(); | 408 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE16decode_ascendingEPNS_5SliceEmPh Line | Count | Source | 392 | 64 | static Status decode_ascending(Slice* encoded_key, size_t index_size, uint8_t* cell_ptr) { | 393 | 64 | if (encoded_key->size < sizeof(UnsignedCppType)) { | 394 | 0 | return Status::InvalidArgument(absl::Substitute("Key too short, need=$0 vs real=$1", | 395 | 0 | sizeof(UnsignedCppType), | 396 | 0 | encoded_key->size)); | 397 | 0 | } | 398 | 64 | UnsignedCppType sortable_val; | 399 | 64 | std::memcpy(&sortable_val, encoded_key->data, sizeof(UnsignedCppType)); | 400 | 64 | sortable_val = to_endian<std::endian::big>(sortable_val); | 401 | 64 | constexpr UnsignedCppType sign_bit = UnsignedCppType(1) | 402 | 64 | << (sizeof(UnsignedCppType) * 8 - 1); | 403 | 64 | sortable_val ^= sign_bit; | 404 | 64 | CppType val = decode_float(sortable_val); | 405 | 64 | std::memcpy(cell_ptr, &val, sizeof(CppType)); | 406 | 64 | encoded_key->remove_prefix(sizeof(UnsignedCppType)); | 407 | 64 | return Status::OK(); | 408 | 64 | } |
|
409 | | |
410 | | private: |
411 | 97.0k | static UnsignedCppType float_to_int_bits(CppType value) { |
412 | 97.0k | const CppType canonical = StorageLayout<field_type>::canonicalize_nan(value); |
413 | 97.0k | UnsignedCppType result; |
414 | 97.0k | std::memcpy(&result, &canonical, sizeof(CppType)); |
415 | 97.0k | return result; |
416 | 97.0k | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17float_to_int_bitsEf Line | Count | Source | 411 | 48.5k | static UnsignedCppType float_to_int_bits(CppType value) { | 412 | 48.5k | const CppType canonical = StorageLayout<field_type>::canonicalize_nan(value); | 413 | 48.5k | UnsignedCppType result; | 414 | 48.5k | std::memcpy(&result, &canonical, sizeof(CppType)); | 415 | 48.5k | return result; | 416 | 48.5k | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17float_to_int_bitsEd Line | Count | Source | 411 | 48.5k | static UnsignedCppType float_to_int_bits(CppType value) { | 412 | 48.5k | const CppType canonical = StorageLayout<field_type>::canonicalize_nan(value); | 413 | 48.5k | UnsignedCppType result; | 414 | 48.5k | std::memcpy(&result, &canonical, sizeof(CppType)); | 415 | 48.5k | return result; | 416 | 48.5k | } |
|
417 | | |
418 | 97.2k | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { |
419 | 97.2k | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; |
420 | 97.2k | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; |
421 | 97.2k | if ((bits & sign_bit) != 0) { |
422 | 6.03k | return bits ^ (sign_bit - 1); |
423 | 91.1k | } else { |
424 | 91.1k | return bits; |
425 | 91.1k | } |
426 | 97.2k | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE19sortable_float_bitsEj Line | Count | Source | 418 | 48.5k | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { | 419 | 48.5k | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; | 420 | 48.5k | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; | 421 | 48.5k | if ((bits & sign_bit) != 0) { | 422 | 2.98k | return bits ^ (sign_bit - 1); | 423 | 45.5k | } else { | 424 | 45.5k | return bits; | 425 | 45.5k | } | 426 | 48.5k | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE19sortable_float_bitsEm Line | Count | Source | 418 | 48.6k | static UnsignedCppType sortable_float_bits(UnsignedCppType bits) { | 419 | 48.6k | constexpr int32_t shift = sizeof(UnsignedCppType) * 8 - 1; | 420 | 48.6k | constexpr UnsignedCppType sign_bit = static_cast<UnsignedCppType>(1) << shift; | 421 | 48.6k | if ((bits & sign_bit) != 0) { | 422 | 3.04k | return bits ^ (sign_bit - 1); | 423 | 45.5k | } else { | 424 | 45.5k | return bits; | 425 | 45.5k | } | 426 | 48.6k | } |
|
427 | | |
428 | 128 | static CppType int_bits_to_float(UnsignedCppType bits) { |
429 | 128 | CppType result; |
430 | 128 | std::memcpy(&result, &bits, sizeof(CppType)); |
431 | 128 | return result; |
432 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE17int_bits_to_floatEj Line | Count | Source | 428 | 64 | static CppType int_bits_to_float(UnsignedCppType bits) { | 429 | 64 | CppType result; | 430 | 64 | std::memcpy(&result, &bits, sizeof(CppType)); | 431 | 64 | return result; | 432 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE17int_bits_to_floatEm Line | Count | Source | 428 | 64 | static CppType int_bits_to_float(UnsignedCppType bits) { | 429 | 64 | CppType result; | 430 | 64 | std::memcpy(&result, &bits, sizeof(CppType)); | 431 | 64 | return result; | 432 | 64 | } |
|
433 | | |
434 | 128 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { |
435 | 128 | return sortable_float_bits(sortable_bits); |
436 | 128 | } _ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE10EE21unsortable_float_bitsEj Line | Count | Source | 434 | 64 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { | 435 | 64 | return sortable_float_bits(sortable_bits); | 436 | 64 | } |
_ZN5doris22KeyCoderTraitsForFloatILNS_9FieldTypeE11EE21unsortable_float_bitsEm Line | Count | Source | 434 | 64 | static UnsignedCppType unsortable_float_bits(UnsignedCppType sortable_bits) { | 435 | 64 | return sortable_float_bits(sortable_bits); | 436 | 64 | } |
|
437 | | }; |
438 | | |
439 | | template <> |
440 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_FLOAT> |
441 | | : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_FLOAT> {}; |
442 | | |
443 | | template <> |
444 | | class KeyCoderTraits<FieldType::OLAP_FIELD_TYPE_DOUBLE> |
445 | | : public KeyCoderTraitsForFloat<FieldType::OLAP_FIELD_TYPE_DOUBLE> {}; |
446 | | |
447 | | // Every FieldType that goes through KeyCoder as a non-string scalar key. |
448 | | // Strings are handled separately because they need length / padding logic |
449 | | // outside KeyCoder. |
450 | | #define DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(M) \ |
451 | 12.9k | M(OLAP_FIELD_TYPE_BOOL) \ |
452 | 158k | M(OLAP_FIELD_TYPE_TINYINT) \ |
453 | 158k | M(OLAP_FIELD_TYPE_SMALLINT) \ |
454 | 783k | M(OLAP_FIELD_TYPE_INT) \ |
455 | 783k | M(OLAP_FIELD_TYPE_BIGINT) \ |
456 | 58.4k | M(OLAP_FIELD_TYPE_LARGEINT) \ |
457 | 23.6k | M(OLAP_FIELD_TYPE_FLOAT) \ |
458 | 23 | M(OLAP_FIELD_TYPE_DOUBLE) \ |
459 | 364 | M(OLAP_FIELD_TYPE_DECIMAL) \ |
460 | 1.38k | M(OLAP_FIELD_TYPE_DECIMAL32) \ |
461 | 1.38k | M(OLAP_FIELD_TYPE_DECIMAL64) \ |
462 | 3.09k | M(OLAP_FIELD_TYPE_DECIMAL128I) \ |
463 | 3.09k | M(OLAP_FIELD_TYPE_DECIMAL256) \ |
464 | 3.20k | M(OLAP_FIELD_TYPE_DATE) \ |
465 | 3.20k | M(OLAP_FIELD_TYPE_DATETIME) \ |
466 | 283k | M(OLAP_FIELD_TYPE_DATEV2) \ |
467 | 283k | M(OLAP_FIELD_TYPE_DATETIMEV2) \ |
468 | 11.2k | M(OLAP_FIELD_TYPE_TIMESTAMP_NS) \ |
469 | 12.5k | M(OLAP_FIELD_TYPE_TIMESTAMPTZ) \ |
470 | 12.5k | M(OLAP_FIELD_TYPE_IPV4) \ |
471 | 575 | M(OLAP_FIELD_TYPE_IPV6) \ |
472 | 794 | M(OLAP_FIELD_TYPE_UUID) |
473 | | |
474 | | // True for exactly the FieldTypes listed in |
475 | | // DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES. Strings (CHAR/VARCHAR/STRING/ |
476 | | // VARBINARY) have their own short-key code path in row_cursor.cpp that calls |
477 | | // storage_field->full_encode_ascending directly, and nested/aggregate types |
478 | | // (ARRAY/MAP/STRUCT/VARIANT/HLL/BITMAP/JSONB/QUANTILE_STATE/AGG_STATE) are not |
479 | | // key-encodable at all -- both groups must never reach the helpers below. |
480 | 0 | constexpr bool is_key_encodable_non_string_type(FieldType ft) { |
481 | 0 | switch (ft) { |
482 | 0 | #define DORIS_KEY_ENCODABLE_CASE(FT) \ |
483 | 0 | case FieldType::FT: \ |
484 | 0 | return true; |
485 | 0 | DORIS_APPLY_FOR_KEY_ENCODABLE_NON_STRING_TYPES(DORIS_KEY_ENCODABLE_CASE) |
486 | 0 | #undef DORIS_KEY_ENCODABLE_CASE |
487 | 0 | default: |
488 | 0 | return false; |
489 | 0 | } |
490 | 0 | } |
491 | | |
492 | | // Convert a Field value to its StorageValue (via StorageLayout) |
493 | | // and full-encode it as a byte-comparable ascending key via KeyCoder. |
494 | | template <FieldType FT> |
495 | 1.23M | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { |
496 | 1.23M | static_assert(is_key_encodable_non_string_type(FT), |
497 | 1.23M | "full_encode_field_as_key is for non-string scalar keys only; " |
498 | 1.23M | "strings have their own path in RowCursor that calls " |
499 | 1.23M | "storage_field->full_encode_ascending directly, and nested / " |
500 | 1.23M | "aggregate types are not key-encodable"); |
501 | 1.23M | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); |
502 | 1.23M | coder->full_encode_ascending(&v, buf); |
503 | 1.23M | } _ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE24EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 11.6k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 11.6k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 11.6k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 11.6k | "strings have their own path in RowCursor that calls " | 499 | 11.6k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 11.6k | "aggregate types are not key-encodable"); | 501 | 11.6k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 11.6k | coder->full_encode_ascending(&v, buf); | 503 | 11.6k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE1EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 153k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 153k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 153k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 153k | "strings have their own path in RowCursor that calls " | 499 | 153k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 153k | "aggregate types are not key-encodable"); | 501 | 153k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 153k | coder->full_encode_ascending(&v, buf); | 503 | 153k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE3EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 5.64k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 5.64k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 5.64k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 5.64k | "strings have their own path in RowCursor that calls " | 499 | 5.64k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 5.64k | "aggregate types are not key-encodable"); | 501 | 5.64k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 5.64k | coder->full_encode_ascending(&v, buf); | 503 | 5.64k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE5EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 718k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 718k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 718k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 718k | "strings have their own path in RowCursor that calls " | 499 | 718k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 718k | "aggregate types are not key-encodable"); | 501 | 718k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 718k | coder->full_encode_ascending(&v, buf); | 503 | 718k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE7EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 34.8k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 34.8k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 34.8k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 34.8k | "strings have their own path in RowCursor that calls " | 499 | 34.8k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 34.8k | "aggregate types are not key-encodable"); | 501 | 34.8k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 34.8k | coder->full_encode_ascending(&v, buf); | 503 | 34.8k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE9EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 13.4k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 13.4k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 13.4k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 13.4k | "strings have their own path in RowCursor that calls " | 499 | 13.4k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 13.4k | "aggregate types are not key-encodable"); | 501 | 13.4k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 13.4k | coder->full_encode_ascending(&v, buf); | 503 | 13.4k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE10EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 28 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 28 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 28 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 28 | "strings have their own path in RowCursor that calls " | 499 | 28 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 28 | "aggregate types are not key-encodable"); | 501 | 28 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 28 | coder->full_encode_ascending(&v, buf); | 503 | 28 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE11EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 26 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 26 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 26 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 26 | "strings have their own path in RowCursor that calls " | 499 | 26 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 26 | "aggregate types are not key-encodable"); | 501 | 26 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 26 | coder->full_encode_ascending(&v, buf); | 503 | 26 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE16EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 58 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 58 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 58 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 58 | "strings have their own path in RowCursor that calls " | 499 | 58 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 58 | "aggregate types are not key-encodable"); | 501 | 58 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 58 | coder->full_encode_ascending(&v, buf); | 503 | 58 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE31EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 459 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 459 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 459 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 459 | "strings have their own path in RowCursor that calls " | 499 | 459 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 459 | "aggregate types are not key-encodable"); | 501 | 459 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 459 | coder->full_encode_ascending(&v, buf); | 503 | 459 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE32EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 396 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 396 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 396 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 396 | "strings have their own path in RowCursor that calls " | 499 | 396 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 396 | "aggregate types are not key-encodable"); | 501 | 396 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 396 | coder->full_encode_ascending(&v, buf); | 503 | 396 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE33EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 1.22k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 1.22k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 1.22k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 1.22k | "strings have their own path in RowCursor that calls " | 499 | 1.22k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 1.22k | "aggregate types are not key-encodable"); | 501 | 1.22k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 1.22k | coder->full_encode_ascending(&v, buf); | 503 | 1.22k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE37EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 780 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 780 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 780 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 780 | "strings have their own path in RowCursor that calls " | 499 | 780 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 780 | "aggregate types are not key-encodable"); | 501 | 780 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 780 | coder->full_encode_ascending(&v, buf); | 503 | 780 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE14EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 2.91k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 2.91k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 2.91k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 2.91k | "strings have their own path in RowCursor that calls " | 499 | 2.91k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 2.91k | "aggregate types are not key-encodable"); | 501 | 2.91k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 2.91k | coder->full_encode_ascending(&v, buf); | 503 | 2.91k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE15EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 289 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 289 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 289 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 289 | "strings have their own path in RowCursor that calls " | 499 | 289 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 289 | "aggregate types are not key-encodable"); | 501 | 289 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 289 | coder->full_encode_ascending(&v, buf); | 503 | 289 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE28EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 272k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 272k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 272k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 272k | "strings have their own path in RowCursor that calls " | 499 | 272k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 272k | "aggregate types are not key-encodable"); | 501 | 272k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 272k | coder->full_encode_ascending(&v, buf); | 503 | 272k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE29EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 6.87k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 6.87k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 6.87k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 6.87k | "strings have their own path in RowCursor that calls " | 499 | 6.87k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 6.87k | "aggregate types are not key-encodable"); | 501 | 6.87k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 6.87k | coder->full_encode_ascending(&v, buf); | 503 | 6.87k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE41EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 338 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 338 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 338 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 338 | "strings have their own path in RowCursor that calls " | 499 | 338 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 338 | "aggregate types are not key-encodable"); | 501 | 338 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 338 | coder->full_encode_ascending(&v, buf); | 503 | 338 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE40EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 8.24k | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 8.24k | static_assert(is_key_encodable_non_string_type(FT), | 497 | 8.24k | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 8.24k | "strings have their own path in RowCursor that calls " | 499 | 8.24k | "storage_field->full_encode_ascending directly, and nested / " | 500 | 8.24k | "aggregate types are not key-encodable"); | 501 | 8.24k | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 8.24k | coder->full_encode_ascending(&v, buf); | 503 | 8.24k | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE38EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 186 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 186 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 186 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 186 | "strings have their own path in RowCursor that calls " | 499 | 186 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 186 | "aggregate types are not key-encodable"); | 501 | 186 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 186 | coder->full_encode_ascending(&v, buf); | 503 | 186 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE39EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 165 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 165 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 165 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 165 | "strings have their own path in RowCursor that calls " | 499 | 165 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 165 | "aggregate types are not key-encodable"); | 501 | 165 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 165 | coder->full_encode_ascending(&v, buf); | 503 | 165 | } |
_ZN5doris24full_encode_field_as_keyILNS_9FieldTypeE42EEEvRKNS_5FieldEPKNS_8KeyCoderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Line | Count | Source | 495 | 691 | inline void full_encode_field_as_key(const Field& f, const KeyCoder* coder, std::string* buf) { | 496 | 691 | static_assert(is_key_encodable_non_string_type(FT), | 497 | 691 | "full_encode_field_as_key is for non-string scalar keys only; " | 498 | 691 | "strings have their own path in RowCursor that calls " | 499 | 691 | "storage_field->full_encode_ascending directly, and nested / " | 500 | 691 | "aggregate types are not key-encodable"); | 501 | 691 | const auto v = StorageLayout<FT>::to_storage(f.get<storage_field_type_to_primitive_type(FT)>()); | 502 | 691 | coder->full_encode_ascending(&v, buf); | 503 | 691 | } |
|
504 | | |
505 | | } // namespace doris |