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: Support PACK_KEYS option in CreateTable statement #5602

Merged
merged 1 commit into from
Jan 10, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ const (
TableOptionRowFormat
TableOptionStatsPersistent
TableOptionShardRowID
TableOptionPackKeys
)

// RowFormat types
Expand Down
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ var tokenMap = map[string]int{
"QUICK": quick,
"SHARD_ROW_ID_BITS": shardRowIDBits,
"RANGE": rangeKwd,
"PACK_KEYS": packKeys,
"READ": read,
"REAL": realType,
"REDUNDANT": redundant,
Expand Down
6 changes: 6 additions & 0 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ import (
or "OR"
order "ORDER"
outer "OUTER"
packKeys "PACK_KEYS"
partition "PARTITION"
precisionType "PRECISION"
primary "PRIMARY"
Expand Down Expand Up @@ -5025,6 +5026,11 @@ TableOption:
{
$$ = &ast.TableOption{Tp: ast.TableOptionShardRowID, UintValue: $3.(uint64)}
}
| "PACK_KEYS" EqOpt StatsPersistentVal
{
// Parse it but will ignore it.
$$ = &ast.TableOption{Tp: ast.TableOptionPackKeys}
}

StatsPersistentVal:
"DEFAULT"
Expand Down
3 changes: 3 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ func (s *testParserSuite) TestDDL(c *C) {
{"create table t (c int) STATS_PERSISTENT = default", true},
{"create table t (c int) STATS_PERSISTENT = 0", true},
{"create table t (c int) STATS_PERSISTENT = 1", true},
{"create table t (c int) PACK_KEYS = 1", true},
{"create table t (c int) PACK_KEYS = 0", true},
{"create table t (c int) PACK_KEYS = DEFAULT", true},
// partition option
{"create table t (c int) PARTITION BY HASH (c) PARTITIONS 32;", true},
{"create table t (c int) PARTITION BY RANGE (Year(VDate)) (PARTITION p1980 VALUES LESS THAN (1980) ENGINE = MyISAM, PARTITION p1990 VALUES LESS THAN (1990) ENGINE = MyISAM, PARTITION pothers VALUES LESS THAN MAXVALUE ENGINE = MyISAM)", true},
Expand Down