goutamadwant commented on code in PR #24480:
URL: https://github.com/apache/datafusion/pull/24480#discussion_r3810893544


##########
datafusion/sqllogictest/test_files/spark/string/format_string.slt:
##########
@@ -2064,6 +2064,83 @@ SELECT format_string('Hex: %#08x', 255);
 ----
 Hex: 0x0000ff
 
+# ================================
+# Shared numeric final assembly
+# ================================
+
+## Signed integer parentheses and zero padding include the suffix in the width
+query T
+SELECT format_string('[%(08d]', -12::BIGINT);
+----
+[(000012)]
+
+## Signed integer parentheses stay before right padding
+query T
+SELECT format_string('[%-(8d]', -12::BIGINT);
+----
+[(12)    ]
+
+## Signed integer force-sign and zero padding
+query T
+SELECT format_string('[%+08d]', 12::BIGINT);
+----
+[+0000012]
+
+## Signed integer space-sign and zero padding
+query T
+SELECT format_string('[% 08d]', 12::BIGINT);
+----
+[ 0000012]
+
+## Negative integers keep their minus sign with force-sign or space-sign flags
+query TT
+SELECT
+  format_string('[%+08d]', -12::BIGINT),
+  format_string('[% 08d]', -12::BIGINT);
+----
+[-0000012] [-0000012]
+
+## Signed integer grouping, force-sign, and width
+query T
+SELECT format_string('[%+,12d]', 1234567::BIGINT);
+----
+[  +1,234,567]
+
+## Signed integer array input uses the same final assembly
+query T rowsort
+SELECT format_string('[%(08d]', value)

Review Comment:
   @kosiew Addressed. I added SQL-level regressions for the minimum BIGINT 
value using both `%d` and grouped-parentheses formatting. The literal is 
parenthesized before the cast because casting the positive token first exceeds 
BIGINT. I also verified that this regression fails with the previous `abs()` 
implementation due to integer overflow and passes with `unsigned_abs()`. Let me 
know if there are any other suggestions. thanks! 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to