Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Revert "fix: don't strip SQL comments in Explore (#28363)" #28567

Merged
merged 1 commit into from
May 17, 2024

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented May 17, 2024

SUMMARY

This reverts commit c618767.

After deploying Superset 4.0 to production a number of users reported issues where the rendered SQL statements were invalid if the underlying virtual dataset contained comments—likely trailing comments. Specifically the subquery lacked the trailing ).

We were able to determine that #28363 was the problematic PR and reverting it remedied the issue.

TESTING INSTRUCTIONS

CI and confirmed that the issue was mitigated after reverting.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@dosubot dosubot bot added explore Namespace | Anything related to Explore sqllab Namespace | Anything related to the SQL Lab labels May 17, 2024
@michael-s-molina michael-s-molina added v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch and removed sqllab Namespace | Anything related to the SQL Lab explore Namespace | Anything related to Explore labels May 17, 2024
@michael-s-molina michael-s-molina changed the title Revert "fix: don't strip SQL comments in Explore (#28363)" fix: Revert "fix: don't strip SQL comments in Explore (#28363)" May 17, 2024
@john-bodley john-bodley self-requested a review May 17, 2024 17:49
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.54%. Comparing base (76d897e) to head (faeacc0).
Report is 142 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #28567      +/-   ##
==========================================
+ Coverage   60.48%   64.54%   +4.05%     
==========================================
  Files        1931      521    -1410     
  Lines       76236    37484   -38752     
  Branches     8568        0    -8568     
==========================================
- Hits        46114    24194   -21920     
+ Misses      28017    13290   -14727     
+ Partials     2105        0    -2105     
Flag Coverage Δ
hive 49.09% <0.00%> (-0.07%) ⬇️
javascript ?
presto 53.64% <33.33%> (-0.16%) ⬇️
python 64.54% <100.00%> (+1.05%) ⬆️
unit 58.94% <66.66%> (+1.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michael-s-molina michael-s-molina merged commit c9aa4a1 into apache:master May 17, 2024
44 of 46 checks passed
@mistercrunch
Copy link
Member

mistercrunch commented May 18, 2024

Mmmmh. Seems we'll need to start over and write some unit tests with trailing comments (?) Did we save some of that SQL that was demonstrated to fail? Were they dash-dash comments or dash-star comments? I'm thinking we can write a failing unit test against #28363, and proceed to fix the issue. Hopefully that would provide enough confidence to move forward.

@villebro
Copy link
Member

@mistercrunch this seems easy enough to fix this by adding a newline at the end if the query contains --. I've done something similar for adhoc metrics/columns back in the day, and there should be unit tests for those.

@michael-s-molina
Copy link
Member Author

Seems we'll need to start over and write some unit tests with trailing comments (?) Did we save some of that SQL that was demonstrated to fail? Were they dash-dash comments or dash-star comments?

@mistercrunch We had problems with dash-dash comments. We can definitely test a future PR using our production data as multiple dashboards failed.

@mistercrunch
Copy link
Member

A problem with dash-star is they don't embed into one-another well. My use case was around looking for a user hint (in the form of a dash-dash comment) and based on that altering the SQL. Now I wanted for the "view query" panel to show them the before and after transformation, but the dash-dash turns slash-star, and the end of their hint closes the opening /*.

Solution is either to keep dash-dash as is, or have the whole SQL_QUERY_MUTATOR feature have a way to keep track of the before and after and surface both (as opposed to doing this as a comment)

mistercrunch added a commit that referenced this pull request May 29, 2024
Here I'm trying to recreate the issue that led to revert #28363 in #28567, likely some sort of trailing comment of some kind. This is DRAFT for now until I can reproduce the issue, write a covering test for it, and address it.

First attempt at creating a problematic virtual dataset was the following ->
mistercrunch added a commit that referenced this pull request Jun 3, 2024
Here I'm trying to recreate the issue that led to revert #28363 in #28567, likely some sort of trailing comment of some kind. This is DRAFT for now until I can reproduce the issue, write a covering test for it, and address it.

First attempt at creating a problematic virtual dataset was the following ->
mistercrunch added a commit that referenced this pull request Jun 7, 2024
Here I'm trying to recreate the issue that led to revert #28363 in #28567, likely some sort of trailing comment of some kind. This is DRAFT for now until I can reproduce the issue, write a covering test for it, and address it.

First attempt at creating a problematic virtual dataset was the following ->
mistercrunch added a commit that referenced this pull request Jun 18, 2024
Here I'm trying to recreate the issue that led to revert #28363 in #28567, likely some sort of trailing comment of some kind. This is DRAFT for now until I can reproduce the issue, write a covering test for it, and address it.

First attempt at creating a problematic virtual dataset was the following ->
irublev pushed a commit to HighviewPower/superset that referenced this pull request Oct 29, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants