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 column aliasing in CTEResolver #2741

Merged
merged 1 commit into from
Feb 9, 2023

Conversation

takezoe
Copy link
Member

@takezoe takezoe commented Feb 9, 2023

No description provided.

@github-actions github-actions bot added the bug label Feb 9, 2023
val resolvedPlan =
SQLAnalyzer.analyze("with t1 (xid) as (select id as pid from A) select xid from t1", "default", demoCatalog)
val sql = SQLGenerator.print(resolvedPlan).toLowerCase
sql shouldBe "with t1 as (select id as xid from (select id as pid from a)) select xid from t1"
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 SQL (id as pid as xid isn invalid) is generated:

with t1 as (select id as pid as xid from (select id as pid from a)) select xid from t1

@takezoe takezoe requested a review from xerial February 9, 2023 03:00
@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #2741 (a7ebe6a) into master (a9dd85c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2741   +/-   ##
=======================================
  Coverage   82.20%   82.21%           
=======================================
  Files         337      337           
  Lines       14124    14125    +1     
  Branches     2242     2262   +20     
=======================================
+ Hits        11611    11613    +2     
+ Misses       2513     2512    -1     
Impacted Files Coverage Δ
...cala/wvlet/airframe/sql/analyzer/CTEResolver.scala 94.11% <100.00%> (ø)
...me-log/src/main/scala/wvlet/log/io/StopWatch.scala 81.05% <0.00%> (+0.20%) ⬆️
...in/scala/wvlet/airframe/sql/model/Expression.scala 73.00% <0.00%> (+0.33%) ⬆️

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 d576c60...a7ebe6a. Read the comment docs.

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.

Thanks!

@xerial xerial merged commit a70f752 into wvlet:master Feb 9, 2023
@takezoe takezoe deleted the sql-fix-cte-column-names branch February 9, 2023 08:41
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