@@ -46,9 +46,9 @@ impl CompareKernel for DecimalBytePartsVTable {
4646 . vortex_expect ( "checked for null in entry func" ) ;
4747
4848 match decimal_value_wrapper_to_primitive ( rhs_decimal, lhs. msp . as_primitive_typed ( ) . ptype ( ) )
49- . map ( |value| Scalar :: new ( scalar_type. clone ( ) , Some ( value) ) )
5049 {
51- Ok ( encoded_scalar) => {
50+ Ok ( value) => {
51+ let encoded_scalar = Scalar :: try_new ( scalar_type, Some ( value) ) ?;
5252 let encoded_const = ConstantArray :: new ( encoded_scalar, rhs. len ( ) ) ;
5353 compare ( & lhs. msp , & encoded_const. to_array ( ) , operator) . map ( Some )
5454 }
@@ -166,7 +166,7 @@ mod tests {
166166 . unwrap ( )
167167 . to_array ( ) ;
168168 let rhs = ConstantArray :: new (
169- Scalar :: new ( dtype, Some ( DecimalValue :: I64 ( 400 ) . into ( ) ) ) ,
169+ Scalar :: try_new ( dtype, Some ( DecimalValue :: I64 ( 400 ) . into ( ) ) ) . unwrap ( ) ,
170170 lhs. len ( ) ,
171171 ) ;
172172
@@ -218,10 +218,11 @@ mod tests {
218218 . to_array ( ) ;
219219 // This cannot be converted to a i32.
220220 let rhs = ConstantArray :: new (
221- Scalar :: new (
221+ Scalar :: try_new (
222222 dtype. clone ( ) ,
223223 Some ( DecimalValue :: I128 ( -9999999999999965304 ) . into ( ) ) ,
224- ) ,
224+ )
225+ . unwrap ( ) ,
225226 lhs. len ( ) ,
226227 ) ;
227228
@@ -239,7 +240,7 @@ mod tests {
239240
240241 // This cannot be converted to a i32.
241242 let rhs = ConstantArray :: new (
242- Scalar :: new ( dtype, Some ( DecimalValue :: I128 ( 9999999999999965304 ) . into ( ) ) ) ,
243+ Scalar :: try_new ( dtype, Some ( DecimalValue :: I128 ( 9999999999999965304 ) . into ( ) ) ) . unwrap ( ) ,
243244 lhs. len ( ) ,
244245 ) ;
245246
0 commit comments