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

airframe-sql: Fix SQL generation for JOIN #2748

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

takezoe
Copy link
Member

@takezoe takezoe commented Feb 10, 2023

SQLGenerator generates invalid SQL if left side of JOIN is sub-query.

@github-actions github-actions bot added the bug label Feb 10, 2023
SQLAnalyzer.analyze("select * from (select * from A) inner join A using (id)", "default", demoCatalog)

val sql = SQLGenerator.print(resolvedPlan).toLowerCase
sql shouldBe "select * from (select * from a) join a using (id)"
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this fix, the following invalid SQL is generated:

select * from select * from a join a using (id)

@codecov
Copy link

codecov bot commented Feb 10, 2023

Codecov Report

Merging #2748 (88ebda4) into master (612dddf) will increase coverage by 0.01%.
The diff coverage is 90.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2748      +/-   ##
==========================================
+ Coverage   82.27%   82.29%   +0.01%     
==========================================
  Files         337      337              
  Lines       14143    14142       -1     
  Branches     2218     2250      +32     
==========================================
+ Hits        11636    11638       +2     
+ Misses       2507     2504       -3     
Impacted Files Coverage Δ
...scala/wvlet/airframe/sql/parser/SQLGenerator.scala 91.49% <90.00%> (+0.31%) ⬆️
...rx/src/main/scala/wvlet/airframe/rx/RxRunner.scala 95.27% <0.00%> (+0.39%) ⬆️
...frame-rx/src/main/scala/wvlet/airframe/rx/Rx.scala 85.18% <0.00%> (+1.23%) ⬆️

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 612dddf...88ebda4. Read the comment docs.

@takezoe takezoe requested a review from xerial February 10, 2023 14:27
Copy link
Member

@xerial xerial left a comment

Choose a reason for hiding this comment

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

LGTM.

@xerial xerial merged commit 3cd28e0 into wvlet:master Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants