Skip to content

Commit 67ba7b0

Browse files
kyleconroyclaude
andcommitted
Support FORCE keyword in OPTIMIZE TABLE statement
FORCE is equivalent to FINAL in OPTIMIZE TABLE statements - both force a merge. Add parsing support for FORCE to set the Final flag. Fixes test: 03306_optimize_table_force_keyword/stmt4 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 75354e3 commit 67ba7b0

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

parser/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6752,8 +6752,8 @@ func (p *Parser) parseOptimize() *ast.OptimizeQuery {
67526752
opt.Partition = p.parseExpression(LOWEST)
67536753
}
67546754

6755-
// Handle FINAL
6756-
if p.currentIs(token.FINAL) {
6755+
// Handle FINAL or FORCE (both are equivalent for forcing merge)
6756+
if p.currentIs(token.FINAL) || (p.currentIs(token.IDENT) && strings.ToUpper(p.current.Value) == "FORCE") {
67576757
opt.Final = true
67586758
p.nextToken()
67596759
}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
{
2-
"explain_todo": {
3-
"stmt4": true
4-
}
5-
}
1+
{}

0 commit comments

Comments
 (0)