You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spark format_string ignores parentheses flag for negative decimals #23717
The Spark-compatible format_string function does not honor the ( flag when formatting negative Decimal values. Instead of enclosing the magnitude in parentheses, the decimal formatting path always emits a minus sign.
The floating-point formatting path already handles this flag correctly, so decimal and floating-point values currently produce inconsistent results.
To Reproduce
Format a negative decimal using the grouping separator and parentheses flags:
A fixed-width format such as %(,15.2f similarly produces a minus sign instead of parentheses.
Expected behavior
The result should match Spark/Java formatting semantics:
(1,234.50)
For %(,15.2f, the result should be padded to the requested width:
(1,234.50)
Additional context
ConversionSpecifier::format_decimal reads the sign but does not apply negative_in_parentheses. Supporting the flag also requires accounting for the closing parenthesis when applying width, left alignment, and zero padding.
Activity
Udaytaneja commentedon Jul 20, 2026
Hi mantainers , I am interested in doing this work . Please assign this to me .
fix: support parentheses for negative decimal formatting (apache#23718)
fix: support parentheses for negative decimal formatting (apache#23718)