Skip to content

Commit 0d51a2c

Browse files
test: cover Decimal256 parentheses formatting
1 parent 83a2090 commit 0d51a2c

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎datafusion/spark/src/function/string/format_string.rs‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2376,7 +2376,7 @@ mod tests {
23762376
use super::*;
23772377
use crate::function::utils::test::test_scalar_function;
23782378
use arrow::array::StringArray;
2379-
use arrow::datatypes::DataType::Utf8;
2379+
use arrow::datatypes::{DataType::Utf8, i256};
23802380

23812381
#[test]
23822382
fn test_format_string_nullability() -> Result<()> {
@@ -2912,6 +2912,22 @@ mod tests {
29122912
StringArray
29132913
);
29142914

2915+
test_scalar_function!(
2916+
FormatStringFunc::new(),
2917+
vec![
2918+
ColumnarValue::Scalar(ScalarValue::Utf8(Some("%(,.2f".to_string()))),
2919+
ColumnarValue::Scalar(ScalarValue::Decimal256(
2920+
Some(i256::from(-123450)),
2921+
10,
2922+
2,
2923+
)),
2924+
],
2925+
Ok(Some("(1,234.50)")),
2926+
&str,
2927+
Utf8,
2928+
StringArray
2929+
);
2930+
29152931
// Java: String.format("%(,15.2f", -1234.5) → " (1,234.50)"
29162932
test_scalar_function!(
29172933
FormatStringFunc::new(),

0 commit comments

Comments
 (0)