diff --git a/velox/functions/prestosql/BinaryFunctions.h b/velox/functions/prestosql/BinaryFunctions.h index 0a9cf9e57c644..eb1a758f02f07 100644 --- a/velox/functions/prestosql/BinaryFunctions.h +++ b/velox/functions/prestosql/BinaryFunctions.h @@ -353,22 +353,19 @@ struct ToBase32Function { } }; -template +template struct FromBase32Function { - VELOX_DEFINE_FUNCTION_TYPES(T); + VELOX_DEFINE_FUNCTION_TYPES(TExec); - FOLLY_ALWAYS_INLINE void call( - out_type& result, - const arg_type& input) { - try { - auto inputSize = input.size(); - result.resize( - encoding::Base32::calculateDecodedSize(input.data(), inputSize)); - encoding::Base32::decode( - input.data(), inputSize, result.data(), result.size()); - } catch (const encoding::EncoderException& e) { - VELOX_USER_FAIL(e.what()); - } + // T can be either arg_type or arg_type. These are the + // same, but hard-coding one of them might be confusing. + template + FOLLY_ALWAYS_INLINE void call(out_type& result, const T& input) { + auto inputSize = input.size(); + result.resize( + encoding::Base32::calculateDecodedSize(input.data(), inputSize)); + encoding::Base32::decode( + input.data(), inputSize, result.data(), result.size()); } };