“0294a4e29932605a99d9696d2b183a4d225bafac”上不存在“mobile/test/operators/test_quantize_op.cpp”
提交 952239fb 编写于 作者: L liipx

daily update & fix some questions

上级 92006756
...@@ -3280,7 +3280,7 @@ func (idxAdv *IndexAdvisor) RuleMaxTextColsCount() Rule { ...@@ -3280,7 +3280,7 @@ func (idxAdv *IndexAdvisor) RuleMaxTextColsCount() Rule {
return rule return rule
} }
sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) { err := sqlparser.Walk(func(node sqlparser.SQLNode) (kontinue bool, err error) {
switch stmt := node.(type) { switch stmt := node.(type) {
case *sqlparser.DDL: case *sqlparser.DDL:
if stmt.Action != "alter" { if stmt.Action != "alter" {
...@@ -3319,6 +3319,7 @@ func (idxAdv *IndexAdvisor) RuleMaxTextColsCount() Rule { ...@@ -3319,6 +3319,7 @@ func (idxAdv *IndexAdvisor) RuleMaxTextColsCount() Rule {
} }
return true, nil return true, nil
}, idxAdv.Ast) }, idxAdv.Ast)
common.LogIfError(err, "")
return rule return rule
} }
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
} }
[]ast.Token{ []ast.Token{
{Type:57348, Val:"select", i:0}, {Type:57348, Val:"select", i:0},
{Type:57589, Val:"sql_calc_found_rows", i:0}, {Type:57590, Val:"sql_calc_found_rows", i:0},
{Type:57396, Val:"col", i:0}, {Type:57396, Val:"col", i:0},
{Type:57353, Val:"from", i:0}, {Type:57353, Val:"from", i:0},
{Type:57396, Val:"tbl", i:0}, {Type:57396, Val:"tbl", i:0},
......
...@@ -49,8 +49,8 @@ func LoggerInit() { ...@@ -49,8 +49,8 @@ func LoggerInit() {
"daily": false, "daily": false,
"maxdays": 0, "maxdays": 0,
} }
logConfigJson, _ := json.Marshal(logConfig) logConfigJSON, _ := json.Marshal(logConfig)
err := Log.SetLogger(logs.AdapterFile, fmt.Sprintf(string(logConfigJson))) err := Log.SetLogger(logs.AdapterFile, string(logConfigJSON))
if err != nil { if err != nil {
fmt.Println(err.Error()) fmt.Println(err.Error())
} }
......
...@@ -550,6 +550,7 @@ type DropTableStmt struct { ...@@ -550,6 +550,7 @@ type DropTableStmt struct {
IfExists bool IfExists bool
Tables []*TableName Tables []*TableName
IsView bool
} }
// Restore implements Recoverable interface. // Restore implements Recoverable interface.
...@@ -887,6 +888,7 @@ const ( ...@@ -887,6 +888,7 @@ const (
AlterTableAddPartitions AlterTableAddPartitions
AlterTableCoalescePartitions AlterTableCoalescePartitions
AlterTableDropPartition AlterTableDropPartition
AlterTableTruncatePartition
// TODO: Add more actions // TODO: Add more actions
) )
......
...@@ -605,7 +605,8 @@ type IsNullExpr struct { ...@@ -605,7 +605,8 @@ type IsNullExpr struct {
// Restore implements Recoverable interface. // Restore implements Recoverable interface.
func (n *IsNullExpr) Restore(sb *strings.Builder) error { func (n *IsNullExpr) Restore(sb *strings.Builder) error {
return errors.New("Not implemented") n.Format(sb)
return nil
} }
// Format the ExprNode into a Writer. // Format the ExprNode into a Writer.
......
...@@ -94,6 +94,7 @@ func ValidCharsetAndCollation(cs string, co string) bool { ...@@ -94,6 +94,7 @@ func ValidCharsetAndCollation(cs string, co string) bool {
if co == "" { if co == "" {
return true return true
} }
co = strings.ToLower(co)
_, ok = c.Collations[co] _, ok = c.Collations[co]
if !ok { if !ok {
return false return false
......
...@@ -51,6 +51,8 @@ const ( ...@@ -51,6 +51,8 @@ const (
ActionAddTablePartition ActionType = 19 ActionAddTablePartition ActionType = 19
ActionDropTablePartition ActionType = 20 ActionDropTablePartition ActionType = 20
ActionCreateView ActionType = 21 ActionCreateView ActionType = 21
ActionModifyTableCharsetAndCollate ActionType = 22
ActionTruncateTablePartition ActionType = 23
) )
// AddIndexStr is a string related to the operation of "add index". // AddIndexStr is a string related to the operation of "add index".
...@@ -76,8 +78,10 @@ var actionMap = map[ActionType]string{ ...@@ -76,8 +78,10 @@ var actionMap = map[ActionType]string{
ActionModifyTableComment: "modify table comment", ActionModifyTableComment: "modify table comment",
ActionRenameIndex: "rename index", ActionRenameIndex: "rename index",
ActionAddTablePartition: "add partition", ActionAddTablePartition: "add partition",
ActionDropTablePartition: "drop table partition", ActionDropTablePartition: "drop partition",
ActionCreateView: "create view", ActionCreateView: "create view",
ActionModifyTableCharsetAndCollate: "modify table charset and collate",
ActionTruncateTablePartition: "truncate partition",
} }
// String return current ddl action in string // String return current ddl action in string
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -1084,6 +1084,13 @@ AlterTableSpec: ...@@ -1084,6 +1084,13 @@ AlterTableSpec:
Name: $3, Name: $3,
} }
} }
| "TRUNCATE" "PARTITION" Identifier
{
$$ = &ast.AlterTableSpec{
Tp: ast.AlterTableTruncatePartition,
Name: $3,
}
}
| "DROP" KeyOrIndex Identifier | "DROP" KeyOrIndex Identifier
{ {
$$ = &ast.AlterTableSpec{ $$ = &ast.AlterTableSpec{
...@@ -2349,17 +2356,22 @@ DropIndexStmt: ...@@ -2349,17 +2356,22 @@ DropIndexStmt:
DropTableStmt: DropTableStmt:
"DROP" TableOrTables TableNameList RestrictOrCascadeOpt "DROP" TableOrTables TableNameList RestrictOrCascadeOpt
{ {
$$ = &ast.DropTableStmt{Tables: $3.([]*ast.TableName)} $$ = &ast.DropTableStmt{Tables: $3.([]*ast.TableName), IsView: false}
} }
| "DROP" TableOrTables "IF" "EXISTS" TableNameList RestrictOrCascadeOpt | "DROP" TableOrTables "IF" "EXISTS" TableNameList RestrictOrCascadeOpt
{ {
$$ = &ast.DropTableStmt{IfExists: true, Tables: $5.([]*ast.TableName)} $$ = &ast.DropTableStmt{IfExists: true, Tables: $5.([]*ast.TableName), IsView: false}
} }
DropViewStmt: DropViewStmt:
"DROP" "VIEW" "IF" "EXISTS" TableNameList "DROP" "VIEW" TableNameList RestrictOrCascadeOpt
{
$$ = &ast.DropTableStmt{Tables: $3.([]*ast.TableName), IsView: true}
}
|
"DROP" "VIEW" "IF" "EXISTS" TableNameList RestrictOrCascadeOpt
{ {
$$ = &ast.DoStmt{} $$ = &ast.DropTableStmt{IfExists: true, Tables: $5.([]*ast.TableName), IsView: true}
} }
DropUserStmt: DropUserStmt:
......
...@@ -71,6 +71,14 @@ type StatementContext struct { ...@@ -71,6 +71,14 @@ type StatementContext struct {
histogramsNotLoad bool histogramsNotLoad bool
execDetails execdetails.ExecDetails execDetails execdetails.ExecDetails
} }
// PrevAffectedRows is the affected-rows value(DDL is 0, DML is the number of affected rows).
PrevAffectedRows int64
// PrevLastInsertID is the last insert ID of previous statement.
PrevLastInsertID uint64
// LastInsertID is the auto-generated ID in the current statement.
LastInsertID uint64
// InsertID is the given insert ID of an auto_increment column.
InsertID uint64
// Copied from SessionVars.TimeZone. // Copied from SessionVars.TimeZone.
TimeZone *time.Location TimeZone *time.Location
...@@ -241,6 +249,8 @@ func (sc *StatementContext) ResetForRetry() { ...@@ -241,6 +249,8 @@ func (sc *StatementContext) ResetForRetry() {
sc.mu.foundRows = 0 sc.mu.foundRows = 0
sc.mu.warnings = nil sc.mu.warnings = nil
sc.mu.Unlock() sc.mu.Unlock()
sc.TableIDs = sc.TableIDs[:0]
sc.IndexIDs = sc.IndexIDs[:0]
} }
// MergeExecDetails merges a single region execution details into self, used to print // MergeExecDetails merges a single region execution details into self, used to print
......
...@@ -40,6 +40,12 @@ func NewFieldType(tp byte) *FieldType { ...@@ -40,6 +40,12 @@ func NewFieldType(tp byte) *FieldType {
} }
} }
// CloneFieldType clones the given FieldType.
func CloneFieldType(src *FieldType) *FieldType {
ft := *src
return &ft
}
// AggFieldType aggregates field types for a multi-argument function like `IF`, `IFNULL`, `COALESCE` // AggFieldType aggregates field types for a multi-argument function like `IF`, `IFNULL`, `COALESCE`
// whose return type is determined by the arguments' FieldTypes. // whose return type is determined by the arguments' FieldTypes.
// Aggregation is performed by MergeFieldType function. // Aggregation is performed by MergeFieldType function.
...@@ -123,11 +129,14 @@ func setTypeFlag(flag *uint, flagItem uint, on bool) { ...@@ -123,11 +129,14 @@ func setTypeFlag(flag *uint, flagItem uint, on bool) {
func DefaultParamTypeForValue(value interface{}, tp *FieldType) { func DefaultParamTypeForValue(value interface{}, tp *FieldType) {
switch value.(type) { switch value.(type) {
case nil: case nil:
tp.Tp = mysql.TypeUnspecified tp.Tp = mysql.TypeVarString
tp.Flen = UnspecifiedLength tp.Flen = UnspecifiedLength
tp.Decimal = UnspecifiedLength tp.Decimal = UnspecifiedLength
default: default:
DefaultTypeForValue(value, tp) DefaultTypeForValue(value, tp)
if tp.Tp == mysql.TypeUnspecified {
tp.Tp = mysql.TypeVarString
}
} }
} }
......
...@@ -105,106 +105,106 @@ ...@@ -105,106 +105,106 @@
"revisionTime": "2018-10-24T15:10:47Z" "revisionTime": "2018-10-24T15:10:47Z"
}, },
{ {
"checksumSHA1": "V/4P8kb4QDozn9w++U8G+Kvt0+g=", "checksumSHA1": "xbV0lm0Qw8rFC82Dttxbf5ypBjA=",
"path": "github.com/pingcap/parser", "path": "github.com/pingcap/parser",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "Fj3tju6yXL0IHhhu6pYwvU5xzJo=", "checksumSHA1": "zrZ2JfaxdfwpArtuyiPjgH9GKeY=",
"path": "github.com/pingcap/parser/ast", "path": "github.com/pingcap/parser/ast",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "skWGV4FNvD3vr+5olepaPPnylUw=", "checksumSHA1": "skWGV4FNvD3vr+5olepaPPnylUw=",
"path": "github.com/pingcap/parser/auth", "path": "github.com/pingcap/parser/auth",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "grkBf/zf8cTJRtI64P1jV6B+p/4=", "checksumSHA1": "t4UHo966WzU9Z0IJkyGHRp0loOk=",
"path": "github.com/pingcap/parser/charset", "path": "github.com/pingcap/parser/charset",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "SInoXbsRe0tnBwmatmtZYfSFbdk=", "checksumSHA1": "SInoXbsRe0tnBwmatmtZYfSFbdk=",
"path": "github.com/pingcap/parser/format", "path": "github.com/pingcap/parser/format",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "+rJd1MX+3A1gwbrFZHFWbC8l8ao=", "checksumSHA1": "reRV2qecd6NpB7tIW3JeK46K/sk=",
"path": "github.com/pingcap/parser/model", "path": "github.com/pingcap/parser/model",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "QBa9yiMDQNl2cLLwqlRoNTpCPNg=", "checksumSHA1": "QBa9yiMDQNl2cLLwqlRoNTpCPNg=",
"path": "github.com/pingcap/parser/mysql", "path": "github.com/pingcap/parser/mysql",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "oNBCSwJRykKuzIKgPCttatB9hAo=", "checksumSHA1": "oNBCSwJRykKuzIKgPCttatB9hAo=",
"path": "github.com/pingcap/parser/opcode", "path": "github.com/pingcap/parser/opcode",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "XvnUllvwMYd6HrMvMiKnn4cGN2M=", "checksumSHA1": "XvnUllvwMYd6HrMvMiKnn4cGN2M=",
"path": "github.com/pingcap/parser/terror", "path": "github.com/pingcap/parser/terror",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "s96v2EoeGKcWHO3mpMOQk/z2iaI=", "checksumSHA1": "s96v2EoeGKcWHO3mpMOQk/z2iaI=",
"path": "github.com/pingcap/parser/types", "path": "github.com/pingcap/parser/types",
"revision": "c563561800a23fd1edeae4a592400cc2d0b47f5f", "revision": "4e6d047fcaae221376638de5f44c07cb6bf3eb44",
"revisionTime": "2018-12-05T02:39:50Z" "revisionTime": "2018-12-11T02:45:40Z"
}, },
{ {
"checksumSHA1": "kO63T5plq+V7HWnkzB9WlOnp9Iw=", "checksumSHA1": "fWqL/7jTYOiqDNmiUcQi3u45Hw0=",
"path": "github.com/pingcap/tidb/sessionctx/stmtctx", "path": "github.com/pingcap/tidb/sessionctx/stmtctx",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "SH/wISM1ueh/ENPJhiq1KssPLDA=", "checksumSHA1": "U/TFas5WBPWG2DARj51bcfoN0xQ=",
"path": "github.com/pingcap/tidb/types", "path": "github.com/pingcap/tidb/types",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "DWVD7+ygtT66IQ+cqXmMJ5OVqUk=", "checksumSHA1": "DWVD7+ygtT66IQ+cqXmMJ5OVqUk=",
"path": "github.com/pingcap/tidb/types/json", "path": "github.com/pingcap/tidb/types/json",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "Zp5ME8OXNTmHnYTwJJUZlydN4/U=", "checksumSHA1": "Zp5ME8OXNTmHnYTwJJUZlydN4/U=",
"path": "github.com/pingcap/tidb/types/parser_driver", "path": "github.com/pingcap/tidb/types/parser_driver",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "s709bhSrG2Ec35406mGtrySid4s=", "checksumSHA1": "s709bhSrG2Ec35406mGtrySid4s=",
"path": "github.com/pingcap/tidb/util/execdetails", "path": "github.com/pingcap/tidb/util/execdetails",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "nUC7zVoAMNR2a+z2iGqHoN2AkFE=", "checksumSHA1": "nUC7zVoAMNR2a+z2iGqHoN2AkFE=",
"path": "github.com/pingcap/tidb/util/hack", "path": "github.com/pingcap/tidb/util/hack",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "xSyepiuqsoaaeDch7cXeumvVHKM=", "checksumSHA1": "xSyepiuqsoaaeDch7cXeumvVHKM=",
"path": "github.com/pingcap/tidb/util/memory", "path": "github.com/pingcap/tidb/util/memory",
"revision": "350a046975a1f86fa6f05f177e81ae838388f4bb", "revision": "ef0ad26da8f99044a741fc0a781a0c4791446e8b",
"revisionTime": "2018-12-04T14:10:08Z" "revisionTime": "2018-12-10T15:48:53Z"
}, },
{ {
"checksumSHA1": "SmYeIK/fIYXNu8IKxD6HOVQVTuU=", "checksumSHA1": "SmYeIK/fIYXNu8IKxD6HOVQVTuU=",
...@@ -401,62 +401,62 @@ ...@@ -401,62 +401,62 @@
{ {
"checksumSHA1": "aKn1oKcY74N8TRLm3Ayt7Q4bbI4=", "checksumSHA1": "aKn1oKcY74N8TRLm3Ayt7Q4bbI4=",
"path": "vitess.io/vitess/go/bytes2", "path": "vitess.io/vitess/go/bytes2",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "JVCEN4UGRmg3TofIBdzZMZ3G0Ww=", "checksumSHA1": "JVCEN4UGRmg3TofIBdzZMZ3G0Ww=",
"path": "vitess.io/vitess/go/hack", "path": "vitess.io/vitess/go/hack",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "e1WJ7vCnVrlQQQlc6n/FewCDMso=", "checksumSHA1": "e1WJ7vCnVrlQQQlc6n/FewCDMso=",
"path": "vitess.io/vitess/go/sqltypes", "path": "vitess.io/vitess/go/sqltypes",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "ntFIQYkBS51G6y+FEkjFW40+HOU=", "checksumSHA1": "ntFIQYkBS51G6y+FEkjFW40+HOU=",
"path": "vitess.io/vitess/go/vt/log", "path": "vitess.io/vitess/go/vt/log",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "tPQFPwbMdjuX0qjNl4Zl8zc37JQ=", "checksumSHA1": "tPQFPwbMdjuX0qjNl4Zl8zc37JQ=",
"path": "vitess.io/vitess/go/vt/proto/query", "path": "vitess.io/vitess/go/vt/proto/query",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "o0tR/c7lgr0pLkxk7CdvjiNDAKU=", "checksumSHA1": "o0tR/c7lgr0pLkxk7CdvjiNDAKU=",
"path": "vitess.io/vitess/go/vt/proto/topodata", "path": "vitess.io/vitess/go/vt/proto/topodata",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "77UojBqi0yyeQvR70j7C3kcKclQ=", "checksumSHA1": "77UojBqi0yyeQvR70j7C3kcKclQ=",
"path": "vitess.io/vitess/go/vt/proto/vtgate", "path": "vitess.io/vitess/go/vt/proto/vtgate",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "QpWGhoVDwM+8+sgYLI/YU+95iGU=", "checksumSHA1": "QpWGhoVDwM+8+sgYLI/YU+95iGU=",
"path": "vitess.io/vitess/go/vt/proto/vtrpc", "path": "vitess.io/vitess/go/vt/proto/vtrpc",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "CZ0WbR7TBTgF9HoY+aRxzOzVlSs=", "checksumSHA1": "lENrUY/YyxwYFHYN+21TBH92P3U=",
"path": "vitess.io/vitess/go/vt/sqlparser", "path": "vitess.io/vitess/go/vt/sqlparser",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
}, },
{ {
"checksumSHA1": "oF4XzuOzwvj1iduX/lYqNSyY/HM=", "checksumSHA1": "oF4XzuOzwvj1iduX/lYqNSyY/HM=",
"path": "vitess.io/vitess/go/vt/vterrors", "path": "vitess.io/vitess/go/vt/vterrors",
"revision": "5bec5a560c87897b5d973bbced81764f3cf0f330", "revision": "be9745195a139422cd62fd32bdc3b7e0c28c9427",
"revisionTime": "2018-12-05T00:00:15Z" "revisionTime": "2018-12-10T16:22:31Z"
} }
], ],
"rootPath": "github.com/XiaoMi/soar" "rootPath": "github.com/XiaoMi/soar"
......
...@@ -753,8 +753,11 @@ const ( ...@@ -753,8 +753,11 @@ const (
TruncateStr = "truncate" TruncateStr = "truncate"
FlushStr = "flush" FlushStr = "flush"
CreateVindexStr = "create vindex" CreateVindexStr = "create vindex"
AddColVindexStr = "add vindex" DropVindexStr = "drop vindex"
DropColVindexStr = "drop vindex" AddVschemaTableStr = "add vschema table"
DropVschemaTableStr = "drop vschema table"
AddColVindexStr = "on table add vindex"
DropColVindexStr = "on table drop vindex"
// Vindex DDL param to specify the owner of a vindex // Vindex DDL param to specify the owner of a vindex
VindexOwnerStr = "owner" VindexOwnerStr = "owner"
...@@ -791,9 +794,15 @@ func (node *DDL) Format(buf *TrackedBuffer) { ...@@ -791,9 +794,15 @@ func (node *DDL) Format(buf *TrackedBuffer) {
case FlushStr: case FlushStr:
buf.Myprintf("%s", node.Action) buf.Myprintf("%s", node.Action)
case CreateVindexStr: case CreateVindexStr:
buf.Myprintf("%s %v %v", node.Action, node.VindexSpec.Name, node.VindexSpec) buf.Myprintf("alter vschema create vindex %v %v", node.VindexSpec.Name, node.VindexSpec)
case DropVindexStr:
buf.Myprintf("alter vschema drop vindex %v", node.VindexSpec.Name)
case AddVschemaTableStr:
buf.Myprintf("alter vschema add table %v", node.Table)
case DropVschemaTableStr:
buf.Myprintf("alter vschema drop table %v", node.Table)
case AddColVindexStr: case AddColVindexStr:
buf.Myprintf("alter table %v %s %v (", node.Table, node.Action, node.VindexSpec.Name) buf.Myprintf("alter vschema on %v add vindex %v (", node.Table, node.VindexSpec.Name)
for i, col := range node.VindexCols { for i, col := range node.VindexCols {
if i != 0 { if i != 0 {
buf.Myprintf(", %v", col) buf.Myprintf(", %v", col)
...@@ -806,7 +815,7 @@ func (node *DDL) Format(buf *TrackedBuffer) { ...@@ -806,7 +815,7 @@ func (node *DDL) Format(buf *TrackedBuffer) {
buf.Myprintf(" %v", node.VindexSpec) buf.Myprintf(" %v", node.VindexSpec)
} }
case DropColVindexStr: case DropColVindexStr:
buf.Myprintf("alter table %v %s %v", node.Table, node.Action, node.VindexSpec.Name) buf.Myprintf("alter vschema on %v drop vindex %v", node.Table, node.VindexSpec.Name)
default: default:
buf.Myprintf("%s table %v", node.Action, node.Table) buf.Myprintf("%s table %v", node.Action, node.Table)
} }
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -180,7 +180,7 @@ func skipToEnd(yylex interface{}) { ...@@ -180,7 +180,7 @@ func skipToEnd(yylex interface{}) {
%token <bytes> NULLX AUTO_INCREMENT APPROXNUM SIGNED UNSIGNED ZEROFILL %token <bytes> NULLX AUTO_INCREMENT APPROXNUM SIGNED UNSIGNED ZEROFILL
// Supported SHOW tokens // Supported SHOW tokens
%token <bytes> COLLATION DATABASES TABLES VITESS_KEYSPACES VITESS_SHARDS VITESS_TABLETS VSCHEMA_TABLES VITESS_TARGET FULL PROCESSLIST COLUMNS FIELDS ENGINES PLUGINS %token <bytes> COLLATION DATABASES TABLES VITESS_KEYSPACES VITESS_SHARDS VITESS_TABLETS VSCHEMA VSCHEMA_TABLES VITESS_TARGET FULL PROCESSLIST COLUMNS FIELDS ENGINES PLUGINS
// SET tokens // SET tokens
%token <bytes> NAMES CHARSET GLOBAL SESSION ISOLATION LEVEL READ WRITE ONLY REPEATABLE COMMITTED UNCOMMITTED SERIALIZABLE %token <bytes> NAMES CHARSET GLOBAL SESSION ISOLATION LEVEL READ WRITE ONLY REPEATABLE COMMITTED UNCOMMITTED SERIALIZABLE
...@@ -570,14 +570,6 @@ create_statement: ...@@ -570,14 +570,6 @@ create_statement:
{ {
$$ = &DDL{Action: CreateStr, Table: $5.ToViewName()} $$ = &DDL{Action: CreateStr, Table: $5.ToViewName()}
} }
| CREATE VINDEX sql_id vindex_type_opt vindex_params_opt
{
$$ = &DDL{Action: CreateVindexStr, VindexSpec: &VindexSpec{
Name: $3,
Type: $4,
Params: $5,
}}
}
| CREATE DATABASE not_exists_opt ID ddl_skip_to_end | CREATE DATABASE not_exists_opt ID ddl_skip_to_end
{ {
$$ = &DBDDL{Action: CreateStr, DBName: string($4)} $$ = &DBDDL{Action: CreateStr, DBName: string($4)}
...@@ -1300,7 +1292,47 @@ alter_statement: ...@@ -1300,7 +1292,47 @@ alter_statement:
{ {
$$ = &DDL{Action: AlterStr, Table: $4} $$ = &DDL{Action: AlterStr, Table: $4}
} }
| ALTER ignore_opt TABLE table_name ADD VINDEX sql_id '(' column_list ')' vindex_type_opt vindex_params_opt | ALTER ignore_opt TABLE table_name RENAME to_opt table_name
{
// Change this to a rename statement
$$ = &DDL{Action: RenameStr, FromTables: TableNames{$4}, ToTables: TableNames{$7}}
}
| ALTER ignore_opt TABLE table_name RENAME index_opt skip_to_end
{
// Rename an index can just be an alter
$$ = &DDL{Action: AlterStr, Table: $4}
}
| ALTER VIEW table_name ddl_skip_to_end
{
$$ = &DDL{Action: AlterStr, Table: $3.ToViewName()}
}
| ALTER ignore_opt TABLE table_name partition_operation
{
$$ = &DDL{Action: AlterStr, Table: $4, PartitionSpec: $5}
}
| ALTER VSCHEMA CREATE VINDEX sql_id vindex_type_opt vindex_params_opt
{
$$ = &DDL{Action: CreateVindexStr, VindexSpec: &VindexSpec{
Name: $5,
Type: $6,
Params: $7,
}}
}
| ALTER VSCHEMA DROP VINDEX sql_id
{
$$ = &DDL{Action: DropVindexStr, VindexSpec: &VindexSpec{
Name: $5,
}}
}
| ALTER VSCHEMA ADD TABLE table_name
{
$$ = &DDL{Action: AddVschemaTableStr, Table: $5}
}
| ALTER VSCHEMA DROP TABLE table_name
{
$$ = &DDL{Action: DropVschemaTableStr, Table: $5}
}
| ALTER VSCHEMA ON table_name ADD VINDEX sql_id '(' column_list ')' vindex_type_opt vindex_params_opt
{ {
$$ = &DDL{ $$ = &DDL{
Action: AddColVindexStr, Action: AddColVindexStr,
...@@ -1313,7 +1345,7 @@ alter_statement: ...@@ -1313,7 +1345,7 @@ alter_statement:
VindexCols: $9, VindexCols: $9,
} }
} }
| ALTER ignore_opt TABLE table_name DROP VINDEX sql_id | ALTER VSCHEMA ON table_name DROP VINDEX sql_id
{ {
$$ = &DDL{ $$ = &DDL{
Action: DropColVindexStr, Action: DropColVindexStr,
...@@ -1323,24 +1355,6 @@ alter_statement: ...@@ -1323,24 +1355,6 @@ alter_statement:
}, },
} }
} }
| ALTER ignore_opt TABLE table_name RENAME to_opt table_name
{
// Change this to a rename statement
$$ = &DDL{Action: RenameStr, FromTables: TableNames{$4}, ToTables: TableNames{$7}}
}
| ALTER ignore_opt TABLE table_name RENAME index_opt skip_to_end
{
// Rename an index can just be an alter
$$ = &DDL{Action: AlterStr, Table: $4}
}
| ALTER VIEW table_name ddl_skip_to_end
{
$$ = &DDL{Action: AlterStr, Table: $3.ToViewName()}
}
| ALTER ignore_opt TABLE table_name partition_operation
{
$$ = &DDL{Action: AlterStr, Table: $4, PartitionSpec: $5}
}
alter_object_type: alter_object_type:
COLUMN COLUMN
...@@ -1535,10 +1549,6 @@ show_statement: ...@@ -1535,10 +1549,6 @@ show_statement:
{ {
$$ = &Show{Scope: $2, Type: string($3)} $$ = &Show{Scope: $2, Type: string($3)}
} }
| SHOW VINDEXES
{
$$ = &Show{Type: string($2)}
}
| SHOW COLLATION | SHOW COLLATION
{ {
$$ = &Show{Type: string($2)} $$ = &Show{Type: string($2)}
...@@ -1549,10 +1559,6 @@ show_statement: ...@@ -1549,10 +1559,6 @@ show_statement:
showCollationFilterOpt := $4 showCollationFilterOpt := $4
$$ = &Show{Type: string($2), ShowCollationFilterOpt: &showCollationFilterOpt} $$ = &Show{Type: string($2), ShowCollationFilterOpt: &showCollationFilterOpt}
} }
| SHOW VINDEXES ON table_name
{
$$ = &Show{Type: string($2), OnTable: $4}
}
| SHOW VITESS_KEYSPACES | SHOW VITESS_KEYSPACES
{ {
$$ = &Show{Type: string($2)} $$ = &Show{Type: string($2)}
...@@ -1569,9 +1575,17 @@ show_statement: ...@@ -1569,9 +1575,17 @@ show_statement:
{ {
$$ = &Show{Type: string($2)} $$ = &Show{Type: string($2)}
} }
| SHOW VSCHEMA_TABLES | SHOW VSCHEMA TABLES
{ {
$$ = &Show{Type: string($2)} $$ = &Show{Type: string($2) + " " + string($3)}
}
| SHOW VSCHEMA VINDEXES
{
$$ = &Show{Type: string($2) + " " + string($3)}
}
| SHOW VSCHEMA VINDEXES ON table_name
{
$$ = &Show{Type: string($2) + " " + string($3), OnTable: $5}
} }
| SHOW WARNINGS | SHOW WARNINGS
{ {
...@@ -3351,6 +3365,7 @@ non_reserved_keyword: ...@@ -3351,6 +3365,7 @@ non_reserved_keyword:
| VITESS_KEYSPACES | VITESS_KEYSPACES
| VITESS_SHARDS | VITESS_SHARDS
| VITESS_TABLETS | VITESS_TABLETS
| VSCHEMA
| VSCHEMA_TABLES | VSCHEMA_TABLES
| VITESS_TARGET | VITESS_TARGET
| WARNINGS | WARNINGS
......
...@@ -393,6 +393,7 @@ var keywords = map[string]int{ ...@@ -393,6 +393,7 @@ var keywords = map[string]int{
"vitess_shards": VITESS_SHARDS, "vitess_shards": VITESS_SHARDS,
"vitess_tablets": VITESS_TABLETS, "vitess_tablets": VITESS_TABLETS,
"vitess_target": VITESS_TARGET, "vitess_target": VITESS_TARGET,
"vschema": VSCHEMA,
"vschema_tables": VSCHEMA_TABLES, "vschema_tables": VSCHEMA_TABLES,
"warnings": WARNINGS, "warnings": WARNINGS,
"when": WHEN, "when": WHEN,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册