Skip to content

ast: change the order of visiting select stmt#522

Merged
alivxxx merged 4 commits into
pingcap:masterfrom
alivxxx:visit-order
Aug 28, 2019
Merged

ast: change the order of visiting select stmt#522
alivxxx merged 4 commits into
pingcap:masterfrom
alivxxx:visit-order

Conversation

@alivxxx
Copy link
Copy Markdown
Contributor

@alivxxx alivxxx commented Aug 26, 2019

What problem does this PR solve?

Adjust the visit order in select stmt so we can tranverse from left to right in the origin text.

For pingcap/tidb#11861

What is changed and how it works?

Adjust the vist order and add a offset variable in select stmt.

Check List

Tests

  • Integration test

Code changes

  • Has exported function/method change

Side effects

  • Possible performance regression

Related changes

  • None

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 26, 2019

Codecov Report

Merging #522 into master will decrease coverage by 0.14%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #522      +/-   ##
==========================================
- Coverage   71.77%   71.62%   -0.15%     
==========================================
  Files          32       32              
  Lines        7787     7740      -47     
==========================================
- Hits         5589     5544      -45     
+ Misses       1672     1671       -1     
+ Partials      526      525       -1
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️
yy_parser.go 83.96% <100%> (+0.5%) ⬆️
ast/dml.go 73.68% <60%> (ø) ⬆️
ast/ddl.go 80.17% <0%> (-0.36%) ⬇️
ast/misc.go 74.2% <0%> (-0.27%) ⬇️
misc.go 96.42% <0%> (-0.07%) ⬇️

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 8d44c03...2bf9ea0. Read the comment docs.

Comment thread ast/dml.go
// IsInBraces indicates whether it's a stmt in brace.
IsInBraces bool
// QueryBlockOffset indicates the order of this SelectStmt if counted from left to right in the sql text.
QueryBlockOffset int
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where would this field be set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks pretty weird that the values is set from another repo, can we set it during the induction of parser?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It seems that there is no way to set it correctly here, since the subpart of select stmt will get the offset first. I don't find good ways to set it correctly here.

Comment thread ast/dml.go
@alivxxx alivxxx requested review from eurekaka and winoros August 26, 2019 09:52
Copy link
Copy Markdown
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@eurekaka eurekaka added the status/LGT1 LGT1 label Aug 26, 2019
Copy link
Copy Markdown
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

lgtm

@alivxxx alivxxx added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Aug 28, 2019
@alivxxx alivxxx merged commit a621a0f into pingcap:master Aug 28, 2019
@alivxxx alivxxx deleted the visit-order branch August 28, 2019 08:06
foreyes pushed a commit to foreyes/parser that referenced this pull request Sep 16, 2019
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
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.

3 participants