From 0153b028cbeffb1e20f8f8bee561d5d02abe17d0 Mon Sep 17 00:00:00 2001 From: Joe Abraham Date: Wed, 3 Jul 2024 11:15:03 +0530 Subject: [PATCH] cc --- velox/functions/prestosql/BinaryFunctions.h | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/velox/functions/prestosql/BinaryFunctions.h b/velox/functions/prestosql/BinaryFunctions.h index 0a031c93f260c..ab68937e20ec5 100644 --- a/velox/functions/prestosql/BinaryFunctions.h +++ b/velox/functions/prestosql/BinaryFunctions.h @@ -337,22 +337,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()); } };