Note that this only hashes the unscaled value and not the scale or precision, so this function is only valid when used over a single decimal type.
| 114 | // Note that this only hashes the unscaled value and not the scale or precision, so this |
| 115 | // function is only valid when used over a single decimal type. |
| 116 | BigIntVal UtilityFunctions::MurmurHashDecimal(FunctionContext* ctx, |
| 117 | const DecimalVal& input_val) { |
| 118 | if (input_val.is_null) return BigIntVal::null(); |
| 119 | const FunctionContext::TypeDesc& input_type = *ctx->GetArgType(0); |
| 120 | int byte_size = ColumnType::GetDecimalByteSize(input_type.precision); |
| 121 | // val4, val8 and val16 all start at the same memory address. |
| 122 | return BigIntVal(HashUtil::MurmurHash2_64(&input_val.val16, byte_size, |
| 123 | HashUtil::MURMUR_DEFAULT_SEED)); |
| 124 | } |
| 125 | |
| 126 | template BigIntVal UtilityFunctions::MurmurHash( |
| 127 | FunctionContext* ctx, const BooleanVal& input_val); |
nothing calls this directly
no test coverage detected