You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "michael-s-molina (via GitHub)" <gi...@apache.org> on 2023/03/21 17:43:30 UTC
[GitHub] [superset] michael-s-molina commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
michael-s-molina commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1140258523
##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -331,6 +331,12 @@ export function fetchQueryResults(query, displayLimit) {
};
}
+export function cleanSqlComments(sql) {
+ if (!sql) return '';
+
+ return sql.replace(/(\/\*[^*]*\*\/)|(\/\/[^*]*)|(--[^.].*)/gm, '').trim();
Review Comment:
```suggestion
// group 1 -> /* */
// group 2 -> //
// group 3 -> --
return sql.replace(/(\/\*[^*]*\*\/)|(\/\/[^*]*)|(--[^.].*)/gm, '').trim();
```
##########
superset-frontend/src/SqlLab/actions/sqlLab.js:
##########
@@ -331,6 +331,12 @@ export function fetchQueryResults(query, displayLimit) {
};
}
+export function cleanSqlComments(sql) {
+ if (!sql) return '';
+
+ return sql.replace(/(\/\*[^*]*\*\/)|(\/\/[^*]*)|(--[^.].*)/gm, '').trim();
Review Comment:
`select *` queries are only supported by double dashes. I'm not sure if you want to support them for other comment types.
<img width="439" alt="Screenshot 2023-03-17 at 10 43 33" src="https://user-images.githubusercontent.com/70410625/225923017-5d4556d8-1d27-4a4e-8b4d-e49a259d2a6b.png">
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org