Repository navigation
Commit bb75d92
authored
fix: support parentheses for negative decimal formatting (#23718)
## Which issue does this PR close?
- Closes #23717.
## Rationale for this change
Spark and Java format negative numeric values with parentheses when the
`(` flag is present. The decimal formatting path always emitted a minus
sign because it ignored `negative_in_parentheses`, while the
floating-point path already handled the flag. This made `format_string`
inconsistent across numeric input types.
## What changes are included in this PR?
- Add a closing suffix when a negative decimal uses parentheses
formatting.
- Include the suffix when calculating width, left alignment, and zero
padding.
- Add regression coverage for grouped negative decimals with and without
an explicit width.
## Are these changes tested?
Yes. The following checks pass locally:
- `cargo fmt --all -- --check`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion-spark --lib`
- The full workspace test command from the contributor guide with
`avro,json,backtrace,extended_tests,recursive_protection,parquet_encryption`
enabled
## Are there any user-facing changes?
Yes. Spark-compatible formatting of negative decimal values now honors
the parentheses flag. There are no public API or breaking changes.1 parent 0b07e58 commit bb75d92
1 file changed
Lines changed: 42 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1982 | 1982 | | |
1983 | 1983 | | |
1984 | 1984 | | |
| 1985 | + | |
1985 | 1986 | | |
1986 | 1987 | | |
1987 | 1988 | | |
| |||
1991 | 1992 | | |
1992 | 1993 | | |
1993 | 1994 | | |
1994 | | - | |
1995 | | - | |
1996 | | - | |
1997 | | - | |
1998 | 1995 | | |
1999 | 1996 | | |
2000 | 1997 | | |
2001 | 1998 | | |
2002 | | - | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
2003 | 2005 | | |
2004 | 2006 | | |
2005 | 2007 | | |
| |||
2078 | 2080 | | |
2079 | 2081 | | |
2080 | 2082 | | |
| 2083 | + | |
2081 | 2084 | | |
2082 | 2085 | | |
2083 | 2086 | | |
2084 | 2087 | | |
2085 | | - | |
| 2088 | + | |
2086 | 2089 | | |
2087 | 2090 | | |
2088 | 2091 | | |
2089 | 2092 | | |
2090 | 2093 | | |
2091 | | - | |
| 2094 | + | |
2092 | 2095 | | |
2093 | 2096 | | |
2094 | 2097 | | |
2095 | 2098 | | |
| 2099 | + | |
2096 | 2100 | | |
2097 | | - | |
| 2101 | + | |
2098 | 2102 | | |
2099 | 2103 | | |
2100 | 2104 | | |
| |||
2372 | 2376 | | |
2373 | 2377 | | |
2374 | 2378 | | |
2375 | | - | |
| 2379 | + | |
2376 | 2380 | | |
2377 | 2381 | | |
2378 | 2382 | | |
| |||
2896 | 2900 | | |
2897 | 2901 | | |
2898 | 2902 | | |
2899 | | - | |
2900 | | - | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
2901 | 2931 | | |
2902 | | - | |
2903 | 2932 | | |
2904 | 2933 | | |
2905 | 2934 | | |
2906 | 2935 | | |
2907 | 2936 | | |
2908 | 2937 | | |
2909 | | - | |
| 2938 | + | |
2910 | 2939 | | |
2911 | 2940 | | |
2912 | 2941 | | |
| |||
0 commit comments