Skip to content

Commit 522af8f

Browse files
support sparksql xxhash64
1 parent 56c927d commit 522af8f

File tree

6 files changed

+397
-102
lines changed

6 files changed

+397
-102
lines changed

velox/common/base/BitUtil.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,10 @@ inline uint32_t rotateLeft(uint32_t a, int shift) {
917917
#endif
918918
}
919919

920+
inline uint64_t rotateLeft64(uint64_t a, int32_t shift) {
921+
return (a << shift) | (a >> (64 - shift));
922+
}
923+
920924
/// Pads bytes starting at 'pointer + padIndex' up until the next
921925
/// offset from 'pointer' that is a multiple of 'alignment'. If
922926
/// 'padIndex' is 5 and alignment is 16, writes 11 zero bytes to

velox/functions/prestosql/aggregates/tests/PrestoHasherTest.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ TEST_F(PrestoHasherTest, floats) {
227227

228228
TEST_F(PrestoHasherTest, varchars) {
229229
assertHash<StringView>(
230-
{"abcd"_sv, ""_sv, std::nullopt, "Thanks \u0020\u007F"_sv},
231-
{-2449070131962342708, -1205034819632174695, 0, 2911531567394159200});
230+
{"abcd"_sv, ""_sv, std::nullopt, "Thanks \u0020\u007F"_sv, ""},
231+
{-2449070131962342708, -1205034819632174695, 0, 2911531567394159200, -1205034819632174695});
232232
}
233233

234234
TEST_F(PrestoHasherTest, bools) {
@@ -313,6 +313,14 @@ TEST_F(PrestoHasherTest, maps) {
313313
{9155312661752487122, 6562918552317873797, 2644717257979355699});
314314
}
315315

316+
TEST_F(PrestoHasherTest, rowsStringInt32) {
317+
auto row = makeRowVector(
318+
{makeNullableFlatVector<StringView>({std::nullopt, ""}),
319+
makeNullableFlatVector<int32_t>({0, 0})});
320+
321+
assertHash(row, {961, -462591261178311352});
322+
}
323+
316324
TEST_F(PrestoHasherTest, rows) {
317325
auto row = makeRowVector(
318326
{makeFlatVector<int64_t>({1, 3}), makeFlatVector<int64_t>({2, 4})});

0 commit comments

Comments
 (0)