Unify Spark format_string integer assembly
Refactored datafusion-spark format_string decimal integer rendering so signed and unsigned %d values use the shared numeric final-assembly path.
apache/datafusion · #24480
Problem
Spark format_string had separate final-assembly paths for decimal integers and other numeric values. Sign placement, suffix placement, width padding, zero padding, and left adjustment could drift between integers, floats, and decimals as flag combinations changed.
Approach
Routed signed and unsigned decimal integer formatting through write_numeric_parts, kept integer conversion and grouping local to the integer formatter, preserved unsigned integer policy plus hexadecimal and octal prefix behavior, and added focused Rust and SQLLogicTest coverage for integer flags, decimal parentheses, non-finite float padding, and the minimum BIGINT boundary.
Impact and scope
- Reduces duplicated SQL-visible Spark compatibility formatting logic in DataFusion's Spark layer.
- Keeps public behavior stable while making width, sign, suffix, and padding semantics easier to audit across numeric conversions.
- Preserves current unsigned integer, hexadecimal, octal, decimal, and non-finite float behavior while tightening regression coverage.
Validation
- Added Rust and SQLLogicTest coverage for signed and unsigned integer flags, decimal parentheses, non-finite float padding, and minimum BIGINT formatting.
- Cross-checked signed integer expectations against Spark 4.2.0 in ANSI and non-ANSI modes.
- Ran formatting, strict clippy, datafusion-spark all-feature tests, focused Spark format_string sqllogictests, and broader CI-profile workspace tests.