Uh oh!
There was an error while loading. Please reload this page.
[Zeppelin-1001] Take care of comma/tab escape in csv/tsv download - #1445
[Zeppelin-1001] Take care of comma/tab escape in csv/tsv download#1445meenakshisekar wants to merge 6 commits into
Conversation
…ble quotes so that they are escaped.
…ble quotes so that they are escaped.
| var dsvRow = ''; | ||
| for (var index in row) { | ||
| dsvRow += row[index].value + delimiter; | ||
| var stringValue = (row[index].value).toString(); |
There was a problem hiding this comment.
it would need to handle other cases too. to quote here
"CSV implementations permit them, often by requiring " (double quote) characters around values that contain reserved characters (such as commas, double quotes, or less commonly, newlines). Embedded double quote characters may then be represented by a pair of consecutive double quotes,[10] or by prefixing an escape character such as a backslash (for example in Sybase Central)."
For instance, when the stringValue has " or \n
corneadoug
commented
Sep 23, 2016
@felixcheung So you want him to escape the |
felixcheung
commented
Sep 23, 2016
via email
I believe so. |
corneadoug
commented
Sep 26, 2016
@meenakshisekar Could you take care of that? |
I'm working towards that. Shall let you know once it is done. Confirm this understanding. ] |
Let me know in case of any issues or queries. Thanks, |
meenakshisekar
commented
Sep 28, 2016
Re opening the pull request to run CI build. |
meenakshisekar
commented
Sep 28, 2016
Re opening the pull request to run CI build. |
meenakshisekar
commented
Sep 28, 2016
Re opening the pull request to run CI build. |
meenakshisekar
commented
Sep 28, 2016
CI build passed! |
corneadoug
commented
Sep 29, 2016
Tested using LGTM |
| dsvRow += row[index].value + delimiter; | ||
| var stringValue = (row[index].value).toString(); | ||
| if (stringValue.contains(delimiter)) { | ||
| dsvRow += stringValue.replace(stringValue, '"' + stringValue + '"') + delimiter; |
There was a problem hiding this comment.
this is a bit odd? why don't we
dsvRow += '"' + stringValue + '"' + delimiter;
There was a problem hiding this comment.
@meenakshisekar actually agree with felix, same result, so better use the easy one
There was a problem hiding this comment.
Have done the changes and committed. Please go ahead with merge.
corneadoug
commented
Sep 29, 2016
Merging if there is no more discussions |
| var stringValue = (row[index].value).toString(); | ||
| if (stringValue.contains(delimiter)) { | ||
| dsvRow += '"' + stringValue + '"' + delimiter; | ||
| } else { |
There was a problem hiding this comment.
Build is failing on indentation error here
corneadoug
commented
Sep 30, 2016
@meenakshisekar There is an indent error breaking the build, can you fix it? |
corneadoug
commented
Oct 2, 2016
@meenakshisekar Could you fix the indent issue? |
meenakshisekar
commented
Oct 3, 2016
@corneadoug |
corneadoug
commented
Oct 3, 2016
Ci failure is irrelevant, Merging |
corneadoug
commented
Oct 3, 2016
@meenakshisekar Can you tell me your JIRA username? |
meenakshisekar
commented
Oct 3, 2016
@corneadoug |
corneadoug
commented
Oct 3, 2016
@meenakshisekar I can't find you with this username |
meenakshisekar
commented
Oct 3, 2016
OOPS ! |
### What is this PR for? This PR backports #1445 to branch-0.6 since using `./dev/test_zeppelin_pr.py` throws alert for backporting it. ### What type of PR is it? Bug Fix Author: meenakshisekar <meenakshi.chandrasekar@imaginea.com> Closes#1484 from minahlee/branch-0.6_ZEPPELIN-1001 and squashes the following commits: 58fda8e [meenakshisekar] Formatting errors corrected for build f5c7f61 [meenakshisekar] Changes committed as per review comments in PR e404075 [meenakshisekar] Altered the code as per PR suggestion 1465 574803c [meenakshisekar] Zeppelin-1001 Modified the data with comma/tab to be surronded by double quotes so that they are escaped.
### 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 <meenakshi.chandrasekar@imaginea.com> Closesapache#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.


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
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: