codeant-ai-for-open-source[bot] commented on code in PR #45782:
URL: https://github.com/apache/superset/pull/45782#discussion_r4433992670


##########
superset/utils/csv.py:
##########
@@ -107,13 +108,27 @@ def escape_values(v: Any) -> Union[str, Any]:
     # even when the DataFrame has a non-default index (e.g. the flattened
     # MultiIndex produced by pivot_table_v2 post-processing). Pairing 
positional
     # indices with the label-based ``.at`` accessor would otherwise create
-    # phantom rows and corrupt the output. Only string cells are reassigned, so
-    # the dtype of mixed object columns (e.g. nullable integers) is preserved.
+    # phantom rows and corrupt the output. Numeric dtypes are left for pandas;
+    # object columns need explicit formatting to match streaming CSV exports.
+    decimal_separator = kwargs.get("decimal", ".")
     for name, column in df.items():
         if pd.api.types.is_string_dtype(column.dtype):
             for label, value in column.items():
                 if isinstance(value, str):
                     df.at[label, name] = escape_value(value)
+                elif isinstance(value, Decimal) and value.is_finite():
+                    # Preserve precision and scale without passing numeric text
+                    # through the string formula-prefix escaping path.
+                    df.at[label, name] = format_decimal(value).replace(
+                        ".", decimal_separator
+                    )

Review Comment:
   ✅ **CodeAnt verified this suggestion was addressed in subsequent commits and 
marked this thread resolved** as of `6904e72`.
   
   The loop now assigns formatted values with `df.iat[row_position, 
column_position]`, addressing cells by physical position rather than 
potentially duplicated row labels.
   
   <sub>If that's not right, unresolve this thread and CodeAnt will leave it 
open.</sub>
   
   <!-- codeant-auto-resolve-reply -->



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