@@ -1183,7 +1183,7 @@ mod test {
1183
1183
db. register_table_function :: < ArrowVTab > ( "arrow" ) ?;
1184
1184
1185
1185
let rbs: Vec < RecordBatch > = db
1186
- . prepare ( "SELECT * FROM read_parquet('./examples/int32_decimal.parquet');" ) ?
1186
+ . prepare ( "SELECT value::DECIMAL(38,0) as value FROM read_parquet('./examples/int32_decimal.parquet');" ) ?
1187
1187
. query_arrow ( [ ] ) ?
1188
1188
. collect ( ) ;
1189
1189
let param = arrow_recordbatch_to_query_params ( rbs. into_iter ( ) . next ( ) . unwrap ( ) ) ;
@@ -1193,7 +1193,7 @@ mod test {
1193
1193
assert_eq ! ( rb. num_columns( ) , 1 ) ;
1194
1194
let column = rb. column ( 0 ) . as_any ( ) . downcast_ref :: < Decimal128Array > ( ) . unwrap ( ) ;
1195
1195
assert_eq ! ( column. len( ) , 1 ) ;
1196
- assert_eq ! ( column. value( 0 ) , i128 :: from( 30000 ) ) ;
1196
+ assert_eq ! ( column. value( 0 ) , i128 :: from( 300 ) ) ;
1197
1197
Ok ( ( ) )
1198
1198
}
1199
1199
@@ -1616,17 +1616,17 @@ mod test {
1616
1616
fn test_decimal128_roundtrip ( ) -> Result < ( ) , Box < dyn Error > > {
1617
1617
// With default width and scale
1618
1618
let array: PrimitiveArray < arrow:: datatypes:: Decimal128Type > =
1619
- Decimal128Array :: from ( vec ! [ i128 :: from( 1 ) , i128 :: from( 2 ) , i128 :: from( 3 ) ] ) ;
1619
+ Decimal128Array :: from ( vec ! [ i128 :: from( 1 ) , i128 :: from( 2 ) , i128 :: from( 3 ) ] ) ;
1620
1620
check_rust_primitive_array_roundtrip ( array. clone ( ) , array) ?;
1621
1621
1622
1622
// With custom width and scale
1623
1623
let array: PrimitiveArray < arrow:: datatypes:: Decimal128Type > =
1624
- Decimal128Array :: from ( vec ! [ i128 :: from( 12345 ) ] ) . with_data_type ( DataType :: Decimal128 ( 5 , 2 ) ) ;
1624
+ Decimal128Array :: from ( vec ! [ i128 :: from( 12345 ) ] ) . with_data_type ( DataType :: Decimal128 ( 38 , 10 ) ) ;
1625
1625
check_rust_primitive_array_roundtrip ( array. clone ( ) , array) ?;
1626
1626
1627
1627
// With width and zero scale
1628
1628
let array: PrimitiveArray < arrow:: datatypes:: Decimal128Type > =
1629
- Decimal128Array :: from ( vec ! [ i128 :: from( 12345 ) ] ) . with_data_type ( DataType :: Decimal128 ( 5 , 0 ) ) ;
1629
+ Decimal128Array :: from ( vec ! [ i128 :: from( 12345 ) ] ) . with_data_type ( DataType :: Decimal128 ( 38 , 0 ) ) ;
1630
1630
check_rust_primitive_array_roundtrip ( array. clone ( ) , array) ?;
1631
1631
1632
1632
Ok ( ( ) )
0 commit comments