Skip to content

fix(ag-grid-table): apply small number format to grid cells - #46689

Open
Raman-Katiyar wants to merge 1 commit into
apache:masterfrom
Raman-Katiyar:fix/ag-grid-small-number-format
Open

Raman-Katiyar wants to merge 1 commit into
apache:masterfrom
Raman-Katiyar:fix/ag-grid-small-number-format

Conversation

@Raman-Katiyar

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes #46688

The AG Grid Table painted grid cells through valueFormatter(), which used col.formatter(value) and never read col.config.d3SmallNumberFormat, so a column with a small number format rendered 0.1 as 0.10 while the classic Table rendered 10.00%. This mirrors formatColumnValue's small-number branch inside valueFormatter: a numeric column with |value| < 1 now uses getSmallNumberFormatter(col.formatter, col.config?.d3SmallNumberFormat, col.config?.currencyFormat); a null/blank small format falls back to the plain formatter. The existing CurrencyFormatter branch (row context for AUTO mode) and the string fallback are unchanged.

The backend report path is fixed in the same PR: table() in superset/charts/client_processing.py deliberately skipped the small format for AG Grid, so an emailed report would have shown 0.10 while the chart shows 10.00%. The exception is removed, so a report applies the format the same way the chart does.

Tree mode is a follow-up, not part of this change: TreeTableColumn carries no column config, so plumbing d3SmallNumberFormat into Tree mode child columns needs a separate change to the transform pipeline and types.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before: AG Grid cell for 0.1 (format ,.2f, small format .2%) read 0.10; classic Table read 10.00%; the emailed report read 0.10.
  • After: AG Grid cell, classic Table cell, and emailed report all read 10.00%; 1234.56 reads 1,234.56 everywhere.

TESTING INSTRUCTIONS

  • New Jest tests in superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/formatValue.test.ts: 6/6 pass (fail-before on master: 4 failed / 2 passed). Full plugin suite: 9 failed / 994 passed, identical to the master baseline (pre-existing TreeTable failures only).
  • tests/unit_tests/charts/test_client_processing.py: fail-before 2 failed, pass-after 2 passed; full module 417 passed.
  • Pre-commit green on all changed files (mypy, ruff, ruff-format, pylint, oxfmt, oxlint, custom rules, stylelint). Note: the frontend type-check reports 6 pre-existing TS6305 "output file has not been built" errors in the new test file (unbuilt packages/*/lib outputs); formatValue.ts itself has 0 errors and the same condition exists on master.
  • Live verification on an isolated stack: Explore side-by-side, AG Grid and classic Table both render 10.00% / 1,234.56; the chart-data API with result_type: post_processed (the report path) returns the same values for both charts.

ADDITIONAL INFORMATION

The AG Grid Table painted cells through valueFormatter(), which used
col.formatter(value) and never read col.config.d3SmallNumberFormat, so a
column with a small number format rendered 0.1 as 0.10 while the classic
Table rendered 10.00%. Mirror formatColumnValue's small-number branch in
valueFormatter, and drop the backend report path's AG Grid exception in
client_processing.table() so an emailed report matches the chart.
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

CodeAnt  CodeAnt PR Risk

🟢  Low Risk

  • The PR appears safe to merge; no actionable issues were identified in the review.

Assessed commit: bf556190531e

@codecov

codecov Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.42%. Comparing base (7819e82) to head (bf55619).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #46689   +/-   ##
=======================================
  Coverage   86.42%   86.42%           
=======================================
  Files        3183     3183           
  Lines      222605   222607    +2     
  Branches    52996    53000    +4     
=======================================
+ Hits       192377   192398   +21     
+ Misses      26758    26739   -19     
  Partials     3470     3470           
Flag Coverage Δ
hive 33.64% <50.00%> (+<0.01%) ⬆️
javascript 83.43% <100.00%> (+0.01%) ⬆️
mysql 51.83% <50.00%> (+<0.01%) ⬆️
postgres 51.85% <50.00%> (+<0.01%) ⬆️
presto 35.33% <50.00%> (+<0.01%) ⬆️
python 88.81% <100.00%> (-0.01%) ⬇️
sqlite 51.55% <50.00%> (+<0.01%) ⬆️
unit 84.37% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AG Grid Table ignores the column "Small number format" for grid cells

1 participant