Skip to content

Commit

Permalink
feat: Add combine_hash internal operator (#12244)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #12244

Add combine_hash internal function to unblock join prefilter optimization in Prestissimo.

Reviewed By: Yuhta

Differential Revision: D69007969

fbshipit-source-id: 037ef0e54034c75023bb0d1af5d1b961a0a6f610
  • Loading branch information
pradeepvaka authored and facebook-github-bot committed Feb 5, 2025
1 parent f6fe8a3 commit ddc20e6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions velox/functions/prestosql/IntegerFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,20 @@ struct XxHash64BigIntFunction {
}
};

// combine_hash(bigint, bigint) → bigint
template <typename T>
struct CombineHashFunction {
VELOX_DEFINE_FUNCTION_TYPES(T);

FOLLY_ALWAYS_INLINE
void call(
out_type<int64_t>& result,
const arg_type<int64_t>& previousHashValue,
const arg_type<int64_t>& input) {
result = static_cast<int64_t>(
31 * static_cast<uint64_t>(previousHashValue) +
static_cast<uint64_t>(input));
}
};

} // namespace facebook::velox::functions
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace {
void registerSimpleFunctions(const std::string& prefix) {
registerFunction<XxHash64BigIntFunction, int64_t, int64_t>(
{prefix + "xxhash64_internal"});

registerFunction<CombineHashFunction, int64_t, int64_t, int64_t>(
{prefix + "combine_hash_internal"});
}
} // namespace

Expand Down

0 comments on commit ddc20e6

Please sign in to comment.