Coverage Report

Created: 2026-03-17 14:27

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/common/hash_table/hash.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
// This file is copied from
18
// https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/HashTable/Hash.h
19
// and modified by Doris
20
21
#pragma once
22
23
#include <type_traits>
24
25
#include "core/extended_types.h"
26
#include "core/string_ref.h"
27
#include "core/types.h"
28
#include "core/uint128.h"
29
#include "parallel_hashmap/phmap_utils.h"
30
31
// Here is an empirical value.
32
static constexpr size_t HASH_MAP_PREFETCH_DIST = 16;
33
34
/** Hash functions that are better than the trivial function std::hash.
35
  *
36
  * Example: when we do aggregation by the visitor ID, the performance increase is more than 5 times.
37
  * This is because of following reasons:
38
  * - in Yandex, visitor identifier is an integer that has timestamp with seconds resolution in lower bits;
39
  * - in typical implementation of standard library, hash function for integers is trivial and just use lower bits;
40
  * - traffic is non-uniformly distributed across a day;
41
  * - we are using open-addressing linear probing hash tables that are most critical to hash function quality,
42
  *   and trivial hash function gives disastrous results.
43
  */
44
45
/** Taken from MurmurHash. This is Murmur finalizer.
46
  * Faster than int_hash32 when inserting into the hash table UInt64 -> UInt64, where the key is the visitor ID.
47
  */
48
23.8k
inline doris::UInt64 int_hash64(doris::UInt64 x) {
49
23.8k
    x ^= x >> 33;
50
23.8k
    x *= 0xff51afd7ed558ccdULL;
51
23.8k
    x ^= x >> 33;
52
23.8k
    x *= 0xc4ceb9fe1a85ec53ULL;
53
23.8k
    x ^= x >> 33;
54
55
23.8k
    return x;
56
23.8k
}
57
58
/** CRC32C is not very high-quality as a hash function,
59
  *  according to avalanche and bit independence tests (see SMHasher software), as well as a small number of bits,
60
  *  but can behave well when used in hash tables,
61
  *  due to high speed (latency 3 + 1 clock cycle, throughput 1 clock cycle).
62
  * Works only with SSE 4.2 support.
63
  */
64
#include "util/sse_util.hpp"
65
66
36.6M
inline doris::UInt64 int_hash_crc32(doris::UInt64 x) {
67
36.6M
#if defined(__SSE4_2__) || (defined(__aarch64__) && defined(__ARM_FEATURE_CRC32))
68
36.6M
    return _mm_crc32_u64(-1ULL, x);
69
#else
70
    /// On other platforms we do not have CRC32. NOTE This can be confusing.
71
    return int_hash64(x);
72
#endif
73
36.6M
}
74
75
template <typename T>
76
21.1k
inline size_t default_hash64(T key) {
77
21.1k
    union {
78
21.1k
        T in;
79
21.1k
        doris::UInt64 out;
80
21.1k
    } u;
81
21.1k
    u.out = 0;
82
21.1k
    u.in = key;
83
21.1k
    return int_hash64(u.out);
84
21.1k
}
_Z14default_hash64IhEmT_
Line
Count
Source
76
112
inline size_t default_hash64(T key) {
77
112
    union {
78
112
        T in;
79
112
        doris::UInt64 out;
80
112
    } u;
81
112
    u.out = 0;
82
112
    u.in = key;
83
112
    return int_hash64(u.out);
84
112
}
_Z14default_hash64IaEmT_
Line
Count
Source
76
1.43k
inline size_t default_hash64(T key) {
77
1.43k
    union {
78
1.43k
        T in;
79
1.43k
        doris::UInt64 out;
80
1.43k
    } u;
81
1.43k
    u.out = 0;
82
1.43k
    u.in = key;
83
1.43k
    return int_hash64(u.out);
84
1.43k
}
_Z14default_hash64IsEmT_
Line
Count
Source
76
2.13k
inline size_t default_hash64(T key) {
77
2.13k
    union {
78
2.13k
        T in;
79
2.13k
        doris::UInt64 out;
80
2.13k
    } u;
81
2.13k
    u.out = 0;
82
2.13k
    u.in = key;
83
2.13k
    return int_hash64(u.out);
84
2.13k
}
_Z14default_hash64IiEmT_
Line
Count
Source
76
4.09k
inline size_t default_hash64(T key) {
77
4.09k
    union {
78
4.09k
        T in;
79
4.09k
        doris::UInt64 out;
80
4.09k
    } u;
81
4.09k
    u.out = 0;
82
4.09k
    u.in = key;
83
4.09k
    return int_hash64(u.out);
84
4.09k
}
_Z14default_hash64IlEmT_
Line
Count
Source
76
3.02k
inline size_t default_hash64(T key) {
77
3.02k
    union {
78
3.02k
        T in;
79
3.02k
        doris::UInt64 out;
80
3.02k
    } u;
81
3.02k
    u.out = 0;
82
3.02k
    u.in = key;
83
3.02k
    return int_hash64(u.out);
84
3.02k
}
_Z14default_hash64InEmT_
Line
Count
Source
76
4.73k
inline size_t default_hash64(T key) {
77
4.73k
    union {
78
4.73k
        T in;
79
4.73k
        doris::UInt64 out;
80
4.73k
    } u;
81
4.73k
    u.out = 0;
82
4.73k
    u.in = key;
83
4.73k
    return int_hash64(u.out);
84
4.73k
}
_Z14default_hash64IfEmT_
Line
Count
Source
76
1.17k
inline size_t default_hash64(T key) {
77
1.17k
    union {
78
1.17k
        T in;
79
1.17k
        doris::UInt64 out;
80
1.17k
    } u;
81
1.17k
    u.out = 0;
82
1.17k
    u.in = key;
83
1.17k
    return int_hash64(u.out);
84
1.17k
}
_Z14default_hash64IdEmT_
Line
Count
Source
76
1.51k
inline size_t default_hash64(T key) {
77
1.51k
    union {
78
1.51k
        T in;
79
1.51k
        doris::UInt64 out;
80
1.51k
    } u;
81
1.51k
    u.out = 0;
82
1.51k
    u.in = key;
83
1.51k
    return int_hash64(u.out);
84
1.51k
}
_Z14default_hash64IjEmT_
Line
Count
Source
76
1.72k
inline size_t default_hash64(T key) {
77
1.72k
    union {
78
1.72k
        T in;
79
1.72k
        doris::UInt64 out;
80
1.72k
    } u;
81
1.72k
    u.out = 0;
82
1.72k
    u.in = key;
83
1.72k
    return int_hash64(u.out);
84
1.72k
}
_Z14default_hash64IoEmT_
Line
Count
Source
76
1.22k
inline size_t default_hash64(T key) {
77
1.22k
    union {
78
1.22k
        T in;
79
1.22k
        doris::UInt64 out;
80
1.22k
    } u;
81
1.22k
    u.out = 0;
82
1.22k
    u.in = key;
83
1.22k
    return int_hash64(u.out);
84
1.22k
}
85
86
template <typename T, typename Enable = void>
87
struct DefaultHash;
88
89
template <typename T>
90
    requires std::is_arithmetic_v<T>
91
struct DefaultHash<T> {
92
21.1k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIhvEclEh
Line
Count
Source
92
112
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIavEclEa
Line
Count
Source
92
1.43k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIsvEclEs
Line
Count
Source
92
2.13k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIivEclEi
Line
Count
Source
92
4.09k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIlvEclEl
Line
Count
Source
92
3.02k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashInvEclEn
Line
Count
Source
92
4.73k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIfvEclEf
Line
Count
Source
92
1.17k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIdvEclEd
Line
Count
Source
92
1.51k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIjvEclEj
Line
Count
Source
92
1.72k
    size_t operator()(T key) const { return default_hash64<T>(key); }
_ZNK11DefaultHashIovEclEo
Line
Count
Source
92
1.22k
    size_t operator()(T key) const { return default_hash64<T>(key); }
93
};
94
95
template <>
96
struct DefaultHash<doris::VecDateTimeValue> {
97
0
    size_t operator()(doris::VecDateTimeValue key) const { return int_hash64(*(int64_t*)&key); }
98
};
99
100
template <>
101
struct DefaultHash<doris::DateV2Value<doris::DateTimeV2ValueType>> {
102
817
    size_t operator()(doris::DateV2Value<doris::DateTimeV2ValueType> key) const {
103
817
        return int_hash64(key.to_date_int_val());
104
817
    }
105
};
106
107
template <>
108
struct DefaultHash<doris::DateV2Value<doris::DateV2ValueType>> {
109
1.91k
    size_t operator()(doris::DateV2Value<doris::DateV2ValueType> key) const {
110
1.91k
        return int_hash64(key.to_date_int_val());
111
1.91k
    }
112
};
113
114
template <>
115
struct DefaultHash<doris::TimestampTzValue> {
116
0
    size_t operator()(doris::TimestampTzValue key) const {
117
0
        return int_hash64(key.to_date_int_val());
118
0
    }
119
};
120
121
template <>
122
struct DefaultHash<doris::StringRef> : public doris::StringRefHash {};
123
124
template <>
125
struct DefaultHash<wide::Int256> : public std::hash<wide::Int256> {};
126
127
template <typename T>
128
struct HashCRC32;
129
130
template <typename T>
131
36.6M
inline size_t hash_crc32(T key) {
132
36.6M
    union {
133
36.6M
        T in;
134
36.6M
        doris::UInt64 out;
135
36.6M
    } u;
136
36.6M
    u.out = 0;
137
36.6M
    u.in = key;
138
36.6M
    return int_hash_crc32(u.out);
139
36.6M
}
_Z10hash_crc32IlEmT_
Line
Count
Source
131
578k
inline size_t hash_crc32(T key) {
132
578k
    union {
133
578k
        T in;
134
578k
        doris::UInt64 out;
135
578k
    } u;
136
578k
    u.out = 0;
137
578k
    u.in = key;
138
578k
    return int_hash_crc32(u.out);
139
578k
}
_Z10hash_crc32ImEmT_
Line
Count
Source
131
23.7M
inline size_t hash_crc32(T key) {
132
23.7M
    union {
133
23.7M
        T in;
134
23.7M
        doris::UInt64 out;
135
23.7M
    } u;
136
23.7M
    u.out = 0;
137
23.7M
    u.in = key;
138
23.7M
    return int_hash_crc32(u.out);
139
23.7M
}
_Z10hash_crc32IjEmT_
Line
Count
Source
131
11.9M
inline size_t hash_crc32(T key) {
132
11.9M
    union {
133
11.9M
        T in;
134
11.9M
        doris::UInt64 out;
135
11.9M
    } u;
136
11.9M
    u.out = 0;
137
11.9M
    u.in = key;
138
11.9M
    return int_hash_crc32(u.out);
139
11.9M
}
_Z10hash_crc32IhEmT_
Line
Count
Source
131
103k
inline size_t hash_crc32(T key) {
132
103k
    union {
133
103k
        T in;
134
103k
        doris::UInt64 out;
135
103k
    } u;
136
103k
    u.out = 0;
137
103k
    u.in = key;
138
103k
    return int_hash_crc32(u.out);
139
103k
}
_Z10hash_crc32ItEmT_
Line
Count
Source
131
26.1k
inline size_t hash_crc32(T key) {
132
26.1k
    union {
133
26.1k
        T in;
134
26.1k
        doris::UInt64 out;
135
26.1k
    } u;
136
26.1k
    u.out = 0;
137
26.1k
    u.in = key;
138
26.1k
    return int_hash_crc32(u.out);
139
26.1k
}
_Z10hash_crc32IaEmT_
Line
Count
Source
131
8.97k
inline size_t hash_crc32(T key) {
132
8.97k
    union {
133
8.97k
        T in;
134
8.97k
        doris::UInt64 out;
135
8.97k
    } u;
136
8.97k
    u.out = 0;
137
8.97k
    u.in = key;
138
8.97k
    return int_hash_crc32(u.out);
139
8.97k
}
_Z10hash_crc32IsEmT_
Line
Count
Source
131
8.50k
inline size_t hash_crc32(T key) {
132
8.50k
    union {
133
8.50k
        T in;
134
8.50k
        doris::UInt64 out;
135
8.50k
    } u;
136
8.50k
    u.out = 0;
137
8.50k
    u.in = key;
138
8.50k
    return int_hash_crc32(u.out);
139
8.50k
}
_Z10hash_crc32IiEmT_
Line
Count
Source
131
219k
inline size_t hash_crc32(T key) {
132
219k
    union {
133
219k
        T in;
134
219k
        doris::UInt64 out;
135
219k
    } u;
136
219k
    u.out = 0;
137
219k
    u.in = key;
138
219k
    return int_hash_crc32(u.out);
139
219k
}
Unexecuted instantiation: _Z10hash_crc32IfEmT_
Unexecuted instantiation: _Z10hash_crc32IdEmT_
140
141
template <>
142
166k
inline size_t hash_crc32(doris::UInt128 u) {
143
166k
    return doris::UInt128HashCRC32()(u);
144
166k
}
145
146
template <>
147
48
inline size_t hash_crc32(unsigned __int128 u) {
148
48
    return doris::UInt128HashCRC32()(u);
149
48
}
150
151
template <>
152
245
inline size_t hash_crc32(doris::Int128 u) {
153
245
    return doris::UInt128HashCRC32()({(u >> 64) & int64_t(-1), u & int64_t(-1)});
154
245
}
155
156
template <>
157
0
inline size_t hash_crc32(doris::VecDateTimeValue u) {
158
0
    return hash_crc32(*(int64_t*)&u);
159
0
}
160
161
template <>
162
83
inline size_t hash_crc32(doris::DateV2Value<doris::DateTimeV2ValueType> u) {
163
83
    return hash_crc32(u.to_date_int_val());
164
83
}
165
166
template <>
167
1.65k
inline size_t hash_crc32(doris::DateV2Value<doris::DateV2ValueType> u) {
168
1.65k
    return hash_crc32(u.to_date_int_val());
169
1.65k
}
170
171
template <>
172
306
inline size_t hash_crc32(doris::TimestampTzValue u) {
173
306
    return hash_crc32(u.to_date_int_val());
174
306
}
175
176
#define DEFINE_HASH(T)                   \
177
    template <>                          \
178
    struct HashCRC32<T> {                \
179
36.8M
        size_t operator()(T key) const { \
180
36.8M
            return hash_crc32<T>(key);   \
181
36.8M
        }                                \
_ZNK9HashCRC32IhEclEh
Line
Count
Source
179
103k
        size_t operator()(T key) const { \
180
103k
            return hash_crc32<T>(key);   \
181
103k
        }                                \
_ZNK9HashCRC32ItEclEt
Line
Count
Source
179
26.1k
        size_t operator()(T key) const { \
180
26.1k
            return hash_crc32<T>(key);   \
181
26.1k
        }                                \
_ZNK9HashCRC32IjEclEj
Line
Count
Source
179
11.9M
        size_t operator()(T key) const { \
180
11.9M
            return hash_crc32<T>(key);   \
181
11.9M
        }                                \
_ZNK9HashCRC32ImEclEm
Line
Count
Source
179
23.7M
        size_t operator()(T key) const { \
180
23.7M
            return hash_crc32<T>(key);   \
181
23.7M
        }                                \
_ZNK9HashCRC32IN4wide7integerILm128EjEEEclES2_
Line
Count
Source
179
166k
        size_t operator()(T key) const { \
180
166k
            return hash_crc32<T>(key);   \
181
166k
        }                                \
_ZNK9HashCRC32IaEclEa
Line
Count
Source
179
8.97k
        size_t operator()(T key) const { \
180
8.97k
            return hash_crc32<T>(key);   \
181
8.97k
        }                                \
_ZNK9HashCRC32IsEclEs
Line
Count
Source
179
8.50k
        size_t operator()(T key) const { \
180
8.50k
            return hash_crc32<T>(key);   \
181
8.50k
        }                                \
_ZNK9HashCRC32IiEclEi
Line
Count
Source
179
219k
        size_t operator()(T key) const { \
180
219k
            return hash_crc32<T>(key);   \
181
219k
        }                                \
_ZNK9HashCRC32IlEclEl
Line
Count
Source
179
578k
        size_t operator()(T key) const { \
180
578k
            return hash_crc32<T>(key);   \
181
578k
        }                                \
_ZNK9HashCRC32InEclEn
Line
Count
Source
179
245
        size_t operator()(T key) const { \
180
245
            return hash_crc32<T>(key);   \
181
245
        }                                \
Unexecuted instantiation: _ZNK9HashCRC32IfEclEf
Unexecuted instantiation: _ZNK9HashCRC32IdEclEd
Unexecuted instantiation: _ZNK9HashCRC32IN5doris16VecDateTimeValueEEclES1_
_ZNK9HashCRC32IN5doris11DateV2ValueINS0_19DateTimeV2ValueTypeEEEEclES3_
Line
Count
Source
179
83
        size_t operator()(T key) const { \
180
83
            return hash_crc32<T>(key);   \
181
83
        }                                \
_ZNK9HashCRC32IN5doris11DateV2ValueINS0_15DateV2ValueTypeEEEEclES3_
Line
Count
Source
179
1.65k
        size_t operator()(T key) const { \
180
1.65k
            return hash_crc32<T>(key);   \
181
1.65k
        }                                \
_ZNK9HashCRC32IN5doris16TimestampTzValueEEclES1_
Line
Count
Source
179
306
        size_t operator()(T key) const { \
180
306
            return hash_crc32<T>(key);   \
181
306
        }                                \
_ZNK9HashCRC32IoEclEo
Line
Count
Source
179
48
        size_t operator()(T key) const { \
180
48
            return hash_crc32<T>(key);   \
181
48
        }                                \
182
    };
183
184
DEFINE_HASH(doris::UInt8)
185
DEFINE_HASH(doris::UInt16)
186
DEFINE_HASH(doris::UInt32)
187
DEFINE_HASH(doris::UInt64)
188
DEFINE_HASH(doris::UInt128)
189
DEFINE_HASH(doris::Int8)
190
DEFINE_HASH(doris::Int16)
191
DEFINE_HASH(doris::Int32)
192
DEFINE_HASH(doris::Int64)
193
DEFINE_HASH(doris::Int128)
194
DEFINE_HASH(doris::Float32)
195
DEFINE_HASH(doris::Float64)
196
DEFINE_HASH(doris::VecDateTimeValue)
197
DEFINE_HASH(doris::DateV2Value<doris::DateTimeV2ValueType>)
198
DEFINE_HASH(doris::DateV2Value<doris::DateV2ValueType>)
199
DEFINE_HASH(doris::TimestampTzValue)
200
DEFINE_HASH(unsigned __int128)
201
202
#undef DEFINE_HASH
203
204
template <typename Key, typename Hash = HashCRC32<Key>>
205
struct HashMixWrapper {
206
11.6M
    size_t operator()(Key key) const { return phmap::phmap_mix<sizeof(size_t)>()(Hash()(key)); }
_ZNK14HashMixWrapperIm9HashCRC32ImEEclEm
Line
Count
Source
206
190k
    size_t operator()(Key key) const { return phmap::phmap_mix<sizeof(size_t)>()(Hash()(key)); }
_ZNK14HashMixWrapperIj9HashCRC32IjEEclEj
Line
Count
Source
206
11.4M
    size_t operator()(Key key) const { return phmap::phmap_mix<sizeof(size_t)>()(Hash()(key)); }
207
};
208
209
template <>
210
struct HashCRC32<doris::UInt256> {
211
82.4k
    size_t operator()(const doris::UInt256& x) const {
212
82.4k
#if defined(__SSE4_2__) || defined(__aarch64__)
213
82.4k
        doris::UInt64 crc = -1ULL;
214
82.4k
        crc = _mm_crc32_u64(crc, x.items[0]);
215
82.4k
        crc = _mm_crc32_u64(crc, x.items[1]);
216
82.4k
        crc = _mm_crc32_u64(crc, x.items[2]);
217
82.4k
        crc = _mm_crc32_u64(crc, x.items[3]);
218
82.4k
        return crc;
219
#else
220
        return Hash128to64({Hash128to64({x.a, x.b}), Hash128to64({x.c, x.d})});
221
#endif
222
82.4k
    }
223
};
224
225
template <>
226
struct HashCRC32<wide::Int256> {
227
8.38k
    size_t operator()(const wide::Int256& x) const {
228
8.38k
#if defined(__SSE4_2__) || defined(__aarch64__)
229
8.38k
        doris::UInt64 crc = -1ULL;
230
8.38k
        crc = _mm_crc32_u64(crc, x.items[0]);
231
8.38k
        crc = _mm_crc32_u64(crc, x.items[1]);
232
8.38k
        crc = _mm_crc32_u64(crc, x.items[2]);
233
8.38k
        crc = _mm_crc32_u64(crc, x.items[3]);
234
8.38k
        return crc;
235
#else
236
        return Hash128to64(
237
                {Hash128to64({x.items[0], x.items[1]}), Hash128to64({x.items[2], x.items[3]})});
238
#endif
239
8.38k
    }
240
};
241
242
template <>
243
struct HashCRC32<doris::Decimal256> {
244
136
    size_t operator()(const doris::Decimal256& value) const {
245
136
        return HashCRC32<wide::Int256>()(value.value);
246
136
    }
247
};
248
249
template <>
250
struct HashCRC32<doris::Decimal32> {
251
0
    size_t operator()(const doris::Decimal32& value) const {
252
0
        return HashCRC32<int32_t>()(value.value);
253
0
    }
254
};
255
256
template <>
257
struct HashCRC32<doris::Decimal64> {
258
120
    size_t operator()(const doris::Decimal64& value) const {
259
120
        return HashCRC32<int64_t>()(value.value);
260
120
    }
261
};
262
263
template <>
264
struct HashCRC32<doris::Decimal128V3> {
265
39
    size_t operator()(const doris::Decimal128V3& value) const {
266
39
        return HashCRC32<__int128>()(value.value);
267
39
    }
268
};
269
270
template <>
271
struct HashCRC32<doris::Decimal128V2> {
272
0
    size_t operator()(const doris::Decimal128V2& value) const {
273
0
        return HashCRC32<__int128>()(value.value);
274
0
    }
275
};
276
277
template <>
278
struct HashCRC32<doris::DecimalV2Value> {
279
0
    size_t operator()(const doris::DecimalV2Value& value) const {
280
0
        return HashCRC32<__int128>()(value.value());
281
0
    }
282
};
283
284
#include "common/compile_check_avoid_begin.h"
285
286
template <>
287
struct HashCRC32<doris::UInt72> {
288
151k
    size_t operator()(const doris::UInt72& x) const {
289
151k
        doris::UInt64 crc = -1ULL;
290
151k
        crc = _mm_crc32_u8(crc, x.a);
291
151k
        crc = _mm_crc32_u64(crc, x.b);
292
151k
        return crc;
293
151k
    }
294
};
295
296
template <>
297
struct HashCRC32<doris::UInt96> {
298
43.2k
    size_t operator()(const doris::UInt96& x) const {
299
43.2k
        doris::UInt64 crc = -1ULL;
300
43.2k
        crc = _mm_crc32_u32(crc, x.a);
301
43.2k
        crc = _mm_crc32_u64(crc, x.b);
302
43.2k
        return crc;
303
43.2k
    }
304
};
305
306
template <>
307
struct HashCRC32<doris::UInt104> {
308
4.02k
    size_t operator()(const doris::UInt104& x) const {
309
4.02k
        doris::UInt64 crc = -1ULL;
310
4.02k
        crc = _mm_crc32_u8(crc, x.a);
311
4.02k
        crc = _mm_crc32_u32(crc, x.b);
312
4.02k
        crc = _mm_crc32_u64(crc, x.c);
313
4.02k
        return crc;
314
4.02k
    }
315
};
316
317
template <>
318
struct HashCRC32<doris::UInt136> {
319
9.64k
    size_t operator()(const doris::UInt136& x) const {
320
9.64k
        doris::UInt64 crc = -1ULL;
321
9.64k
        crc = _mm_crc32_u8(crc, x.a);
322
9.64k
        crc = _mm_crc32_u64(crc, x.b);
323
9.64k
        crc = _mm_crc32_u64(crc, x.c);
324
9.64k
        return crc;
325
9.64k
    }
326
};
327
328
#include "common/compile_check_avoid_end.h"