Skip to content

Commit

Permalink
Add another decimal cast edge test case (#7078)
Browse files Browse the repository at this point in the history
* Add another decimal cast edge test case

Before 1019f5b this test would fail, as
the cast produced 1. 0 is an edge case worth explicitly testing for.

* typo/fmt

Co-authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>

---------

Co-authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
  • Loading branch information
findepi and felipecrv authored Feb 6, 2025
1 parent f4fe447 commit 8b2b1ef
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions arrow-cast/src/cast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10000,6 +10000,16 @@ mod tests {
result.unwrap().as_primitive::<Decimal128Type>().value(0),
520
);

// Cast 0 of decimal(3, 0) type to decimal(2, 0)
assert_eq!(
&cast(
&create_decimal_array(vec![Some(0)], 3, 0).unwrap(),
&DataType::Decimal128(2, 0)
)
.unwrap(),
&(Arc::new(create_decimal_array(vec![Some(0)], 2, 0).unwrap()) as ArrayRef)
);
}

#[test]
Expand Down

0 comments on commit 8b2b1ef

Please sign in to comment.