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 support [NO_WRITE_TO_BINLOG | LOCAL] syntax in the ANALYZE statement #49482

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/parser/ast/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ type AnalyzeTableStmt struct {
AnalyzeOpts []AnalyzeOpt

// IndexFlag is true when we only analyze indices for a table.
IndexFlag bool
Incremental bool
IndexFlag bool
Incremental bool
NoWriteToBinLog bool
// HistogramOperation is set in "ANALYZE TABLE ... UPDATE/DROP HISTOGRAM ..." statement.
HistogramOperation HistogramOperationType
// ColumnNames indicate the columns whose statistics need to be collected.
Expand Down Expand Up @@ -97,10 +98,14 @@ type AnalyzeOpt struct {

// Restore implements Node interface.
func (n *AnalyzeTableStmt) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("ANALYZE ")
if n.NoWriteToBinLog {
ctx.WriteKeyWord("NO_WRITE_TO_BINLOG ")
}
if n.Incremental {
ctx.WriteKeyWord("ANALYZE INCREMENTAL TABLE ")
ctx.WriteKeyWord("INCREMENTAL TABLE ")
} else {
ctx.WriteKeyWord("ANALYZE TABLE ")
ctx.WriteKeyWord("TABLE ")
}
for i, table := range n.TableNames {
if i != 0 {
Expand Down