Skip to content

Commit

Permalink
ddl: enable hash partition and range columns partition by default (#9936
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tiancaiamao committed May 8, 2019
1 parent 67583f9 commit e56a14b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ddl/partition.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,19 @@ func buildTablePartitionInfo(ctx sessionctx.Context, d *ddl, s *ast.CreateTableS
enable = false
default:
// When tidb_enable_table_partition = 'auto',
// Partition by range expression is enabled by default.
if s.Partition.Tp == model.PartitionTypeRange && s.Partition.ColumnNames == nil {
if s.Partition.Tp == model.PartitionTypeRange {
// Partition by range expression is enabled by default.
if s.Partition.ColumnNames == nil {
enable = true
}
// Partition by range columns and just one column.
if len(s.Partition.ColumnNames) == 1 {
enable = true
}
}
// Partition by hash is enabled by default.
// Note that linear hash is not enabled.
if s.Partition.Tp == model.PartitionTypeHash {
enable = true
}
}
Expand Down

0 comments on commit e56a14b

Please sign in to comment.