You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "aminghadersohi (via GitHub)" <gi...@apache.org> on 2026/03/03 19:07:57 UTC

Re: [PR] fix(mcp): fix crashes in list tools, dataset info, chart preview, and add owner/favorite filters [superset]

aminghadersohi commented on code in PR #38277:
URL: https://github.com/apache/superset/pull/38277#discussion_r2880001527


##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -182,19 +182,23 @@ def _calculate_column_widths(
 def _format_value(val: Any, width: int) -> str:
     """Format a value based on its type."""
     if isinstance(val, float):
-        if abs(val) >= 1000000:
+        import math
+
+        if math.isnan(val):
+            val_str = "N/A"
+        elif math.isfinite(val) and val.is_integer():
+            # Integer-like float (e.g. 1988.0) — format without decimals
+            val_str = str(int(val))
+        elif abs(val) >= 1000000:
             val_str = f"{val:.2e}"  # Scientific notation for large numbers
         elif abs(val) >= 1000:
             val_str = f"{val:,.2f}"  # Thousands separator
         else:
             val_str = f"{val:.2f}"

Review Comment:
   Good catch. Changed to `:g` format to preserve significant digits. Fixed in b755de7.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org