vogievetsky commented on a change in pull request #7898: Web console: Add 
download path to SQL Query
URL: https://github.com/apache/incubator-druid/pull/7898#discussion_r293958264
 
 

 ##########
 File path: web-console/src/views/sql-view/sql-view.tsx
 ##########
 @@ -169,6 +170,32 @@ export class SqlView extends 
React.PureComponent<SqlViewProps, SqlViewState> {
     localStorageSet(LocalStorageKeys.QUERY_VIEW_PANE_SIZE, 
String(secondaryPaneSize));
   }
 
+  onDownload = (format: string) => {
+    const { result } = this.state;
+    if (!result) return;
+    let data: string = '';
+    let seperator: string = '';
+    const newLineIndicator = '\n';
+
+    if (format === 'csv' || format === 'tsv') {
+      seperator = format === 'csv' ? ',' : '\t';
+      data = result.header.map(s => `"${s}"`).join(seperator) + 
newLineIndicator;
 
 Review comment:
   what if `s` has a `"` in it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to