@@ -20,7 +20,8 @@ use arrow::array::{ArrayRef, AsArray};
2020
2121use crate :: { divide_by_zero_error, EvalMode , SparkError } ;
2222use arrow:: datatypes:: {
23- ArrowPrimitiveType , DataType , Float32Type , Float64Type , Int32Type , Int64Type ,
23+ ArrowPrimitiveType , DataType , Float16Type , Float32Type , Float64Type , Int16Type , Int32Type ,
24+ Int64Type , Int8Type ,
2425} ;
2526use datafusion:: common:: DataFusionError ;
2627use 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