You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "massucattoj (via GitHub)" <gi...@apache.org> on 2026/05/10 13:42:22 UTC
[PR] fix(sqllab): handle scientific notation in big number JSON responses [superset]
massucattoj opened a new pull request, #39994:
URL: https://github.com/apache/superset/pull/39994
### SUMMARY
SQL Lab queries that returned a number in scientific notation with high mantissa precision (e.g. 4.799703045723905e+32) were considered failed by the UI even though the backend returned HTTP 200 with the correct
data.
Root cause: when parseMethod: 'json-bigint' is used, the response parser at superset-frontend/packages/superset-ui-core/src/connection/callApi/parseResponse.ts walks the JSON tree with cloneDeepWith and promotes
BigNumber values that exceed Number.MAX_SAFE_INTEGER to BigInt. The promotion was done with BigInt(value), which calls value.toString() implicitly. For values whose mantissa exceeds Number's ~15-digit precision,
BigNumber.toString() returns scientific notation (e.g. "4.799703045723905e+32"), and BigInt() rejects that format with a SyntaxError. The thrown error escaped the response parser, the SQL Lab action treated the
response as invalid, and the UI reported the query as failed at the "Validate query" step.
Fix: use BigNumber.toFixed() to obtain a plain-digit string before passing it to BigInt(). The branch is already gated by value.isInteger() === true, so toFixed() is guaranteed to return a string of digits with
no decimal point. This matches the original intent of the code (preserve precision for very large integers) without changing behavior for any other case.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
<img width="1131" height="796" alt="image" src="https://github.com/user-attachments/assets/304134a7-cecb-44ee-91a3-5eaaa1ef6b4c" />
After:
<img width="954" height="514" alt="Screenshot 2026-05-10 at 10 32 12" src="https://github.com/user-attachments/assets/621a625a-e99b-407a-b061-392b4bf38ef6" />
### TESTING INSTRUCTIONS
1. Navigate to SQL Lab.
2. Pick any database (the examples SQLite DB works).
3. Execute:
SELECT 4.799703045723905e+32 AS big_double, 1 AS one;
4. Verify the query succeeds and the results table renders one row with both columns populated.
5. Without the fix the same query fails at the "Validate query" step with SyntaxError: Cannot convert 4.799703045723905e+32 to a BigInt in the browser console, even though /api/v1/sqllab/execute/ returns 200 with
the data.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): handle scientific notation in big number JSON responses [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39994:
URL: https://github.com/apache/superset/pull/39994#issuecomment-4415465609
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39994?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 63.82%. Comparing base ([`f67dd4a`](https://app.codecov.io/gh/apache/superset/commit/f67dd4a8f3af0d5395f4cb95ab3c1d593c8d867f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9380495`](https://app.codecov.io/gh/apache/superset/commit/9380495a5464667e990bc74561b7c656ce8d36cf?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #39994 +/- ##
==========================================
- Coverage 63.83% 63.82% -0.01%
==========================================
Files 2589 2589
Lines 137821 137821
Branches 31928 31928
==========================================
- Hits 87978 87971 -7
- Misses 48327 48334 +7
Partials 1516 1516
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/39994/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/39994/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.52% <100.00%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39994?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): handle scientific notation in big number JSON responses [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #39994:
URL: https://github.com/apache/superset/pull/39994#discussion_r3236438983
##########
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());
Review Comment:
`toFixed()` is doing important correctness work here (no exponent form) and relies on implicit defaults. To make the intent unambiguous and more resilient to library/config differences, consider calling `toFixed(0)` explicitly (since the branch is gated by `isInteger() === true`). This also documents that the output must be an integer-only string suitable for `BigInt()`.
##########
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());
Review Comment:
This change can materially increase worst-case CPU/memory usage: `toFixed()` will expand very large exponents into a full digit string, which could be extremely large (potentially freezing the UI or exhausting memory) if a response contains enormous integers. Consider adding a defensive cap (e.g., based on `value.e`/exponent or estimated digit length) and falling back to leaving the value as-is (BigNumber) or returning a string representation when it exceeds a reasonable threshold.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): handle scientific notation in big number JSON responses [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39994:
URL: https://github.com/apache/superset/pull/39994#issuecomment-4415432642
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(sqllab): handle scientific notation in big number JSON responses [superset]
Posted by "kgabryje (via GitHub)" <gi...@apache.org>.
kgabryje merged PR #39994:
URL: https://github.com/apache/superset/pull/39994
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org