You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "justinpark (via GitHub)" <gi...@apache.org> on 2023/03/14 23:33:45 UTC
[GitHub] [superset] justinpark opened a new pull request, #23378: fix(sqllab): throw errors of commented out query
justinpark opened a new pull request, #23378:
URL: https://github.com/apache/superset/pull/23378
### SUMMARY
sqllab threw an error for undefined parameters even when those parameters are commented out of/not used by the query.
This commit cleans out the commented out part from the requested query to fix the issue (and also reduce the payload size since commented-out parts are unnecessary)
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After:
<img width="506" alt="Screenshot 2023-03-14 at 3 55 17 PM" src="https://user-images.githubusercontent.com/1392866/225164751-50645a6e-a6ca-40e4-9748-e9b5a468ba3b.png">
Before:
<img width="495" alt="Screenshot 2023-03-14 at 3 54 23 PM" src="https://user-images.githubusercontent.com/1392866/225164740-559f6eaf-a918-4670-912f-784aab54e9f4.png">
### TESTING INSTRUCTIONS
Go to sqllab and then run a query including a template string within comment-out block like `select 123 --,{{ds}} `
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
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
[GitHub] [superset] codecov[bot] commented on pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #23378:
URL: https://github.com/apache/superset/pull/23378#issuecomment-1469048126
## [Codecov](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#23378](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c8830a2) into [master](https://codecov.io/gh/apache/superset/commit/db95a93f43a25d592ff5d9ce29c50e5a02068f9d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (db95a93) will **decrease** coverage by `0.19%`.
> The diff coverage is `85.71%`.
> :exclamation: Current head c8830a2 differs from pull request most recent head cc3a790. Consider uploading reports for the commit cc3a790 to get more accurate results
```diff
@@ Coverage Diff @@
## master #23378 +/- ##
==========================================
- Coverage 65.91% 65.73% -0.19%
==========================================
Files 1907 1907
Lines 73453 73460 +7
Branches 7976 7975 -1
==========================================
- Hits 48420 48290 -130
- Misses 22983 23121 +138
+ Partials 2050 2049 -1
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| javascript | `53.74% <83.33%> (+<0.01%)` | :arrow_up: |
| presto | `?` | |
| sqlite | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...tersConfigModal/FiltersConfigForm/ColumnSelect.tsx](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0NvbHVtblNlbGVjdC50c3g=) | `77.14% <ø> (+0.82%)` | :arrow_up: |
| [...ersConfigModal/FiltersConfigForm/DatasetSelect.tsx](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0RhdGFzZXRTZWxlY3QudHN4) | `35.29% <ø> (-4.71%)` | :arrow_down: |
| [...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL0ZpbHRlcnNDb25maWdGb3JtLnRzeA==) | `59.65% <ø> (-0.08%)` | :arrow_down: |
| [superset/jinja\_context.py](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvamluamFfY29udGV4dC5weQ==) | `74.88% <0.00%> (ø)` | |
| [...ters/FiltersConfigModal/FiltersConfigForm/utils.ts](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvRmlsdGVyc0NvbmZpZ01vZGFsL0ZpbHRlcnNDb25maWdGb3JtL3V0aWxzLnRz) | `76.92% <66.66%> (-0.86%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `64.23% <100.00%> (+0.18%)` | :arrow_up: |
| [...c/SqlLab/components/RunQueryActionButton/index.tsx](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1J1blF1ZXJ5QWN0aW9uQnV0dG9uL2luZGV4LnRzeA==) | `78.78% <100.00%> (ø)` | |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.29% <100.00%> (-1.26%)` | :arrow_down: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `81.22% <100.00%> (-0.89%)` | :arrow_down: |
| [superset/db\_engine\_specs/drill.py](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2RyaWxsLnB5) | `54.76% <100.00%> (+1.10%)` | :arrow_up: |
| ... and [5 more](https://codecov.io/gh/apache/superset/pull/23378?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
... and [8 files with indirect coverage changes](https://codecov.io/gh/apache/superset/pull/23378/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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
[GitHub] [superset] justinpark commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1145446083
##########
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:
It should be okay at least superset UI visualizes the `select *` block as commented out for other comment-out styles. (so the user expected that can be ignored)
i.e.
<img width="538" alt="Screenshot 2023-03-22 at 2 49 39 PM" src="https://user-images.githubusercontent.com/1392866/227046753-efd8694e-3389-42ab-8e46-61416cb3a0e5.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
[GitHub] [superset] justinpark commented on pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on PR #23378:
URL: https://github.com/apache/superset/pull/23378#issuecomment-1478311812
@michael-s-molina could you help this code review?
--
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
[GitHub] [superset] justinpark commented on pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on PR #23378:
URL: https://github.com/apache/superset/pull/23378#issuecomment-1481455281
@michael-s-molina could you help the review for updates?
--
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
[GitHub] [superset] justinpark merged pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark merged PR #23378:
URL: https://github.com/apache/superset/pull/23378
--
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
[GitHub] [superset] justinpark commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1145452844
##########
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:
According to the current editor inspection, it won't accept the group 2 style `//`.
I'll update to clean up both cases of `/* */` and `--`
<img width="464" alt="Screenshot 2023-03-22 at 2 59 45 PM" src="https://user-images.githubusercontent.com/1392866/227048298-08677bf1-b065-44ed-8715-e04aee358f2c.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
[GitHub] [superset] michael-s-molina commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1146052041
##########
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:
It seems [there's a case](https://regexr.com/7ap81) with empty spaces where it's matching but it shouldn’t.
--
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
[GitHub] [superset] michael-s-molina commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1146849086
##########
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:
Oh I see. Thank you for the clarification.
--
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
[GitHub] [superset] justinpark commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1145448173
##########
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:
good catch. I'll update the pr to support other styles too.
--
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
[GitHub] [superset] justinpark commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1146683616
##########
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:
@michael-s-molina that's intended.
As I mentioned above, `//` comment visually not recognized as comment-out block so it doesn't sanitize the `//` comments.
<img width="465" alt="fix_sqllab___throw_errors_of_commented_out_query_by_justinpark_·_Pull_Request__23378_·_apache_superset" src="https://user-images.githubusercontent.com/1392866/227318793-3547b40d-6891-45ef-91e8-676a1db950c9.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
[GitHub] [superset] michael-s-molina commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1146569895
##########
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:
@justinpark The latest update broke `//` comments. You can test the regex [here](https://regexr.com/7ap81).
--
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
[GitHub] [superset] michael-s-molina commented on pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
michael-s-molina commented on PR #23378:
URL: https://github.com/apache/superset/pull/23378#issuecomment-1481494336
> @michael-s-molina could you help the review for updates?
@justinpark I reviewed and left this [comment](https://github.com/apache/superset/pull/23378#discussion_r1146052041).
--
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
[GitHub] [superset] michael-s-molina commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "michael-s-molina (via GitHub)" <gi...@apache.org>.
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
[GitHub] [superset] justinpark commented on a diff in pull request #23378: fix(sqllab): throw errors of commented out query
Posted by "justinpark (via GitHub)" <gi...@apache.org>.
justinpark commented on code in PR #23378:
URL: https://github.com/apache/superset/pull/23378#discussion_r1146540145
##########
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:
@michael-s-molina just update to preserve the newlines.
--
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