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