Skip to content

Commit 03c502e

Browse files
authored
Merge pull request apache#57 from zhouyuan/wip_cast
[C++][Gandiva] Support more types for Cast
2 parents 61ff765 + b4cf046 commit 03c502e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cpp/src/gandiva/function_registry_arithmetic.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ std::vector<NativeFunction> GetArithmeticFunctionRegistry() {
3737
static std::vector<NativeFunction> arithmetic_fn_registry_ = {
3838
UNARY_SAFE_NULL_IF_NULL(not, {}, boolean, boolean),
3939
UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, int32, int64),
40+
UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, float32, int64),
41+
UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, float64, int64),
42+
UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, date64, int64),
4043
UNARY_SAFE_NULL_IF_NULL(castINT, {}, int64, int32),
4144
UNARY_SAFE_NULL_IF_NULL(castINT, {}, date32, int32),
45+
UNARY_SAFE_NULL_IF_NULL(castINT, {}, float32, int32),
46+
UNARY_SAFE_NULL_IF_NULL(castINT, {}, float64, int32),
4247
UNARY_SAFE_NULL_IF_NULL(castBIGINT, {}, decimal128, int64),
4348

4449
// cast to float32

cpp/src/gandiva/precompiled/arithmetic_ops.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,13 @@ NUMERIC_DATE_TYPES(BINARY_RELATIONAL, greater_than_or_equal_to, >=)
106106
}
107107

108108
CAST_UNARY(castBIGINT, int32, int64)
109+
CAST_UNARY(castBIGINT, date64, int64)
110+
CAST_UNARY(castBIGINT, float32, int64)
111+
CAST_UNARY(castBIGINT, float64, int64)
109112
CAST_UNARY(castINT, int64, int32)
110113
CAST_UNARY(castINT, date32, int32)
114+
CAST_UNARY(castINT, float32, int32)
115+
CAST_UNARY(castINT, float64, int32)
111116
CAST_UNARY(castFLOAT4, int32, float32)
112117
CAST_UNARY(castFLOAT4, int64, float32)
113118
CAST_UNARY(castFLOAT8, int32, float64)

0 commit comments

Comments
 (0)