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

Parser: support with parser ident #524

Merged
merged 10 commits into from
Aug 27, 2019

Conversation

yunnian
Copy link
Contributor

@yunnian yunnian commented Aug 26, 2019

What problem does this PR solve?

Fix compatibility problem about keyword WITH PARSER parser_name

Issue: #507

MySQL Syntax:

index_option:
...
| WITH PARSER parser_name

Bad SQL Case:

create fulltext index idx on t (a, b) with parser ident
create fulltext index idx on t (a, b) with parser ident comment 'string'
create fulltext index idx on t (a, b) comment 'string' with parser ident
create fulltext index idx on t (a, b) with parser ident lock default

Check List

Tests

  • Unit test

@CLAassistant
Copy link

CLAassistant commented Aug 26, 2019

CLA assistant check
All committers have signed the CLA.

@yunnian yunnian changed the title Feature with parser ident Parser: support with parser ident Aug 26, 2019
@codecov
Copy link

codecov bot commented Aug 26, 2019

Codecov Report

Merging #524 into master will decrease coverage by <.01%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #524      +/-   ##
==========================================
- Coverage   71.74%   71.74%   -0.01%     
==========================================
  Files          32       32              
  Lines        7772     7779       +7     
==========================================
+ Hits         5576     5581       +5     
- Misses       1671     1672       +1     
- Partials      525      526       +1
Impacted Files Coverage Δ
parser.go 70.58% <ø> (ø) ⬆️
misc.go 96.49% <ø> (ø) ⬆️
ast/ddl.go 80.43% <75%> (-0.04%) ⬇️

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 87e7a13...57b92d8. Read the comment docs.

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@@ -1335,7 +1346,7 @@ func (n *CreateIndexStmt) Restore(ctx *RestoreCtx) error {
}
ctx.WritePlain(")")

if n.IndexOption.Tp != model.IndexTypeInvalid || n.IndexOption.KeyBlockSize > 0 || n.IndexOption.Comment != "" || n.IndexOption.Visibility != IndexVisibilityDefault {
if n.IndexOption.Tp != model.IndexTypeInvalid || n.IndexOption.KeyBlockSize > 0 || n.IndexOption.Comment != "" || len(n.IndexOption.ParserName.O) > 0 || n.IndexOption.Visibility != IndexVisibilityDefault {
Copy link
Contributor

Choose a reason for hiding this comment

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

This condition is getting too long. Could you refactor this into a method of IndexOption?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let me have a try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried a lot of ways, but they didn't work well because there were so many influences, such as creating table.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay.

parser.y Show resolved Hide resolved
Copy link
Contributor

@zier-one zier-one left a comment

Choose a reason for hiding this comment

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

LGTM

@zier-one zier-one added the status/LGT1 LGT1 label Aug 27, 2019
@kennytm kennytm added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Aug 27, 2019
@zier-one zier-one merged commit 7ec6169 into pingcap:master Aug 27, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants