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: add explain format for optimizer trace #684

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

winoros
Copy link
Member

@winoros winoros commented Dec 16, 2019

What problem does this PR solve?

Add one more new explain format to enable optimizer trace.

Check List

Tests

  • Unit test

@winoros winoros requested a review from a team December 16, 2019 12:02
@ghost ghost requested review from tangenta and removed request for a team December 16, 2019 12:02
parser.y Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 17, 2019

Codecov Report

Merging #684 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #684      +/-   ##
==========================================
+ Coverage   79.82%   79.82%   +<.01%     
==========================================
  Files          37       37              
  Lines       13625    13635      +10     
==========================================
+ Hits        10876    10884       +8     
- Misses       2103     2105       +2     
  Partials      646      646
Impacted Files Coverage Δ
parser.go 93.13% <ø> (-0.03%) ⬇️
ast/misc.go 76.14% <ø> (ø) ⬆️
misc.go 93.49% <ø> (ø) ⬆️

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 0f7cc23...de9e9f4. Read the comment docs.

Copy link
Contributor

@tangenta tangenta left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -482,6 +482,7 @@ var tokenMap = map[string]int{
"OPTIMIZE": optimize,
"OPTION": option,
"OPTIONALLY": optionally,
"OPT_TRACE": opttrace,
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems that we don't need it? Check https://github.com/pingcap/parser/pull/654/files

ExplainFormatROW = "row"
ExplainFormatDOT = "dot"
ExplainFormatHint = "hint"
ExplainFormatTrace = "opt_trace"
Copy link
Contributor

Choose a reason for hiding this comment

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

Simply trace is enough?

Copy link
Member

Choose a reason for hiding this comment

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

+1

@@ -3958,6 +3959,8 @@ ExplainStmt:
Stmt: $2,
Format: "row",
}
startOffset := parser.startOffset(&yyS[yypt])
$2.SetText(string(parser.src[startOffset:]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you give an example to explain the purpose of these 2 lines?

@@ -3979,6 +3982,8 @@ ExplainStmt:
Stmt: $5,
Format: $4,
}
startOffset := parser.startOffset(&yyS[yypt])
$5.SetText(string(parser.src[startOffset:]))
}
| ExplainSym "FORMAT" "=" ExplainFormatType "FOR" "CONNECTION" NUM
Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot get the optimizer trace from explain for connection since the plan may have already been generated?

@ti-chi-bot
Copy link
Member

@winoros: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.82%. Comparing base (0f7cc23) to head (de9e9f4).
Report is 361 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #684   +/-   ##
=======================================
  Coverage   79.82%   79.82%           
=======================================
  Files          37       37           
  Lines       13625    13635   +10     
=======================================
+ Hits        10876    10884    +8     
- Misses       2103     2105    +2     
  Partials      646      646           

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.

7 participants