From ef5368cab7f86a286808edc33577a1f8ff5ca89d Mon Sep 17 00:00:00 2001 From: Anton Alkin Date: Fri, 9 Aug 2024 13:25:55 +0200 Subject: [PATCH] add int16 to int32 and float32 cast --- cpp/src/gandiva/function_registry_arithmetic.cc | 6 ++++-- cpp/src/gandiva/precompiled/arithmetic_ops.cc | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cpp/src/gandiva/function_registry_arithmetic.cc b/cpp/src/gandiva/function_registry_arithmetic.cc index 8d9da38430054..0bbe568f5099b 100644 --- a/cpp/src/gandiva/function_registry_arithmetic.cc +++ b/cpp/src/gandiva/function_registry_arithmetic.cc @@ -65,12 +65,14 @@ std::vector GetArithmeticFunctionRegistry() { UNARY_SAFE_NULL_IF_NULL(not, {}, boolean, boolean), UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, int32, int64), UNARY_SAFE_NULL_IF_NULL(castINT, {}, int64, int32), + UNARY_SAFE_NULL_IF_NULL(castINT, {}, int16, int32), UNARY_SAFE_NULL_IF_NULL(castINT, {}, int8, int32), UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, decimal128, int64), // cast to float32 - UNARY_CAST_TO_FLOAT32(int32), UNARY_CAST_TO_FLOAT32(int64), - UNARY_CAST_TO_FLOAT32(float64), UNARY_CAST_TO_FLOAT32(int8), + UNARY_CAST_TO_FLOAT32(int8), UNARY_CAST_TO_FLOAT32(int16), + UNARY_CAST_TO_FLOAT33(int64), UNARY_CAST_TO_FLOAT32(float64), + UNARY_CAST_TO_FLOAT32(int32), // cast to int32 UNARY_CAST_TO_INT32(float32), UNARY_CAST_TO_INT32(float64), diff --git a/cpp/src/gandiva/precompiled/arithmetic_ops.cc b/cpp/src/gandiva/precompiled/arithmetic_ops.cc index c1f8a120513ee..4bac904531a53 100644 --- a/cpp/src/gandiva/precompiled/arithmetic_ops.cc +++ b/cpp/src/gandiva/precompiled/arithmetic_ops.cc @@ -217,7 +217,9 @@ NUMERIC_DATE_TYPES(COMPARE_SIX_VALUES, least, <) CAST_UNARY(castBIGINT, int32, int64) CAST_UNARY(castINT, int64, int32) CAST_UNARY(castINT, int8, int32) +CAST_UNARY(castINT, int16, int32) CAST_UNARY(castFLOAT4, int8, float32) +CAST_UNARY(castFLOAT4, int16, float32) CAST_UNARY(castFLOAT4, int32, float32) CAST_UNARY(castFLOAT4, int64, float32) CAST_UNARY(castFLOAT8, int32, float64)