From fd8db43d6ca81d3919f8875a68d5225f9da2085f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=8C=E6=9E=9C=E5=AD=90?= <> Date: Fri, 10 Aug 2018 15:08:43 +0800 Subject: [PATCH] ZEPPELIN-3701. Missing first several '0' and losing digital accuracy in result table ### What is this PR for? This PR just improve the datas displayed in output table. Here's the main changes; 1. Datas like '00058806'(integer begin with '0') can be displayed correctly instead of '58806'. 2. Datas like '5880658806'(big integer and double) can be displayed correctly instead of '5.880659e9'. ### What type of PR is it? [Improvement | Feature] ### Todos * [ ] - Task ### What is the Jira issue? * https://issues.apache.org/jira/browse/ZEPPELIN-3701 ### How should this be tested? * Unit test is added ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? No --- zeppelin-web/src/app/tabledata/tabledata.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zeppelin-web/src/app/tabledata/tabledata.js b/zeppelin-web/src/app/tabledata/tabledata.js index 1f01bca67c0..16336fb3b1a 100644 --- a/zeppelin-web/src/app/tabledata/tabledata.js +++ b/zeppelin-web/src/app/tabledata/tabledata.js @@ -60,8 +60,10 @@ export default class TableData extends Dataset { columnNames.push({name: col, index: j, aggr: 'sum'}); } else { let valueOfCol; - if (!isNaN(valueOfCol = parseFloat(col)) && isFinite(col)) { - col = valueOfCol; + if (!(col[0] === '0' || col.length >= 7)) { + if (!isNaN(valueOfCol = parseFloat(col)) && isFinite(col) && canTransfer) { + col = valueOfCol; + } } cols.push(col); cols2.push({key: (columnNames[i]) ? columnNames[i].name : undefined, value: col});