You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by kg...@apache.org on 2026/05/20 05:39:53 UTC
(superset) branch master updated: fix(sqllab): handle scientific notation in big number JSON responses (#39994)
This is an automated email from the ASF dual-hosted git repository.
kgabryje pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new e6179036ec6 fix(sqllab): handle scientific notation in big number JSON responses (#39994)
e6179036ec6 is described below
commit e6179036ec65fb7ad0a4a95e3574417ab46b5f59
Author: Jean Massucatto <ma...@gmail.com>
AuthorDate: Wed May 20 02:39:47 2026 -0300
fix(sqllab): handle scientific notation in big number JSON responses (#39994)
---
.../src/connection/callApi/parseResponse.ts | 3 ++-
.../test/connection/callApi/parseResponse.test.ts | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts b/superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts
index 4ee81b80b3a..2f914531bb5 100644
--- a/superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts
+++ b/superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts
@@ -63,7 +63,8 @@ export default async function parseResponse<T extends ParseMethod = 'json'>(
(value?.isGreaterThan?.(Number.MAX_SAFE_INTEGER) ||
value?.isLessThan?.(Number.MIN_SAFE_INTEGER))
) {
- return BigInt(value);
+ // toFixed() avoids scientific notation, which BigInt() rejects.
+ return BigInt(value.toFixed());
}
// // `json-bigint` could not handle floats well, see sidorares/json-bigint#62
// // TODO: clean up after json-bigint>1.0.1 is released
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
index ff618d6dd59..4c008b45f42 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
@@ -183,6 +183,26 @@ describe('parseResponse()', () => {
expect(responseBigNumber.json.constructor).toEqual('constructor');
});
+ test('handles big numbers in scientific notation when `parseMethod=json-bigint`', async () => {
+ const mockScientificUrl = '/mock/get/scientific';
+ const mockScientificPayload =
+ '{ "big_double": 4.799703045723905e+32, "negative_big": -4.799703045723905e+32, "small": 1 }';
+ fetchMock.get(mockScientificUrl, mockScientificPayload);
+
+ const responseBigNumber = await parseResponse(
+ callApi({ url: mockScientificUrl, method: 'GET' }),
+ 'json-bigint',
+ );
+
+ expect(`${responseBigNumber.json.big_double}`).toEqual(
+ '479970304572390500000000000000000',
+ );
+ expect(`${responseBigNumber.json.negative_big}`).toEqual(
+ '-479970304572390500000000000000000',
+ );
+ expect(responseBigNumber.json.small).toEqual(1);
+ });
+
test('rejects if request.ok=false', async () => {
expect.assertions(3);
const mockNotOkayUrl = '/mock/notokay/url';