rusackas commented on code in PR #42594:
URL: https://github.com/apache/superset/pull/42594#discussion_r3741269675
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -434,7 +434,14 @@ export function extractDataTotalValues(
return prev;
}
const value = datum[curr] || 0;
- return prev + (value as number);
+ // Query results with integers beyond Number.MAX_SAFE_INTEGER are
+ // parsed as native BigInt (see
+ // packages/superset-ui-core/src/connection/callApi/parseResponse.ts).
+ // Normalize to Number before summing so BigInt and Number values
+ // can be combined without throwing (see #36401).
+ const numericValue =
+ typeof value === 'bigint' ? Number(value) : (value as number);
Review Comment:
Confirmed and fixed in 734c71a0. Normalization now happens once, when
`extractSeries` builds its internal `rows`, before `sortAndFilterSeries` ever
runs — so the default Sum sort (and Min/Max/Avg) never sees a raw BigInt. Added
a regression test that reproduces the exact two-row `sumBy` throw against the
unfixed code.
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -699,7 +706,17 @@ export function extractSeries(
stack === StackControlsValue.Expand &&
totalStackedValue !== undefined
) {
- value = ((value || 0) as number) / totalStackedValue;
+ // Query results with integers beyond Number.MAX_SAFE_INTEGER are
+ // parsed as native BigInt (see
+ //
packages/superset-ui-core/src/connection/callApi/parseResponse.ts).
+ // totalStackedValue is always a Number (extractDataTotalValues
+ // normalizes it), so dividing a raw BigInt datum value by it
+ // throws; normalize to Number first (see #36401).
+ const numericValue =
Review Comment:
Confirmed and fixed in 734c71a0, same root fix as the sort thread —
`extractSeries` now normalizes BigInt to Number for every field when it builds
`rows`, so `getBaselineSeriesForStream`'s `0.5 * delta` weighting never sees a
raw BigInt either. Added a Stream-mode regression test.
--
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]