Skip to content

Commit 1022595

Browse files
committed
disable_coalesce_ansi_mode
1 parent ee2f957 commit 1022595

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

native/spark-expr/src/math_funcs/checked_arithmetic.rs

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ use arrow::array::{ArrayRef, AsArray};
2020

2121
use crate::{divide_by_zero_error, EvalMode, SparkError};
2222
use arrow::datatypes::{
23-
ArrowPrimitiveType, DataType, Float32Type, Float64Type, Int32Type, Int64Type,
23+
ArrowPrimitiveType, DataType, Float16Type, Float32Type, Float64Type, Int16Type, Int32Type,
24+
Int64Type, Int8Type,
2425
};
2526
use datafusion::common::DataFusionError;
2627
use datafusion::physical_plan::ColumnarValue;
@@ -200,8 +201,20 @@ fn checked_arithmetic_internal(
200201
(ColumnarValue::Scalar(l), ColumnarValue::Scalar(r)) => (l.to_array()?, r.to_array()?),
201202
};
202203

203-
// Rust only supports checked_arithmetic on Int32 and Int64
204+
// Rust only supports checked_arithmetic on numeric types
204205
let result_array = match data_type {
206+
DataType::Int8 => try_arithmetic_kernel::<Int8Type>(
207+
left_arr.as_primitive::<Int8Type>(),
208+
right_arr.as_primitive::<Int8Type>(),
209+
op,
210+
is_ansi_mode,
211+
),
212+
DataType::Int16 => try_arithmetic_kernel::<Int16Type>(
213+
left_arr.as_primitive::<Int16Type>(),
214+
right_arr.as_primitive::<Int16Type>(),
215+
op,
216+
is_ansi_mode,
217+
),
205218
DataType::Int32 => try_arithmetic_kernel::<Int32Type>(
206219
left_arr.as_primitive::<Int32Type>(),
207220
right_arr.as_primitive::<Int32Type>(),
@@ -214,6 +227,12 @@ fn checked_arithmetic_internal(
214227
op,
215228
is_ansi_mode,
216229
),
230+
DataType::Float16 => try_arithmetic_kernel::<Float16Type>(
231+
left_arr.as_primitive::<Float16Type>(),
232+
right_arr.as_primitive::<Float16Type>(),
233+
op,
234+
is_ansi_mode,
235+
),
217236
DataType::Float32 => try_arithmetic_kernel::<Float32Type>(
218237
left_arr.as_primitive::<Float32Type>(),
219238
right_arr.as_primitive::<Float32Type>(),

0 commit comments

Comments
 (0)