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: Add RewriteRule to see TypeResolver behavior #2647

Merged
merged 3 commits into from
Dec 17, 2022
Merged

Conversation

xerial
Copy link
Member

@xerial xerial commented Dec 17, 2022

Introduce RewriteRule to observe how individual rules rewrite LogicalPlan. This will be used for debugging #2646

By setting a log level like this:
airframe-sql/src/test/resources/log-test.properties

wvlet.airframe.sql.analyzer.RewriteRule=trace

You can see the transformation log:

transformed with resolveTableRef:
[before]
[Sort]: (id:?, name:?) => (id:?, name:?)
  - SortItem(id:long <- [A.id],None,None,Some(NodeLocation(1,41)))
  [Project]:  => (id:?, name:?)
    - SingleColumn(Id(id))
    - SingleColumn(Id(name))
    [TableRef]
      - default.A

[after]
[Sort]: (id:?, name:?) => (id:?, name:?)
  - SortItem(id:long <- [A.id],None,None,Some(NodeLocation(1,41)))
  [Project]: (id:long, name:string) => (id:?, name:?)
    - SingleColumn(Id(id))
    - SingleColumn(Id(name))
    [TableScan]:  => (id:long, name:string)

@xerial xerial requested a review from takezoe December 17, 2022 06:32
@codecov
Copy link

codecov bot commented Dec 17, 2022

Codecov Report

Merging #2647 (467b215) into master (a8fbc7a) will increase coverage by 0.00%.
The diff coverage is 95.55%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2647   +/-   ##
=======================================
  Coverage   82.11%   82.11%           
=======================================
  Files         333      334    +1     
  Lines       14022    14030    +8     
  Branches     2260     2182   -78     
=======================================
+ Hits        11514    11521    +7     
- Misses       2508     2509    +1     
Impacted Files Coverage Δ
...cala/wvlet/airframe/sql/analyzer/SQLAnalyzer.scala 90.00% <ø> (ø)
...n/scala/wvlet/airframe/sql/model/LogicalPlan.scala 89.40% <ø> (ø)
...cala/wvlet/airframe/sql/analyzer/RewriteRule.scala 83.33% <83.33%> (ø)
...ala/wvlet/airframe/sql/analyzer/TypeResolver.scala 93.61% <96.15%> (+0.09%) ⬆️
.../scala/wvlet/airframe/sql/analyzer/Optimizer.scala 78.57% <100.00%> (ø)

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 a8fbc7a...467b215. Read the comment docs.

Copy link
Member

@takezoe takezoe left a comment

Choose a reason for hiding this comment

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

This will be a great help for debugging rewriting behavior.

@xerial xerial merged commit 6b766a6 into master Dec 17, 2022
@xerial xerial deleted the agg-fix branch December 17, 2022 19:39
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