MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_decimal_full_validation

Function test_decimal_full_validation

arrow/tests/array_validation.rs:1062–1078  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1060
1061#[test]
1062fn test_decimal_full_validation() {
1063 let array = Decimal128Array::from(vec![123456_i128])
1064 .with_precision_and_scale(5, 2)
1065 .unwrap();
1066 let error = array.validate_decimal_precision(5).unwrap_err();
1067 assert_eq!(
1068 "Invalid argument error: 1234.56 is too large to store in a Decimal128 of precision 5. Max is 999.99",
1069 error.to_string()
1070 );
1071
1072 let array = Decimal128Array::from(vec![123456_i128]);
1073 let error = array.validate_decimal_precision(5).unwrap_err();
1074 assert_eq!(
1075 "Invalid argument error: Decimal precision 5 is less than scale 10",
1076 error.to_string()
1077 );
1078}
1079
1080#[test]
1081fn test_decimal_validation() {

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected