SEPURI-SAI-KRISHNA commented on code in PR #45410:
URL: https://github.com/apache/superset/pull/45410#discussion_r4402748534
##########
superset/charts/client_processing.py:
##########
@@ -1372,6 +1455,31 @@ def label_of(name: str) -> str:
# left untouched, matching the browser.
for column in df.columns:
config = config_by_label.get(column) or {}
+
+ # Mirror the Table plugin's first formatter branch
+ # (``if (isTime || config.d3TimeFormat)`` in ``transformProps.ts``):
+ # an explicit per-column ``d3TimeFormat`` formats a temporal column and
+ # takes precedence over number formatting. Scoped to a datetime column
+ # carrying a format every directive of which ``strftime`` reads the
same
+ # way. A column of another dtype has no ``strftime`` to call, and the
+ # bare ``isTime`` fallback, the ``tableTimestampFormat`` default,
+ # adaptive granularity and string temporal columns are left to a
+ # follow-up: they need a full server-side d3-time-format port rather
+ # than ``strftime``.
+ # ``TimeFormatterRegistry.get`` trims the format before building the
+ # formatter while d3 itself does not, so ``utcFormat(" %Y ")`` returns
+ # ``" 2024 "`` and without the strip the report keeps padding the chart
+ # dropped. One that is only whitespace strips to empty and falls
+ # through unformatted, like one whose directives cannot be reproduced.
+ time_format = (config.get("d3TimeFormat") or "").strip()
Review Comment:
Confirmed. `config.get("d3TimeFormat", "").strip()` keeps all 314 green, and
a
null raises `AttributeError: 'NoneType' object has no attribute 'strip'`
right
there.
Added `test_table_leaves_a_null_time_format_alone`: a datetime `ds` carrying
`{"d3TimeFormat": None}` next to a `,.1f` metric, asserting the timestamp is
untouched and the metric still formats. It is the only failure under that
swap.
`column_config` reaches here from `params`, which is a plain string field
with
no schema over its contents, which is why
`has_auto_currency_in_column_config`
and `security_manager` both isinstance-check it before reading.
--
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]