bito-code-review[bot] commented on code in PR #44044:
URL: https://github.com/apache/superset/pull/44044#discussion_r4079311147
##########
superset-frontend/plugins/plugin-chart-table/src/utils/formatValue.ts:
##########
@@ -51,12 +51,25 @@ function formatValue(
return [false, 'N/A'];
}
if (formatter) {
+ // Query results with integers beyond Number.MAX_SAFE_INTEGER are now
+ // parsed as decimal strings by parseResponse.ts (e.g.
"12345678901234567890").
+ // Accept both native bigint (legacy / direct callers) and decimal-integer
+ // strings. The /^-?\d+$/ guard is intentionally strict: floats, NaN,
+ // Infinity, scientific-notation strings, and pre-formatted values must
+ // NOT be coerced here — they flow through as-is so NumberFormatter can
+ // handle them with its own null/NaN/Infinity guards.
+ const numericValue: number =
+ typeof value === 'bigint'
+ ? Number(value)
+ : typeof value === 'string' && /^-?\d+$/.test(value)
+ ? Number(value)
+ : (value as number);
Review Comment:
<!-- Bito Reply -->
The suggestion to centralize the integer guard is appropriate, as it
improves maintainability by ensuring consistent validation across the codebase.
Tracking this as a follow-up task is a reasonable approach to avoid scope creep
while addressing the identified duplication.
--
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]