@@ -83,12 +83,8 @@ macro_rules! delegate_fn {
8383
8484impl DecimalBuilder {
8585 /// Creates a new `DecimalBuilder` with a capacity of [`DEFAULT_BUILDER_CAPACITY`].
86- pub fn new < T : NativeDecimalType > ( precision : u8 , scale : i8 , nullability : Nullability ) -> Self {
87- Self :: with_capacity :: < T > (
88- DEFAULT_BUILDER_CAPACITY ,
89- DecimalDType :: new ( precision, scale) ,
90- nullability,
91- )
86+ pub fn new < T : NativeDecimalType > ( decimal : DecimalDType , nullability : Nullability ) -> Self {
87+ Self :: with_capacity :: < T > ( DEFAULT_BUILDER_CAPACITY , decimal, nullability)
9288 }
9389
9490 /// Creates a new `DecimalBuilder` with the given `capacity`.
@@ -293,13 +289,13 @@ mod tests {
293289 fn test_mixed_extend ( ) {
294290 let values = 42i8 ;
295291
296- let mut i8s = DecimalBuilder :: new :: < i8 > ( 2 , 1 , false . into ( ) ) ;
292+ let mut i8s = DecimalBuilder :: new :: < i8 > ( DecimalDType :: new ( 2 , 1 ) , false . into ( ) ) ;
297293 for v in 0 ..values {
298294 i8s. append_value ( v) ;
299295 }
300296 let i8s = i8s. finish ( ) ;
301297
302- let mut i128s = DecimalBuilder :: new :: < i128 > ( 2 , 1 , false . into ( ) ) ;
298+ let mut i128s = DecimalBuilder :: new :: < i128 > ( DecimalDType :: new ( 2 , 1 ) , false . into ( ) ) ;
303299 i128s. extend_from_array ( & i8s) ;
304300 let i128s = i128s. finish ( ) ;
305301
@@ -313,7 +309,7 @@ mod tests {
313309 use vortex_scalar:: Scalar ;
314310
315311 // Simply test that the builder accepts its own finish output via scalar.
316- let mut builder = DecimalBuilder :: new :: < i64 > ( 10 , 2 , true . into ( ) ) ;
312+ let mut builder = DecimalBuilder :: new :: < i64 > ( DecimalDType :: new ( 10 , 2 ) , true . into ( ) ) ;
317313 builder. append_value ( 1234i64 ) ;
318314 builder. append_value ( 5678i64 ) ;
319315 builder. append_null ( ) ;
@@ -326,7 +322,7 @@ mod tests {
326322 assert_arrays_eq ! ( & array, & expected) ;
327323
328324 // Test by taking a scalar from the array and appending it to a new builder.
329- let mut builder2 = DecimalBuilder :: new :: < i64 > ( 10 , 2 , true . into ( ) ) ;
325+ let mut builder2 = DecimalBuilder :: new :: < i64 > ( DecimalDType :: new ( 10 , 2 ) , true . into ( ) ) ;
330326 for i in 0 ..array. len ( ) {
331327 let scalar = array. scalar_at ( i) ;
332328 builder2. append_scalar ( & scalar) . unwrap ( ) ;
@@ -336,7 +332,7 @@ mod tests {
336332 assert_arrays_eq ! ( & array2, & array) ;
337333
338334 // Test wrong dtype error.
339- let mut builder = DecimalBuilder :: new :: < i64 > ( 10 , 2 , false . into ( ) ) ;
335+ let mut builder = DecimalBuilder :: new :: < i64 > ( DecimalDType :: new ( 10 , 2 ) , false . into ( ) ) ;
340336 let wrong_scalar = Scalar :: from ( true ) ;
341337 assert ! ( builder. append_scalar( & wrong_scalar) . is_err( ) ) ;
342338 }
0 commit comments