diff --git a/velox/connectors/hive/HivePartitionFunction.cpp b/velox/connectors/hive/HivePartitionFunction.cpp index ad787455abc6..8f583164c1a6 100644 --- a/velox/connectors/hive/HivePartitionFunction.cpp +++ b/velox/connectors/hive/HivePartitionFunction.cpp @@ -46,8 +46,7 @@ int32_t hashTimestamp(const Timestamp& ts) { } template -inline uint32_t hashOne( - const typename TypeTraits::NativeType& /* value */) { +inline uint32_t hashOne(typename TypeTraits::NativeType /* value */) { VELOX_UNSUPPORTED( "Hive partitioning function doesn't support {} type", TypeTraits::name); @@ -55,57 +54,57 @@ inline uint32_t hashOne( } template <> -inline uint32_t hashOne(const bool& value) { +inline uint32_t hashOne(bool value) { return value ? 1 : 0; } template <> -inline uint32_t hashOne(const int8_t& value) { +inline uint32_t hashOne(int8_t value) { return static_cast(value); } template <> -inline uint32_t hashOne(const int16_t& value) { +inline uint32_t hashOne(int16_t value) { return static_cast(value); } template <> -inline uint32_t hashOne(const int32_t& value) { +inline uint32_t hashOne(int32_t value) { return static_cast(value); } template <> -inline uint32_t hashOne(const float& value) { +inline uint32_t hashOne(float value) { return static_cast(*reinterpret_cast(&value)); } template <> -inline uint32_t hashOne(const int64_t& value) { +inline uint32_t hashOne(int64_t value) { return hashInt64(value); } template <> -inline uint32_t hashOne(const double& value) { +inline uint32_t hashOne(double value) { return hashInt64(*reinterpret_cast(&value)); } template <> -inline uint32_t hashOne(const StringView& value) { +inline uint32_t hashOne(StringView value) { return hashBytes(value, 0); } template <> -inline uint32_t hashOne(const StringView& value) { +inline uint32_t hashOne(StringView value) { return hashBytes(value, 0); } template <> -inline uint32_t hashOne(const Timestamp& value) { +inline uint32_t hashOne(Timestamp value) { return hashTimestamp(value); } template <> -inline uint32_t hashOne(const UnknownValue& /*value*/) { +inline uint32_t hashOne(UnknownValue /*value*/) { VELOX_FAIL("Unknown values cannot be non-NULL"); }