You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2021/07/02 18:14:19 UTC

[incubator-pinot] branch master updated: adding json-bigInt package to parse long values in json (#7120)

This is an automated email from the ASF dual-hosted git repository.

jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 1ea4260  adding json-bigInt package to parse long values in json (#7120)
1ea4260 is described below

commit 1ea42605f874a77debbb918ba35abb6c33de3289
Author: Sanket Shah <sh...@users.noreply.github.com>
AuthorDate: Fri Jul 2 23:43:56 2021 +0530

    adding json-bigInt package to parse long values in json (#7120)
    
    Fix #5829
    Added json-bigint package and for `sql` and `pql` API disabling native JSON parsing and using json-bigint parser.
---
 .../src/main/resources/app/components/SideBar.tsx           |  2 +-
 pinot-controller/src/main/resources/app/requests/index.ts   |  4 ++--
 pinot-controller/src/main/resources/app/styles/styles.css   |  2 +-
 .../src/main/resources/app/utils/PinotMethodUtils.ts        |  2 ++
 .../src/main/resources/app/utils/axios-config.ts            |  4 +++-
 pinot-controller/src/main/resources/package-lock.json       | 13 +++++++++++++
 pinot-controller/src/main/resources/package.json            |  1 +
 7 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/pinot-controller/src/main/resources/app/components/SideBar.tsx b/pinot-controller/src/main/resources/app/components/SideBar.tsx
index bf3deaf..d0f9552 100644
--- a/pinot-controller/src/main/resources/app/components/SideBar.tsx
+++ b/pinot-controller/src/main/resources/app/components/SideBar.tsx
@@ -98,7 +98,7 @@ const useStyles = makeStyles((theme: Theme) =>
       position: 'absolute',
       whiteSpace: 'nowrap',
       backgroundColor: 'inherit',
-      padding: '8px 8px 8px 0',
+      padding: '7px 8px 7px 0',
       borderRadius: '0 4px 4px 0',
       zIndex: 9
     },
diff --git a/pinot-controller/src/main/resources/app/requests/index.ts b/pinot-controller/src/main/resources/app/requests/index.ts
index 4110bb5..ae729ed 100644
--- a/pinot-controller/src/main/resources/app/requests/index.ts
+++ b/pinot-controller/src/main/resources/app/requests/index.ts
@@ -28,7 +28,7 @@ const headers = {
   'Accept': 'text/plain, */*; q=0.01'
 };
 
-import { baseApi } from '../utils/axios-config';
+import { baseApi, transformApi } from '../utils/axios-config';
 
 export const getTenants = (): Promise<AxiosResponse<Tenants>> =>
   baseApi.get('/tenants');
@@ -97,7 +97,7 @@ export const getTableSchema = (name: string): Promise<AxiosResponse<TableSchema>
   baseApi.get(`/tables/${name}/schema`);
 
 export const getQueryResult = (params: Object, url: string): Promise<AxiosResponse<SQLResult>> =>
-  baseApi.post(`/${url}`, params, {headers});
+  transformApi.post(`/${url}`, params, {headers});
 
 export const getClusterInfo = (): Promise<AxiosResponse<ClusterName>> =>
   baseApi.get('/cluster/info');
diff --git a/pinot-controller/src/main/resources/app/styles/styles.css b/pinot-controller/src/main/resources/app/styles/styles.css
index ffa77f4..711c558 100644
--- a/pinot-controller/src/main/resources/app/styles/styles.css
+++ b/pinot-controller/src/main/resources/app/styles/styles.css
@@ -116,7 +116,7 @@ h3.accordion-subtitle:before, h3.accordion-subtitle:after {
 }
 
 .MuiListItem-root.Mui-selected, .MuiListItem-root.Mui-selected:hover {
-  background-color: rgb(66 133 244 / 0.3) !important;
+  background-color: #c0d5f8 !important;
 }
 .box-border{
   border: 1px #ccc solid;
diff --git a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
index 95cfce7..d67396b 100644
--- a/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
+++ b/pinot-controller/src/main/resources/app/utils/PinotMethodUtils.ts
@@ -69,6 +69,7 @@ import {
   authenticateUser
 } from '../requests';
 import Utils from './Utils';
+const JSONbig = require('json-bigint')({'storeAsString': true})
 
 // This method is used to display tenants listing on cluster manager home page
 // API: /tenants
@@ -218,6 +219,7 @@ const getAsObject = (str: SQLResult) => {
 // Expected Output: {columns: [], records: []}
 const getQueryResults = (params, url, checkedOptions) => {
   return getQueryResult(params, url).then(({ data }) => {
+    data = JSONbig.parse(data);
     let queryResponse = null;
 
     queryResponse = getAsObject(data);
diff --git a/pinot-controller/src/main/resources/app/utils/axios-config.ts b/pinot-controller/src/main/resources/app/utils/axios-config.ts
index 5494af9..0a34237 100644
--- a/pinot-controller/src/main/resources/app/utils/axios-config.ts
+++ b/pinot-controller/src/main/resources/app/utils/axios-config.ts
@@ -50,4 +50,6 @@ const handleConfig = (config: any) => {
 
 export const baseApi = axios.create({ baseURL: '/' });
 baseApi.interceptors.request.use(handleConfig, handleError);
-baseApi.interceptors.response.use(handleResponse, handleError);
\ No newline at end of file
+baseApi.interceptors.response.use(handleResponse, handleError);
+
+export const transformApi = axios.create({baseURL: '/', transformResponse: [data => data]});
\ No newline at end of file
diff --git a/pinot-controller/src/main/resources/package-lock.json b/pinot-controller/src/main/resources/package-lock.json
index c7f9cad..b3771ef 100644
--- a/pinot-controller/src/main/resources/package-lock.json
+++ b/pinot-controller/src/main/resources/package-lock.json
@@ -1022,6 +1022,11 @@
       "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
       "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
     },
+    "bignumber.js": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
+      "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
+    },
     "binary-extensions": {
       "version": "1.13.1",
       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
@@ -4871,6 +4876,14 @@
         }
       }
     },
+    "json-bigint": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz",
+      "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==",
+      "requires": {
+        "bignumber.js": "^9.0.0"
+      }
+    },
     "json-parse-better-errors": {
       "version": "1.0.2",
       "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
diff --git a/pinot-controller/src/main/resources/package.json b/pinot-controller/src/main/resources/package.json
index efe684d..bf81269 100644
--- a/pinot-controller/src/main/resources/package.json
+++ b/pinot-controller/src/main/resources/package.json
@@ -71,6 +71,7 @@
     "fs": "0.0.1-security",
     "html-loader": "0.5.5",
     "html-webpack-plugin": "^4.2.1",
+    "json-bigint": "^1.0.0",
     "jsonlint": "^1.6.3",
     "lodash": "^4.17.17",
     "moment": "^2.27.0",

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org