You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/03/31 12:25:31 UTC

[GitHub] [arrow] projjal commented on a change in pull request #9785: ARROW-12069: [C++][Gandiva] Implement IN expressions for Decimal type

projjal commented on a change in pull request #9785:
URL: https://github.com/apache/arrow/pull/9785#discussion_r604849417



##########
File path: cpp/src/gandiva/decimal_scalar.h
##########
@@ -55,3 +55,19 @@ class DecimalScalar128 : public BasicDecimalScalar128 {
 };
 
 }  // namespace gandiva
+
+namespace std {
+template <>
+struct hash<gandiva::DecimalScalar128> {
+  std::size_t operator()(gandiva::DecimalScalar128 const& s) const noexcept {
+    arrow::BasicDecimal128 dvalue(s.value());
+    std::size_t h0 = std::hash<int64_t>{}(dvalue.high_bits());
+    std::size_t h1 = std::hash<uint64_t>{}(dvalue.low_bits());
+
+    std::size_t h2 = std::hash<int32_t>{}(s.precision());
+    std::size_t h3 = std::hash<int32_t>{}(s.scale());
+
+    return (((h0 ^ (h1 << 1) >> 1) ^ (h2 << 1) >> 1) ^ h3 << 1);

Review comment:
       why not use arrow:util:hash_combine




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org