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 #17654 to fix subselect table name parsing #18017

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

etr2460
Copy link
Member

@etr2460 etr2460 commented Jan 12, 2022

SUMMARY

Manually reverting #17654 since it doesn't revert cleanly. We need to revert this because it broke parsing table names from subselects. Ideally we could fix forward, but this seems pretty tricky, so putting up the revert PR for now

See #17654 (comment):
it looks like this PR broke parsing table names from queries with sub selects. Here's a repro case:

SELECT *
   FROM
     (SELECT 1 as foo, 2 as bar)
   ORDER BY foo ASC, bar

ParsedQuery now thinks that ORDER BY and bar are tables:
Screen Shot 2022-01-10 at 4 36 36 PM

Do you think this is something you could easily fix, or should we consider reverting this PR? I could possibly look into fixing myself, but the sql parse codebase is something i'm a bit nervous about jumping into

TESTING INSTRUCTIONS

CI, unit tests, verify in superset shell that parsing subselects works now

>>> from superset.sql_parse import ParsedQuery
>>> sql = """SELECT *
   FROM
     (SELECT 1 as foo, 2 as bar)
   ORDER BY foo ASC, bar"""
>>> ParsedQuery(sql).tables
set()
>>> sql = """SELECT *
   FROM
     (SELECT 1 as foo, 2 as bar from tbname)
   ORDER BY foo ASC, bar"""
>>> ParsedQuery(sql).tables
{Table(table='tbname', schema=None, catalog=None)}

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

to: @betodealmeida @john-bodley

@codecov
Copy link

codecov bot commented Jan 12, 2022

Codecov Report

Merging #18017 (7e252c4) into master (5e84fd1) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

❗ Current head 7e252c4 differs from pull request most recent head 5899f07. Consider uploading reports for the commit 5899f07 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18017      +/-   ##
==========================================
- Coverage   66.32%   66.13%   -0.19%     
==========================================
  Files        1569     1569              
  Lines       61660    61653       -7     
  Branches     6232     6232              
==========================================
- Hits        40894    40776     -118     
- Misses      19167    19278     +111     
  Partials     1599     1599              
Flag Coverage Δ
hive ?
mysql 82.08% <100.00%> (-0.01%) ⬇️
postgres 82.12% <100.00%> (-0.02%) ⬇️
presto ?
python 82.21% <100.00%> (-0.38%) ⬇️
sqlite 81.82% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/sql_parse.py 99.47% <100.00%> (-0.02%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.27% <0.00%> (-15.45%) ⬇️
superset/db_engine_specs/presto.py 83.50% <0.00%> (-5.64%) ⬇️
superset/reports/commands/log_prune.py 85.71% <0.00%> (-3.58%) ⬇️
superset/commands/importers/v1/utils.py 89.13% <0.00%> (-2.18%) ⬇️
superset/connectors/sqla/models.py 86.85% <0.00%> (-1.47%) ⬇️
superset/common/query_object.py 95.08% <0.00%> (-0.55%) ⬇️
superset/db_engine_specs/base.py 88.35% <0.00%> (-0.39%) ⬇️
superset/reports/commands/execute.py 91.14% <0.00%> (-0.37%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e84fd1...5899f07. Read the comment docs.

Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this!

@etr2460 etr2460 merged commit 14b9298 into apache:master Jan 13, 2022
shcoderAlex pushed a commit to casual-precision/superset that referenced this pull request Feb 7, 2022
bwang221 pushed a commit to casual-precision/superset that referenced this pull request Feb 10, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/M 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants