You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by co...@apache.org on 2016/10/03 05:36:10 UTC
zeppelin git commit: [Zeppelin-1001] Take care of comma/tab escape in
csv/tsv download
Repository: zeppelin
Updated Branches:
refs/heads/master f0818ce26 -> 3017730b8
[Zeppelin-1001] Take care of comma/tab escape in csv/tsv download
### What is this PR for?
When the data is downloaded as CSV/TSV, the comma/tab in the actual data has to be handled so that they come exactly as the same data when downloaded.
### What type of PR is it?
[Bug Fix]
### Todos
* [ ] - Task
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1001
### How should this be tested?
Modify the data to be loaded to have a comma.
Create a paragraph to pull up that data and display.
Now click on the download as CSV/TSV button in the tool bar.
Once the data is downloaded verify whether the original data is unaltered and the comma is escaped.
### 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: meenakshisekar <me...@imaginea.com>
Closes #1445 from meenakshisekar/ZEPPELIN-1001 and squashes the following commits:
a4a2009 [meenakshisekar] Formatting errors corrected for build
5e14da8 [meenakshisekar] review comments fixed
ce27b82 [meenakshisekar] Changes committed as per review comments in PR
2f7d78a [meenakshisekar] Altered the code as per PR suggestion 1465
657dcbe [meenakshisekar] Zeppelin-1001 Modified the data with comma/tab to be surronded by double quotes so that they are escaped.
73b1868 [meenakshisekar] Zeppelin-1001 Modified the data with comma/tab to be surronded by double quotes so that they are escaped.
Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/3017730b
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/3017730b
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/3017730b
Branch: refs/heads/master
Commit: 3017730b8f5c75f20883263af6b6c37b7831a6ac
Parents: f0818ce
Author: meenakshisekar <me...@imaginea.com>
Authored: Mon Oct 3 08:01:49 2016 +0530
Committer: Damien CORNEAU <co...@gmail.com>
Committed: Mon Oct 3 14:36:23 2016 +0900
----------------------------------------------------------------------
.../src/app/notebook/paragraph/paragraph.controller.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/3017730b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
index 8c46810..824896a 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -2182,7 +2182,12 @@ angular.module('zeppelinWebApp').controller('ParagraphCtrl', function($scope, $r
var row = $scope.paragraph.result.msgTable[r];
var dsvRow = '';
for (var index in row) {
- dsvRow += row[index].value + delimiter;
+ var stringValue = (row[index].value).toString();
+ if (stringValue.contains(delimiter)) {
+ dsvRow += '"' + stringValue + '"' + delimiter;
+ } else {
+ dsvRow += row[index].value + delimiter;
+ }
}
dsv += dsvRow.substring(0, dsvRow.length - 1) + '\n';
}