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

[sql lab] handle large ints, prevent overflow #5829

Merged
merged 2 commits into from
Sep 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions superset/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"immutable": "^3.8.2",
"jed": "^1.1.1",
"jquery": "3.1.1",
"json-bigint": "^0.3.0",
"lodash.throttle": "^4.1.1",
"mapbox-gl": "^0.45.0",
"mathjs": "^3.20.2",
Expand Down
9 changes: 1 addition & 8 deletions superset/assets/spec/javascripts/sqllab/actions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('async actions', () => {
});

it('calls querySuccess on ajax success', () => {
ajaxStub.yieldsTo('success', { data: '' });
ajaxStub.yieldsTo('success', '{ "data": "" }');
makeRequest();
expect(dispatch.callCount).to.equal(2);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.QUERY_SUCCESS);
Expand Down Expand Up @@ -86,13 +86,6 @@ describe('async actions', () => {
expect(dispatch.args[0][0].type).to.equal(actions.START_QUERY);
});

it('calls querySuccess on ajax success', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Was a dupe to test on line 58

ajaxStub.yieldsTo('success', { data: '' });
makeRequest();
expect(dispatch.callCount).to.equal(2);
expect(dispatch.getCall(1).args[0].type).to.equal(actions.QUERY_SUCCESS);
});

it('calls queryFailed on ajax error', () => {
ajaxStub.yieldsTo('error', { responseJSON: { error: 'error text' } });
makeRequest();
Expand Down
7 changes: 5 additions & 2 deletions superset/assets/src/SqlLab/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* eslint no-undef: 2 */
import $ from 'jquery';
import shortid from 'shortid';
import JSONbig from 'json-bigint';

import { now } from '../modules/dates';
import { t } from '../locales';
import {
Expand Down Expand Up @@ -125,10 +127,11 @@ export function fetchQueryResults(query) {
const sqlJsonUrl = `/superset/results/${query.resultsKey}/`;
$.ajax({
type: 'GET',
dataType: 'json',
dataType: 'text',
url: sqlJsonUrl,
success(results) {
dispatch(querySuccess(query, results));
const parsedResults = JSONbig.parse(results);
dispatch(querySuccess(query, parsedResults));
},
error(err) {
let msg = t('Failed at retrieving results from the results backend');
Expand Down
10 changes: 10 additions & 0 deletions superset/assets/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,10 @@ bignumber.js@^2.1.0:
version "2.4.0"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-2.4.0.tgz#838a992da9f9d737e0f4b2db0be62bb09dd0c5e8"

bignumber.js@^7.0.0:
version "7.2.1"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-7.2.1.tgz#80c048759d826800807c4bfd521e50edbba57a5f"

binary-extensions@^1.0.0:
version "1.11.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.11.0.tgz#46aa1751fb6a2f93ee5e689bb1087d4b14c6c205"
Expand Down Expand Up @@ -7003,6 +7007,12 @@ jsesc@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"

json-bigint@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-0.3.0.tgz#0ccd912c4b8270d05f056fbd13814b53d3825b1e"
dependencies:
bignumber.js "^7.0.0"

[email protected]:
version "3.0.0"
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock

This file was deleted.