Skip to content

Commit 6148d60

Browse files
authored
parser: Add ADD_COLUMNAR_REPLICA_ON_DEMAND (pingcap#61159)
ref pingcap#54245
1 parent e97ceee commit 6148d60

File tree

7 files changed

+12324
-12285
lines changed

7 files changed

+12324
-12285
lines changed

pkg/parser/ast/ddl.go

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -736,15 +736,16 @@ const (
736736
type IndexOption struct {
737737
node
738738

739-
KeyBlockSize uint64
740-
Tp IndexType
741-
Comment string
742-
ParserName CIStr
743-
Visibility IndexVisibility
744-
PrimaryKeyTp PrimaryKeyType
745-
Global bool
746-
SplitOpt *SplitOption `json:"-"` // SplitOption contains expr nodes, which cannot marshal for DDL job arguments.
747-
SecondaryEngineAttr string
739+
KeyBlockSize uint64
740+
Tp IndexType
741+
Comment string
742+
ParserName CIStr
743+
Visibility IndexVisibility
744+
PrimaryKeyTp PrimaryKeyType
745+
Global bool
746+
SplitOpt *SplitOption `json:"-"` // SplitOption contains expr nodes, which cannot marshal for DDL job arguments.
747+
SecondaryEngineAttr string
748+
AddColumnarReplicaOnDemand int
748749
}
749750

750751
// IsEmpty is true if only default options are given
@@ -767,7 +768,16 @@ func (n *IndexOption) IsEmpty() bool {
767768
// Restore implements Node interface.
768769
func (n *IndexOption) Restore(ctx *format.RestoreCtx) error {
769770
hasPrevOption := false
771+
772+
if n.AddColumnarReplicaOnDemand > 0 {
773+
ctx.WriteKeyWord("ADD_COLUMNAR_REPLICA_ON_DEMAND")
774+
hasPrevOption = true
775+
}
776+
770777
if n.PrimaryKeyTp != PrimaryKeyTypeDefault {
778+
if hasPrevOption {
779+
ctx.WritePlain(" ")
780+
}
771781
_ = ctx.WriteWithSpecialComments(tidb.FeatureIDClusteredIndex, func() error {
772782
ctx.WriteKeyWord(n.PrimaryKeyTp.String())
773783
return nil

pkg/parser/keywords.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/parser/keywords_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestKeywords(t *testing.T) {
3636
}
3737

3838
func TestKeywordsLength(t *testing.T) {
39-
require.Equal(t, 662, len(parser.Keywords))
39+
require.Equal(t, 663, len(parser.Keywords))
4040

4141
reservedNr := 0
4242
for _, kw := range parser.Keywords {

0 commit comments

Comments
 (0)