deepujain opened a new pull request, #44507:
URL: https://github.com/apache/superset/pull/44507

   ### SUMMARY
   
   Fixes #44007.
   
   Query results with integers beyond `Number.MAX_SAFE_INTEGER` are parsed as 
native BigInt (see 
`packages/superset-ui-core/src/connection/callApi/parseResponse.ts`). The 
memory number formatter called `Math.abs(value)` directly, which throws 
`TypeError: Cannot convert a BigInt value to a number` when a metric column 
holds such a value and a memory number format (for example MEMORY_BINARY) is 
applied, leaving the Table chart cell empty on cached loads.
   
   The fix normalizes BigInt values to Number before the Math operations in 
`formatMemory`, following the same pattern used in #42594 for the ECharts 
stacked-chart path. A regression test covers the issue's exact case.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Not applicable: no visual change. Formatter output for regular numbers is 
unchanged; BigInt inputs that previously crashed now format (for example 
`BigInt('1425300509404304697')` with binary units renders `1.24EiB`).
   
   ### TESTING INSTRUCTIONS
   
   1. Run the Jest test for the memory formatter from `superset-frontend/`:
      `npx jest 
packages/superset-ui-core/test/number-format/factories/createMemoryFormatter.test.ts`
      The new `formats bigint values decoded by json-bigint` test passes and 
all pre-existing assertions still pass.
   2. Manual reproduction from the issue: in SQL Lab run `SELECT 
1425300509404304697::bigint AS big_bytes` (Postgres) or the ClickHouse 
equivalent, save it as a virtual dataset, create a Table chart with 
`MAX(big_bytes)`, set the number format to MEMORY_BINARY, and open the chart 
twice so the second load comes from cache. The cell now renders instead of 
staying empty with a console TypeError.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: #44007
   - [ ] 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: [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]

Reply via email to