Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions pkg/parser/ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,13 +728,27 @@ const (
type IndexOption struct {
node

<<<<<<< HEAD
KeyBlockSize uint64
Tp model.IndexType
Comment string
ParserName model.CIStr
Visibility IndexVisibility
PrimaryKeyTp model.PrimaryKeyType
Global bool
=======
KeyBlockSize uint64
Tp IndexType
Comment string
ParserName CIStr
Visibility IndexVisibility
PrimaryKeyTp PrimaryKeyType
Global bool
SplitOpt *SplitOption `json:"-"` // SplitOption contains expr nodes, which cannot marshal for DDL job arguments.
SecondaryEngineAttr string
AddColumnarReplicaOnDemand int
Condition ExprNode `json:"-"` // Condition contains expr nodes, which cannot marshal for DDL job arguments. It's used for partial index.
>>>>>>> 7b93bcb4150 (parser: modify parser to support partial index (#63448))
}
Comment on lines +731 to 752
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Resolve leftover merge-conflict markers before merge.

Lines in this file still contain <<<<<<<, =======, >>>>>>>, which makes the parser package fail to compile and blocks validation of the partial-index changes. Please resolve the conflict and keep only the intended branch state.

Suggested cleanup (illustrative)
-<<<<<<< HEAD
-...
-=======
-...
->>>>>>> 7b93bcb4150 (parser: modify parser to support partial index (`#63448`))
+// keep only the resolved final implementation

Also applies to: 763-770, 844-892

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/parser/ast/ddl.go` around lines 731 - 752, Remove the leftover
merge-conflict markers (<<<<<<<, =======, >>>>>>>) in the struct definition
around KeyBlockSize/Tp/... and resolve the duplicated fields by keeping the
intended branch state (the updated struct that includes KeyBlockSize, Tp
(IndexType), Comment, ParserName (CIStr), Visibility, PrimaryKeyTp, Global plus
the new fields SplitOpt *SplitOption, SecondaryEngineAttr,
AddColumnarReplicaOnDemand and Condition ExprNode) so the struct is consistent
and compiles; do the same cleanup for the other conflict regions referenced
(around the other occurrences at the noted ranges) ensuring no conflict markers
remain and field types/names match the updated Index-related types (IndexType,
CIStr, PrimaryKeyType, SplitOption, ExprNode).


// IsEmpty is true if only default options are given
Expand All @@ -746,7 +760,14 @@ func (n *IndexOption) IsEmpty() bool {
len(n.ParserName.O) > 0 ||
n.Comment != "" ||
n.Global ||
<<<<<<< HEAD
n.Visibility != IndexVisibilityDefault {
=======
n.Visibility != IndexVisibilityDefault ||
n.SplitOpt != nil ||
len(n.SecondaryEngineAttr) > 0 ||
n.Condition != nil {
>>>>>>> 7b93bcb4150 (parser: modify parser to support partial index (#63448))
return false
}
return true
Expand Down Expand Up @@ -820,6 +841,55 @@ func (n *IndexOption) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("INVISIBLE")
}
}
<<<<<<< HEAD
=======

if n.SplitOpt != nil {
if hasPrevOption {
ctx.WritePlain(" ")
}
err := ctx.WriteWithSpecialComments(tidb.FeatureIDPresplit, func() error {
ctx.WriteKeyWord("PRE_SPLIT_REGIONS")
ctx.WritePlain(" = ")
if n.SplitOpt.Num != 0 && len(n.SplitOpt.Lower) == 0 {
ctx.WritePlainf("%d", n.SplitOpt.Num)
} else {
ctx.WritePlain("(")
if err := n.SplitOpt.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while splicing IndexOption SplitOpt")
}
ctx.WritePlain(")")
}
return nil
})
if err != nil {
return err
}
hasPrevOption = true
}

if n.SecondaryEngineAttr != "" {
if hasPrevOption {
ctx.WritePlain(" ")
}
ctx.WriteKeyWord("SECONDARY_ENGINE_ATTRIBUTE")
ctx.WritePlain(" = ")
ctx.WriteString(n.SecondaryEngineAttr)
// If a new option is added after, please also uncomment:
//hasPrevOption = true
}

if n.Condition != nil {
if hasPrevOption {
ctx.WritePlain(" ")
}
ctx.WriteKeyWord("WHERE ")
if err := n.Condition.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while splicing IndexOption Condition")
}
}

>>>>>>> 7b93bcb4150 (parser: modify parser to support partial index (#63448))
return nil
}

Expand Down
Loading