-
Notifications
You must be signed in to change notification settings - Fork 284
Adding explain check #22797
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
Adding explain check #22797
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
e5e94ee to
fc25af2
Compare
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #22721
What this PR does / why we need it:
Make plan testable.
PR Type
Enhancement
Description
Refactored EXPLAIN statement parsing to support flexible option combinations
Added constants for EXPLAIN options (phyplan, analyze, verbose, force, check, format)
Replaced multiple hardcoded grammar rules with unified
explain_option_listruleIntroduced
MakeExplainStmthelper function for centralized statement creation logicGeneralized
OptionContainsfunction to check any option typeFixed typo:
epxlain→explainin variable namesDiagram Walkthrough
File Walkthrough
explain.go
Add option constants and centralize statement creationpkg/sql/parsers/tree/explain.go
PhyPlanOption,AnalyzeOption,VerboseOption,ForceOption,CheckOption,FormatOptionIsContainAnalyzeandIsContainPhyPlanwith genericOptionContainsfunctionMakeOptionshelper functionMakeExplainStmtfunction to centralize EXPLAIN statementcreation logic based on options
mysql_sql.y
Consolidate EXPLAIN grammar rules and fix typospkg/sql/parsers/dialect/mysql/mysql_sql.y
epxlainOptionsandepxlainOptiontoexplainOptionsand
explainOptionexplain_option_listandexplain_option_elemrulesFORCEandCHECKoptions inexplain_option_keyexplain_foramt_value→explain_format_valueutility_option_listto use direct slice initializationinstead of
MakeOptionsSTRINGas validutility_option_argtypemysql_sql.go
Generated parser code from grammar updatespkg/sql/parsers/dialect/mysql/mysql_sql.go
go.mod
Update module dependenciesgo.mod
go.sum
Update dependency checksumsgo.sum