kosiew commented on code in PR #20268:
URL: https://github.com/apache/datafusion/pull/20268#discussion_r2852324601


##########
datafusion/spark/src/function/string/format_string.rs:
##########
@@ -2082,6 +2085,10 @@ impl ConversionSpecifier {
             }
         };
 
+        if self.grouping_separator {
+            number = insert_thousands_separator(&number);
+        }

Review Comment:
   Would this be applied unconditionally for decimal formatting, including 
scientific / compact-scientific output?



##########
datafusion/spark/src/function/string/format_string.rs:
##########
@@ -2391,4 +2419,51 @@ mod tests {
 
         Ok(())
     }
+
+    #[test]
+    fn test_insert_thousands_separator() {
+        assert_eq!(insert_thousands_separator("1234567.89"), "1,234,567.89");
+        assert_eq!(insert_thousands_separator("123.45"), "123.45");
+        assert_eq!(insert_thousands_separator("1234"), "1,234");
+        assert_eq!(insert_thousands_separator("12"), "12");
+        assert_eq!(insert_thousands_separator("0.5"), "0.5");
+        assert_eq!(
+            insert_thousands_separator("1234567890.1234"),
+            "1,234,567,890.1234"
+        );
+        assert_eq!(insert_thousands_separator("1000"), "1,000");
+        assert_eq!(insert_thousands_separator("100"), "100");
+    }
+
+    #[test]
+    fn test_grouping_separator_float() -> Result<()> {

Review Comment:
   I think add tests for scientific/compact + grouping (especially precision 
`0`) where exponent formatting is sensitive, would be helpful



-- 
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