SEPURI-SAI-KRISHNA opened a new issue, #45672:
URL: https://github.com/apache/superset/issues/45672
### Bug description
A table report of a time-comparison chart does not match the chart. Two
separate things are missing from `superset/charts/client_processing.py`, and
both affect `table` and `ag-grid-table` equally.
**The offset metric column is left unformatted.** `table()` looks each
column up by its exact label against `column_config` and the saved formats. A
comparison query emits `SUM(amount)` and `SUM(amount)__1 week ago`, and only
the first is a key anywhere, so the second goes out raw. With `column_config`
of `{"SUM(amount)": {"d3NumberFormat": ",.2f"}}` and a `1 week ago` comparison,
on master:
```
SUM(amount) -> '1,234,567.00'
SUM(amount)__1 week ago -> 1000000.0
```
**The columns the chart actually shows are not in the report at all.** The
browser does not render those two columns.
`plugin-chart-table/src/transformProps.ts` derives `Main <metric>`, `#
<metric>`, `△ <metric>` and `% <metric>` from them (`transformProps.ts:183`,
with `getComparisonColConfig` at `:345` resolving each one's format). None of
that happens on the report path, so the payload carries no such keys:
```
derived Main/#/△/% columns present in the report payload: []
```
So widening the label lookup would format a column the chart never displays,
while still omitting the four it does. Matching the chart means porting that
derivation to the report path for both viz types, then formatting the derived
columns, not just fixing the lookup.
To reproduce:
1. Build a Table or AG Grid Table chart with a metric, a time comparison
(`time_compare`), and a number format set on the metric in Customize.
2. Note the chart shows `Main`, `#`, `△` and `%` columns, formatted.
3. Schedule a report on that chart and open the attachment or the email body.
4. The report shows `<metric>` and `<metric>__<offset>` instead, with the
offset column unformatted.
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.11
### Node version
18 or greater
### Browser
Not applicable
### Additional context
Follow-up from the review of #45456, which registered `ag-grid-table`
against the `table` post-processor. That PR takes AG Grid reports from no
formatting at all to the same level as `table`, and this gap is pre-existing
and identical for both, so it was agreed not to block there.
`format_number_with_config` catches its own errors, so nothing crashes; the
cells are simply raw.
Related but separate: `table()` applies no time formatting either.
`d3TimeFormat` from `column_config` is handled in #45410.
`table_timestamp_format` is not applied anywhere on the report path.
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
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]