Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: BIGINT rendering regression in chartAction #21937

Merged
merged 3 commits into from
Oct 26, 2022

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Oct 25, 2022

SUMMARY

Since chart data api /api/v1/chart/data responds the bigint in number format, the number beyond the JS limit that are replaced with the special number.
This commit introduces new parseMethod json-bigint to fix the unmatched value displaying for these big numbers.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen Shot 2022-10-25 at 12 37 20 PM

After:

Screen Shot 2022-10-25 at 12 38 33 PM

TESTING INSTRUCTIONS

  • Go to sqllab and then make a simple query with a big number like SELECT 568485382077428896 as BIGNUM
  • Save dataset and then explore to a table chart
  • set query mode to Raw and then check the result

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

cc: @john-bodley @ktmud

};

return SupersetClient.post(querySettings);
return SupersetClient.post(querySettings).then(({ text, response }) => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinpark can we add a simply unit test which includes an integer with a value greater than 2^53 -1?

@ktmud
Copy link
Member

ktmud commented Oct 25, 2022

How about we change the default parseMethod = json to always use json-bigint? Or if performance is a concern, add a new ParseMethod = "json-bigint" so the response processing can be more unified?

@justinpark
Copy link
Member Author

How about we change the default parseMethod = json to always use json-bigint? Or if performance is a concern, add a new ParseMethod = "json-bigint" so the response processing can be more unified?

@ktmud good idea. I originally thought same way. let me add new parseMethod type

'json-bigint',
);
expect(`${responseBigNumber.json.value}`).toEqual('9223372036854775807');
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also mock a -2^63 to test int64? and we also need to add a comment to point out the integer type is that singed int64.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhaoyongjie good point. I added the spec for negative number.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Oct 25, 2022
@codecov
Copy link

codecov bot commented Oct 25, 2022

Codecov Report

Merging #21937 (13db562) into master (792820e) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #21937      +/-   ##
==========================================
+ Coverage   66.90%   66.92%   +0.01%     
==========================================
  Files        1807     1807              
  Lines       69183    69182       -1     
  Branches     7405     7403       -2     
==========================================
+ Hits        46288    46298      +10     
+ Misses      20985    20973      -12     
- Partials     1910     1911       +1     
Flag Coverage Δ
javascript 53.39% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...erset-frontend/src/components/Chart/chartAction.js 56.77% <ø> (ø)
...et-ui-core/src/connection/callApi/parseResponse.ts 100.00% <100.00%> (ø)
superset-frontend/src/SqlLab/actions/sqlLab.js 62.85% <100.00%> (-0.20%) ⬇️
...d/src/SqlLab/components/TabbedSqlEditors/index.jsx 49.03% <0.00%> (-5.67%) ⬇️
...-frontend/src/SqlLab/components/SouthPane/state.ts 100.00% <0.00%> (ø)
...frontend/src/SqlLab/components/SqlEditor/index.jsx 55.91% <0.00%> (ø)
...frontend/src/SqlLab/components/SouthPane/index.tsx 72.72% <0.00%> (+6.06%) ⬆️
...re/components/controls/DatasourceControl/index.jsx 84.61% <0.00%> (+9.36%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@zhaoyongjie zhaoyongjie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave an unblocking suggestion. LGTM

'json-bigint',
);
expect(`${responseBigNumber.json.value}`).toEqual('9223372036854775807');
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also mock a -2^63 to test int64? and we also need to add a comment to point out the integer type is that singed int64.

@john-bodley john-bodley merged commit 4002406 into apache:master Oct 26, 2022
john-bodley pushed a commit to airbnb/superset-fork that referenced this pull request Oct 26, 2022
john-bodley pushed a commit to airbnb/superset-fork that referenced this pull request Nov 2, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants