You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by fe...@apache.org on 2018/08/17 06:49:09 UTC

zeppelin git commit: [ZEPPELIN-3701].Missing first several '0' and losing digital accuracy in result table

Repository: zeppelin
Updated Branches:
  refs/heads/master 09d44d504 -> 1267e33a0


[ZEPPELIN-3701].Missing first several '0' and losing digital accuracy in result table

### What is this PR for?

Improvements:
-Datas like '00058806' will be displayed correctly instead of '58806'.
-Datas like '5880658806' will be displayed correctly instead of '5.880659E9'.

### What type of PR is it?
[Refactoring]

### Todos
* [ ] - Task

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-3701

### How should this be tested?
* CI pass

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: heguozi <zyzzxycjgmail.com>

Author: 和果子 <>

Closes #3132 from Deegue/master and squashes the following commits:

f539a9a [和果子] add '+' validation
09fc45d [和果子] hardcoding fixed
a5f9a8a [和果子] [ZEPPELIN-3701].Missing first several '0' and losing digital accuracy in result table


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/1267e33a
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/1267e33a
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/1267e33a

Branch: refs/heads/master
Commit: 1267e33a0ce1bfc7b38bddaa066f89a5f98e8857
Parents: 09d44d5
Author: 和果子 <>
Authored: Mon Aug 13 18:52:50 2018 +0800
Committer: Felix Cheung <fe...@apache.org>
Committed: Thu Aug 16 23:49:03 2018 -0700

----------------------------------------------------------------------
 zeppelin-web/src/app/tabledata/tabledata.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/1267e33a/zeppelin-web/src/app/tabledata/tabledata.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/tabledata/tabledata.js b/zeppelin-web/src/app/tabledata/tabledata.js
index 1f01bca..67c47be 100644
--- a/zeppelin-web/src/app/tabledata/tabledata.js
+++ b/zeppelin-web/src/app/tabledata/tabledata.js
@@ -36,6 +36,7 @@ export default class TableData extends Dataset {
     let textRows = paragraphResult.msg.split('\n');
     let comment = '';
     let commentRow = false;
+    const float64MaxDigits = 16;
 
     for (let i = 0; i < textRows.length; i++) {
       let textRow = textRows[i];
@@ -60,8 +61,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[0] === '+' || col.length > float64MaxDigits)) {
+            if (!isNaN(valueOfCol = parseFloat(col)) && isFinite(col)) {
+              col = valueOfCol;
+            }
           }
           cols.push(col);
           cols2.push({key: (columnNames[i]) ? columnNames[i].name : undefined, value: col});