提交 d4242989 编写于 作者: martianzhang's avatar martianzhang 提交者: Pengxiang Li

fix #178 and add optimizer hint in SplitStatement function (#179)

* fix #176

  JSON datatype only support utf8mb4 now

* splitstatement support optimizer hint

  https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html
  https://dev.mysql.com/doc/refman/8.0/en/comments.html

* vendor daily update
上级 b0509d0a
...@@ -36,6 +36,8 @@ where col = 1 ...@@ -36,6 +36,8 @@ where col = 1
tb; tb;
18 18
-- comment -- comment
19 INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2);
20 select /*!50000 1,*/ 1;
0 select * from test\Ghello 0 select * from test\Ghello
1 select 'hello\Gworld', col from test\Ghello 1 select 'hello\Gworld', col from test\Ghello
2 -- select * from test\Ghello 2 -- select * from test\Ghello
......
...@@ -898,8 +898,11 @@ func SplitStatement(buf []byte, delimiter []byte) (string, string, []byte) { ...@@ -898,8 +898,11 @@ func SplitStatement(buf []byte, delimiter []byte) (string, string, []byte) {
} }
// multi line comment // multi line comment
// https://dev.mysql.com/doc/refman/8.0/en/comments.html
// https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html
if b == '/' && i+1 < len(buf) && buf[i+1] == '*' { if b == '/' && i+1 < len(buf) && buf[i+1] == '*' {
if !multiLineComment && !singleLineComment && !quoted && buf[i+2] != '!' { if !multiLineComment && !singleLineComment && !quoted &&
(buf[i+2] != '!' && buf[i+2] != '+') {
i = i + 2 i = i + 2
multiLineComment = true multiLineComment = true
continue continue
......
...@@ -166,6 +166,8 @@ select col from tb where col = 1;`), ...@@ -166,6 +166,8 @@ select col from tb where col = 1;`),
select col from tb; select col from tb;
select col from tb; select col from tb;
`), `),
[]byte(`INSERT /*+ SET_VAR(foreign_key_checks=OFF) */ INTO t2 VALUES(2);`),
[]byte(`select /*!50000 1,*/ 1;`),
} }
buf2s := [][]byte{ buf2s := [][]byte{
[]byte("select * from test\\Ghello"), []byte("select * from test\\Ghello"),
......
...@@ -137,6 +137,9 @@ func (db *Connector) startSampling(onlineConn *sql.DB, database, table string, w ...@@ -137,6 +137,9 @@ func (db *Connector) startSampling(onlineConn *sql.DB, database, table string, w
values = append(values, "NULL") values = append(values, "NULL")
} else { } else {
switch columnTypes[i].DatabaseTypeName() { switch columnTypes[i].DatabaseTypeName() {
case "JSON":
// https://github.com/XiaoMi/soar/issues/178
values = append(values, fmt.Sprintf(`convert(X'%s' using utf8mb4)`, fmt.Sprintf("%x", val)))
case "TIMESTAMP", "DATETIME": case "TIMESTAMP", "DATETIME":
t, err := time.Parse(time.RFC3339, string(val)) t, err := time.Parse(time.RFC3339, string(val))
if err != nil { if err != nil {
......
...@@ -53,6 +53,7 @@ const ( ...@@ -53,6 +53,7 @@ const (
FlagHasVariable FlagHasVariable
FlagHasDefault FlagHasDefault
FlagPreEvaluated FlagPreEvaluated
FlagHasWindowFunc
) )
// ExprNode is a node that can be evaluated. // ExprNode is a node that can be evaluated.
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
package ast package ast
import ( import (
"strings"
"github.com/pingcap/errors" "github.com/pingcap/errors"
"github.com/pingcap/parser/auth" "github.com/pingcap/parser/auth"
"github.com/pingcap/parser/model" "github.com/pingcap/parser/model"
...@@ -930,7 +932,14 @@ type Assignment struct { ...@@ -930,7 +932,14 @@ type Assignment struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *Assignment) Restore(ctx *RestoreCtx) error { func (n *Assignment) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") if err := n.Column.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore Assignment.Column")
}
ctx.WritePlain("=")
if err := n.Expr.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore Assignment.Expr")
}
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
...@@ -1308,13 +1317,14 @@ type ShowStmt struct { ...@@ -1308,13 +1317,14 @@ type ShowStmt struct {
dmlNode dmlNode
resultSetNode resultSetNode
Tp ShowStmtType // Databases/Tables/Columns/.... Tp ShowStmtType // Databases/Tables/Columns/....
DBName string DBName string
Table *TableName // Used for showing columns. Table *TableName // Used for showing columns.
Column *ColumnName // Used for `desc table column`. Column *ColumnName // Used for `desc table column`.
Flag int // Some flag parsed from sql, such as FULL. Flag int // Some flag parsed from sql, such as FULL.
Full bool Full bool
User *auth.UserIdentity // Used for show grants. User *auth.UserIdentity // Used for show grants.
IfNotExists bool // Used for `show create database if not exists`
// GlobalScope is used by show variables // GlobalScope is used by show variables
GlobalScope bool GlobalScope bool
...@@ -1526,7 +1536,36 @@ type FrameBound struct { ...@@ -1526,7 +1536,36 @@ type FrameBound struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *FrameBound) Restore(ctx *RestoreCtx) error { func (n *FrameBound) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") if n.UnBounded {
ctx.WriteKeyWord("UNBOUNDED")
}
switch n.Type {
case CurrentRow:
ctx.WriteKeyWord("CURRENT ROW")
case Preceding, Following:
if n.Unit != nil {
ctx.WriteKeyWord("INTERVAL ")
}
if n.Expr != nil {
if err := n.Expr.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore FrameBound.Expr")
}
}
if n.Unit != nil {
// Here the Unit string should not be quoted.
// TODO: This is a temporary workaround that should be changed once something like "Keyword Expression" is implemented.
var sb strings.Builder
n.Unit.Restore(NewRestoreCtx(0, &sb))
ctx.WritePlain(" ")
ctx.WriteKeyWord(sb.String())
}
if n.Type == Preceding {
ctx.WriteKeyWord(" PRECEDING")
} else {
ctx.WriteKeyWord(" FOLLOWING")
}
}
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
......
...@@ -18,6 +18,10 @@ func HasAggFlag(expr ExprNode) bool { ...@@ -18,6 +18,10 @@ func HasAggFlag(expr ExprNode) bool {
return expr.GetFlag()&FlagHasAggregateFunc > 0 return expr.GetFlag()&FlagHasAggregateFunc > 0
} }
func HasWindowFlag(expr ExprNode) bool {
return expr.GetFlag()&FlagHasWindowFunc > 0
}
// SetFlag sets flag for expression. // SetFlag sets flag for expression.
func SetFlag(n Node) { func SetFlag(n Node) {
var setter flagSetter var setter flagSetter
...@@ -38,6 +42,8 @@ func (f *flagSetter) Leave(in Node) (Node, bool) { ...@@ -38,6 +42,8 @@ func (f *flagSetter) Leave(in Node) (Node, bool) {
switch x := in.(type) { switch x := in.(type) {
case *AggregateFuncExpr: case *AggregateFuncExpr:
f.aggregateFunc(x) f.aggregateFunc(x)
case *WindowFuncExpr:
f.windowFunc(x)
case *BetweenExpr: case *BetweenExpr:
x.SetFlag(x.Expr.GetFlag() | x.Left.GetFlag() | x.Right.GetFlag()) x.SetFlag(x.Expr.GetFlag() | x.Left.GetFlag() | x.Right.GetFlag())
case *BinaryOperationExpr: case *BinaryOperationExpr:
...@@ -154,3 +160,11 @@ func (f *flagSetter) aggregateFunc(x *AggregateFuncExpr) { ...@@ -154,3 +160,11 @@ func (f *flagSetter) aggregateFunc(x *AggregateFuncExpr) {
} }
x.SetFlag(flag) x.SetFlag(flag)
} }
func (f *flagSetter) windowFunc(x *WindowFuncExpr) {
flag := FlagHasWindowFunc
for _, val := range x.Args {
flag |= val.GetFlag()
}
x.SetFlag(flag)
}
...@@ -330,7 +330,100 @@ type FuncCallExpr struct { ...@@ -330,7 +330,100 @@ type FuncCallExpr struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *FuncCallExpr) Restore(ctx *RestoreCtx) error { func (n *FuncCallExpr) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord(n.FnName.O)
ctx.WritePlain("(")
switch n.FnName.L {
case "convert":
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
ctx.WriteKeyWord(" USING ")
ctx.WriteKeyWord(n.Args[1].GetType().Charset)
case "adddate":
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WritePlain(", ")
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case "date_add":
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WritePlain(", ")
ctx.WriteKeyWord("INTERVAL ")
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WritePlain(" ")
ctx.WriteKeyWord(n.Args[2].(ValueExpr).GetString())
case "extract":
ctx.WriteKeyWord(n.Args[0].(ValueExpr).GetString())
ctx.WriteKeyWord(" FROM ")
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case "get_format":
ctx.WriteKeyWord(n.Args[0].(ValueExpr).GetString())
ctx.WritePlain(", ")
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case "position":
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WriteKeyWord(" IN ")
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case "trim":
switch len(n.Args) {
case 1:
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case 2:
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WriteKeyWord(" FROM ")
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
case 3:
switch fmt.Sprint(n.Args[2].(ValueExpr).GetValue()) {
case "3":
ctx.WriteKeyWord("TRAILING ")
case "2":
ctx.WriteKeyWord("LEADING ")
case "0", "1":
ctx.WriteKeyWord("BOTH ")
}
if n.Args[1].(ValueExpr).GetValue() != nil {
if err := n.Args[1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
ctx.WritePlain(" ")
}
ctx.WriteKeyWord("FROM ")
if err := n.Args[0].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr")
}
}
default:
for i, argv := range n.Args {
if i != 0 {
ctx.WritePlain(", ")
}
if err := argv.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCallExpr.Args %d", i)
}
}
}
ctx.WritePlain(")")
return nil
} }
// Format the ExprNode into a Writer. // Format the ExprNode into a Writer.
...@@ -407,7 +500,32 @@ type FuncCastExpr struct { ...@@ -407,7 +500,32 @@ type FuncCastExpr struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *FuncCastExpr) Restore(ctx *RestoreCtx) error { func (n *FuncCastExpr) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") switch n.FunctionType {
case CastFunction:
ctx.WriteKeyWord("CAST")
ctx.WritePlain("(")
if err := n.Expr.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
ctx.WriteKeyWord(" AS ")
n.Tp.FormatAsCastType(ctx.In)
ctx.WritePlain(")")
case CastConvertFunction:
ctx.WriteKeyWord("CONVERT")
ctx.WritePlain("(")
if err := n.Expr.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
ctx.WritePlain(", ")
n.Tp.FormatAsCastType(ctx.In)
ctx.WritePlain(")")
case CastBinaryOperator:
ctx.WriteKeyWord("BINARY ")
if err := n.Expr.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
}
return nil
} }
// Format the ExprNode into a Writer. // Format the ExprNode into a Writer.
...@@ -520,7 +638,21 @@ type AggregateFuncExpr struct { ...@@ -520,7 +638,21 @@ type AggregateFuncExpr struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *AggregateFuncExpr) Restore(ctx *RestoreCtx) error { func (n *AggregateFuncExpr) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord(n.F)
ctx.WritePlain("(")
if n.Distinct {
ctx.WriteKeyWord("DISTINCT ")
}
for i, argv := range n.Args {
if i != 0 {
ctx.WritePlain(", ")
}
if err := argv.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore AggregateFuncExpr.Args %d", i)
}
}
ctx.WritePlain(")")
return nil
} }
// Format the ExprNode into a Writer. // Format the ExprNode into a Writer.
......
...@@ -253,7 +253,8 @@ type BeginStmt struct { ...@@ -253,7 +253,8 @@ type BeginStmt struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *BeginStmt) Restore(ctx *RestoreCtx) error { func (n *BeginStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord("START TRANSACTION")
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
...@@ -297,7 +298,8 @@ type CommitStmt struct { ...@@ -297,7 +298,8 @@ type CommitStmt struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *CommitStmt) Restore(ctx *RestoreCtx) error { func (n *CommitStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord("COMMIT")
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
...@@ -318,7 +320,8 @@ type RollbackStmt struct { ...@@ -318,7 +320,8 @@ type RollbackStmt struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *RollbackStmt) Restore(ctx *RestoreCtx) error { func (n *RollbackStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord("ROLLBACK")
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
......
...@@ -39,7 +39,41 @@ type AnalyzeTableStmt struct { ...@@ -39,7 +39,41 @@ type AnalyzeTableStmt struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *AnalyzeTableStmt) Restore(ctx *RestoreCtx) error { func (n *AnalyzeTableStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord("ANALYZE TABLE ")
for i, table := range n.TableNames {
if i != 0 {
ctx.WritePlain(",")
}
if err := table.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore AnalyzeTableStmt.TableNames[%d]", i)
}
}
if len(n.PartitionNames) != 0 {
ctx.WriteKeyWord(" PARTITION ")
}
for i, partition := range n.PartitionNames {
if i != 0 {
ctx.WritePlain(",")
}
ctx.WriteName(partition.O)
}
if n.IndexFlag {
ctx.WriteKeyWord(" INDEX")
}
for i, index := range n.IndexNames {
if i != 0 {
ctx.WritePlain(",")
} else {
ctx.WritePlain(" ")
}
ctx.WriteName(index.O)
}
if n.MaxNumBuckets != 0 {
ctx.WriteKeyWord(" WITH ")
ctx.WritePlainf("%d", n.MaxNumBuckets)
ctx.WriteKeyWord(" BUCKETS")
}
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
...@@ -100,7 +134,9 @@ type LoadStatsStmt struct { ...@@ -100,7 +134,9 @@ type LoadStatsStmt struct {
// Restore implements Node interface. // Restore implements Node interface.
func (n *LoadStatsStmt) Restore(ctx *RestoreCtx) error { func (n *LoadStatsStmt) Restore(ctx *RestoreCtx) error {
return errors.New("Not implemented") ctx.WriteKeyWord("LOAD STATS ")
ctx.WriteString(n.Path)
return nil
} }
// Accept implements Node Accept interface. // Accept implements Node Accept interface.
......
...@@ -892,6 +892,27 @@ const ( ...@@ -892,6 +892,27 @@ const (
ErrInvalidJSONPathWildcard = 3149 ErrInvalidJSONPathWildcard = 3149
ErrInvalidJSONContainsPathType = 3150 ErrInvalidJSONContainsPathType = 3150
ErrJSONUsedAsKey = 3152 ErrJSONUsedAsKey = 3152
ErrWindowNoSuchWindow = 3579
ErrWindowCircularityInWindowGraph = 3580
ErrWindowNoChildPartitioning = 3581
ErrWindowNoInherentFrame = 3582
ErrWindowNoRedefineOrderBy = 3583
ErrWindowFrameStartIllegal = 3584
ErrWindowFrameEndIllegal = 3585
ErrWindowFrameIllegal = 3586
ErrWindowRangeFrameOrderType = 3587
ErrWindowRangeFrameTEMPORALType = 3588
ErrWindowRangeFrameNumericType = 3589
ErrWindowRangeBoundNotConstant = 3590
ErrWindowDuplicateName = 3591
ErrWindowIllegalOrderBy = 3592
ErrWindowInvalidWindowFuncUse = 3593
ErrWindowInvalidWindowFuncAliasUse = 3594
ErrWindowNestedWindowFuncUseInWindowSpec = 3595
ErrWindowRowsIntervalUse = 3596
ErrWindowNoGroupOrderUnused = 3597
ErrWindowExplainJson = 3598
ErrWindowFunctionIgnoresFrame = 3599
// TiDB self-defined errors. // TiDB self-defined errors.
ErrMemExceedThreshold = 8001 ErrMemExceedThreshold = 8001
......
...@@ -889,6 +889,27 @@ var MySQLErrName = map[uint16]string{ ...@@ -889,6 +889,27 @@ var MySQLErrName = map[uint16]string{
ErrInvalidJSONPathWildcard: "In this situation, path expressions may not contain the * and ** tokens.", ErrInvalidJSONPathWildcard: "In this situation, path expressions may not contain the * and ** tokens.",
ErrInvalidJSONContainsPathType: "The second argument can only be either 'one' or 'all'.", ErrInvalidJSONContainsPathType: "The second argument can only be either 'one' or 'all'.",
ErrJSONUsedAsKey: "JSON column '%-.192s' cannot be used in key specification.", ErrJSONUsedAsKey: "JSON column '%-.192s' cannot be used in key specification.",
ErrWindowNoSuchWindow: "Window name '%s' is not defined.",
ErrWindowCircularityInWindowGraph: "There is a circularity in the window dependency graph.",
ErrWindowNoChildPartitioning: "A window which depends on another cannot define partitioning.",
ErrWindowNoInherentFrame: "Window '%s' has a frame definition, so cannot be referenced by another window.",
ErrWindowNoRedefineOrderBy: "Window '%s' cannot inherit '%s' since both contain an ORDER BY clause.",
ErrWindowFrameStartIllegal: "Window '%s': frame start cannot be UNBOUNDED FOLLOWING.",
ErrWindowFrameEndIllegal: "Window '%s': frame end cannot be UNBOUNDED PRECEDING.",
ErrWindowFrameIllegal: "Window '%s': frame start or end is negative, NULL or of non-integral type",
ErrWindowRangeFrameOrderType: "Window '%s' with RANGE N PRECEDING/FOLLOWING frame requires exactly one ORDER BY expression, of numeric or temporal type",
ErrWindowRangeFrameTEMPORALType: "Window '%s' with RANGE frame has ORDER BY expression of datetime type. Only INTERVAL bound value allowed.",
ErrWindowRangeFrameNumericType: "Window '%s' with RANGE frame has ORDER BY expression of numeric type, INTERVAL bound value not allowed.",
ErrWindowRangeBoundNotConstant: "Window '%s' has a non-constant frame bound.",
ErrWindowDuplicateName: "Window '%s' is defined twice.",
ErrWindowIllegalOrderBy: "Window '%s': ORDER BY or PARTITION BY uses legacy position indication which is not supported, use expression.",
ErrWindowInvalidWindowFuncUse: "You cannot use the window function '%s' in this context.'",
ErrWindowInvalidWindowFuncAliasUse: "You cannot use the alias '%s' of an expression containing a window function in this context.'",
ErrWindowNestedWindowFuncUseInWindowSpec: "You cannot nest a window function in the specification of window '%s'.",
ErrWindowRowsIntervalUse: "Window '%s': INTERVAL can only be used with RANGE frames.",
ErrWindowNoGroupOrderUnused: "ASC or DESC with GROUP BY isn't allowed with window functions; put ASC or DESC in ORDER BY",
ErrWindowExplainJson: "To get information about window functions use EXPLAIN FORMAT=JSON",
ErrWindowFunctionIgnoresFrame: "Window function '%s' ignores the frame clause of window '%s' and aggregates over the whole partition",
// TiDB errors. // TiDB errors.
ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s", ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s",
......
...@@ -4714,7 +4714,7 @@ WindowFrameStart: ...@@ -4714,7 +4714,7 @@ WindowFrameStart:
} }
| paramMarker "PRECEDING" | paramMarker "PRECEDING"
{ {
$$ = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewValueExpr($1),} $$ = ast.FrameBound{Type: ast.Preceding, Expr: ast.NewParamMarkerExpr(yyS[yypt].offset),}
} }
| "INTERVAL" Expression TimeUnit "PRECEDING" | "INTERVAL" Expression TimeUnit "PRECEDING"
{ {
...@@ -4746,7 +4746,7 @@ WindowFrameBound: ...@@ -4746,7 +4746,7 @@ WindowFrameBound:
} }
| paramMarker "FOLLOWING" | paramMarker "FOLLOWING"
{ {
$$ = ast.FrameBound{Type: ast.Following, Expr: ast.NewValueExpr($1),} $$ = ast.FrameBound{Type: ast.Following, Expr: ast.NewParamMarkerExpr(yyS[yypt].offset),}
} }
| "INTERVAL" Expression TimeUnit "FOLLOWING" | "INTERVAL" Expression TimeUnit "FOLLOWING"
{ {
...@@ -5891,11 +5891,12 @@ ShowStmt: ...@@ -5891,11 +5891,12 @@ ShowStmt:
Table: $4.(*ast.TableName), Table: $4.(*ast.TableName),
} }
} }
| "SHOW" "CREATE" "DATABASE" DBName | "SHOW" "CREATE" "DATABASE" IfNotExists DBName
{ {
$$ = &ast.ShowStmt{ $$ = &ast.ShowStmt{
Tp: ast.ShowCreateDatabase, Tp: ast.ShowCreateDatabase,
DBName: $4.(string), IfNotExists: $4.(bool),
DBName: $5.(string),
} }
} }
| "SHOW" "GRANTS" | "SHOW" "GRANTS"
......
...@@ -211,7 +211,7 @@ func (ft *FieldType) FormatAsCastType(w io.Writer) { ...@@ -211,7 +211,7 @@ func (ft *FieldType) FormatAsCastType(w io.Writer) {
fmt.Fprint(w, " BINARY") fmt.Fprint(w, " BINARY")
} }
if ft.Charset != charset.CharsetBin && ft.Charset != mysql.DefaultCharset { if ft.Charset != charset.CharsetBin && ft.Charset != mysql.DefaultCharset {
fmt.Fprintf(w, " %s", ft.Charset) fmt.Fprintf(w, " CHARACTER SET %s", ft.Charset)
} }
case mysql.TypeDate: case mysql.TypeDate:
fmt.Fprint(w, "DATE") fmt.Fprint(w, "DATE")
......
...@@ -111,6 +111,7 @@ type StatementContext struct { ...@@ -111,6 +111,7 @@ type StatementContext struct {
IndexIDs []int64 IndexIDs []int64
NowTs time.Time NowTs time.Time
SysTs time.Time SysTs time.Time
StmtType string
} }
// AddAffectedRows adds affected rows. // AddAffectedRows adds affected rows.
......
...@@ -804,7 +804,7 @@ func (d *Datum) convertToString(sc *stmtctx.StatementContext, target *FieldType) ...@@ -804,7 +804,7 @@ func (d *Datum) convertToString(sc *stmtctx.StatementContext, target *FieldType)
default: default:
return invalidConv(d, target.Tp) return invalidConv(d, target.Tp)
} }
s, err := ProduceStrWithSpecifiedTp(s, target, sc) s, err := ProduceStrWithSpecifiedTp(s, target, sc, true)
ret.SetString(s) ret.SetString(s)
if target.Charset == charset.CharsetBin { if target.Charset == charset.CharsetBin {
ret.k = KindBytes ret.k = KindBytes
...@@ -812,8 +812,9 @@ func (d *Datum) convertToString(sc *stmtctx.StatementContext, target *FieldType) ...@@ -812,8 +812,9 @@ func (d *Datum) convertToString(sc *stmtctx.StatementContext, target *FieldType)
return ret, errors.Trace(err) return ret, errors.Trace(err)
} }
// ProduceStrWithSpecifiedTp produces a new string according to `flen` and `chs`. // ProduceStrWithSpecifiedTp produces a new string according to `flen` and `chs`. Param `padZero` indicates
func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *stmtctx.StatementContext) (_ string, err error) { // whether we should pad `\0` for `binary(flen)` type.
func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *stmtctx.StatementContext, padZero bool) (_ string, err error) {
flen, chs := tp.Flen, tp.Charset flen, chs := tp.Flen, tp.Charset
if flen >= 0 { if flen >= 0 {
// Flen is the rune length, not binary length, for UTF8 charset, we need to calculate the // Flen is the rune length, not binary length, for UTF8 charset, we need to calculate the
...@@ -842,7 +843,7 @@ func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *stmtctx.StatementCon ...@@ -842,7 +843,7 @@ func ProduceStrWithSpecifiedTp(s string, tp *FieldType, sc *stmtctx.StatementCon
} else if len(s) > flen { } else if len(s) > flen {
err = ErrDataTooLong.GenWithStack("Data Too Long, field len %d, data len %d", flen, len(s)) err = ErrDataTooLong.GenWithStack("Data Too Long, field len %d, data len %d", flen, len(s))
s = truncateStr(s, flen) s = truncateStr(s, flen)
} else if tp.Tp == mysql.TypeString && IsBinaryStr(tp) && len(s) < flen { } else if tp.Tp == mysql.TypeString && IsBinaryStr(tp) && len(s) < flen && padZero {
padding := make([]byte, flen-len(s)) padding := make([]byte, flen-len(s))
s = string(append([]byte(s), padding...)) s = string(append([]byte(s), padding...))
} }
......
...@@ -111,106 +111,106 @@ ...@@ -111,106 +111,106 @@
"revisionTime": "2018-10-24T15:10:47Z" "revisionTime": "2018-10-24T15:10:47Z"
}, },
{ {
"checksumSHA1": "KLFQyY05NrGhQCM+Lthp/X9/YcE=", "checksumSHA1": "/y8A3Ro/qdM6f7XFR0JADJl0sFw=",
"path": "github.com/pingcap/parser", "path": "github.com/pingcap/parser",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "IkdWWfeUBw+gwiERRCMHYSBb8aA=", "checksumSHA1": "TmSk8q5zaa7SI3G9VJpal7z8o+4=",
"path": "github.com/pingcap/parser/ast", "path": "github.com/pingcap/parser/ast",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "skWGV4FNvD3vr+5olepaPPnylUw=", "checksumSHA1": "skWGV4FNvD3vr+5olepaPPnylUw=",
"path": "github.com/pingcap/parser/auth", "path": "github.com/pingcap/parser/auth",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "t4UHo966WzU9Z0IJkyGHRp0loOk=", "checksumSHA1": "t4UHo966WzU9Z0IJkyGHRp0loOk=",
"path": "github.com/pingcap/parser/charset", "path": "github.com/pingcap/parser/charset",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "SInoXbsRe0tnBwmatmtZYfSFbdk=", "checksumSHA1": "SInoXbsRe0tnBwmatmtZYfSFbdk=",
"path": "github.com/pingcap/parser/format", "path": "github.com/pingcap/parser/format",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "fMXmawvMELfwCuO/vrNtkUjQN/0=", "checksumSHA1": "fMXmawvMELfwCuO/vrNtkUjQN/0=",
"path": "github.com/pingcap/parser/model", "path": "github.com/pingcap/parser/model",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "QBa9yiMDQNl2cLLwqlRoNTpCPNg=", "checksumSHA1": "kkqyRzO7TCqnABxjJEo+JclJZLM=",
"path": "github.com/pingcap/parser/mysql", "path": "github.com/pingcap/parser/mysql",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "mxpiJJ3b08I0o0Sd2rJLYMwz7uw=", "checksumSHA1": "mxpiJJ3b08I0o0Sd2rJLYMwz7uw=",
"path": "github.com/pingcap/parser/opcode", "path": "github.com/pingcap/parser/opcode",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "XvnUllvwMYd6HrMvMiKnn4cGN2M=", "checksumSHA1": "XvnUllvwMYd6HrMvMiKnn4cGN2M=",
"path": "github.com/pingcap/parser/terror", "path": "github.com/pingcap/parser/terror",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "YoDiJ3sniNqxkP5X/BDkx6efteA=", "checksumSHA1": "CpuZhpMNeho4tIFPwY2GUDvuEfQ=",
"path": "github.com/pingcap/parser/types", "path": "github.com/pingcap/parser/types",
"revision": "a4bdcab31117b4b4cbfbdb792307e3332534950d", "revision": "5d5a6dd34655f3d11723db47479541d32d2c76f2",
"revisionTime": "2018-12-28T02:29:38Z" "revisionTime": "2019-01-03T13:14:33Z"
}, },
{ {
"checksumSHA1": "Uv9aqrZqzNFUgUferYPfNGUxOmM=", "checksumSHA1": "MxoLdFWi8nwd0uqTJnYqw+JaDAY=",
"path": "github.com/pingcap/tidb/sessionctx/stmtctx", "path": "github.com/pingcap/tidb/sessionctx/stmtctx",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "kXyszfR2fQ6bHvuCCFlHRkt1mF0=", "checksumSHA1": "wlD7aGqTJ5eBQYK0ub4b2Ick1j8=",
"path": "github.com/pingcap/tidb/types", "path": "github.com/pingcap/tidb/types",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "DWVD7+ygtT66IQ+cqXmMJ5OVqUk=", "checksumSHA1": "DWVD7+ygtT66IQ+cqXmMJ5OVqUk=",
"path": "github.com/pingcap/tidb/types/json", "path": "github.com/pingcap/tidb/types/json",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "6vi/eCZXqNTa5eAUpxDZet4LPlY=", "checksumSHA1": "6vi/eCZXqNTa5eAUpxDZet4LPlY=",
"path": "github.com/pingcap/tidb/types/parser_driver", "path": "github.com/pingcap/tidb/types/parser_driver",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "SS7twHZofFKr8w/pwIKmkp3u5qU=", "checksumSHA1": "SS7twHZofFKr8w/pwIKmkp3u5qU=",
"path": "github.com/pingcap/tidb/util/execdetails", "path": "github.com/pingcap/tidb/util/execdetails",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "nUC7zVoAMNR2a+z2iGqHoN2AkFE=", "checksumSHA1": "nUC7zVoAMNR2a+z2iGqHoN2AkFE=",
"path": "github.com/pingcap/tidb/util/hack", "path": "github.com/pingcap/tidb/util/hack",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "xSyepiuqsoaaeDch7cXeumvVHKM=", "checksumSHA1": "xSyepiuqsoaaeDch7cXeumvVHKM=",
"path": "github.com/pingcap/tidb/util/memory", "path": "github.com/pingcap/tidb/util/memory",
"revision": "71088815e7c5121e069d7ec10595d176a44b9bea", "revision": "0147e0cece4481807289cc4cd867cb8d2abd3145",
"revisionTime": "2018-12-27T09:14:04Z" "revisionTime": "2019-01-03T09:11:14Z"
}, },
{ {
"checksumSHA1": "SmYeIK/fIYXNu8IKxD6HOVQVTuU=", "checksumSHA1": "SmYeIK/fIYXNu8IKxD6HOVQVTuU=",
...@@ -407,62 +407,62 @@ ...@@ -407,62 +407,62 @@
{ {
"checksumSHA1": "aKn1oKcY74N8TRLm3Ayt7Q4bbI4=", "checksumSHA1": "aKn1oKcY74N8TRLm3Ayt7Q4bbI4=",
"path": "vitess.io/vitess/go/bytes2", "path": "vitess.io/vitess/go/bytes2",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "JVCEN4UGRmg3TofIBdzZMZ3G0Ww=", "checksumSHA1": "JVCEN4UGRmg3TofIBdzZMZ3G0Ww=",
"path": "vitess.io/vitess/go/hack", "path": "vitess.io/vitess/go/hack",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "F5pcGq+2W1FHEjgktTdKOE6W8mk=", "checksumSHA1": "F5pcGq+2W1FHEjgktTdKOE6W8mk=",
"path": "vitess.io/vitess/go/sqltypes", "path": "vitess.io/vitess/go/sqltypes",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "ntFIQYkBS51G6y+FEkjFW40+HOU=", "checksumSHA1": "ntFIQYkBS51G6y+FEkjFW40+HOU=",
"path": "vitess.io/vitess/go/vt/log", "path": "vitess.io/vitess/go/vt/log",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "tPQFPwbMdjuX0qjNl4Zl8zc37JQ=", "checksumSHA1": "HHIcl3lpWkzLARkkNv94fVaObjo=",
"path": "vitess.io/vitess/go/vt/proto/query", "path": "vitess.io/vitess/go/vt/proto/query",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "o0tR/c7lgr0pLkxk7CdvjiNDAKU=", "checksumSHA1": "YLWTmL+rvz0htn0niRMrIUI6rKc=",
"path": "vitess.io/vitess/go/vt/proto/topodata", "path": "vitess.io/vitess/go/vt/proto/topodata",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "77UojBqi0yyeQvR70j7C3kcKclQ=", "checksumSHA1": "tNNlcSFFnlOauS2hXnrz/zA/wfk=",
"path": "vitess.io/vitess/go/vt/proto/vtgate", "path": "vitess.io/vitess/go/vt/proto/vtgate",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "QpWGhoVDwM+8+sgYLI/YU+95iGU=", "checksumSHA1": "qz32abYdmm9NfKTc++K0l1EvXXM=",
"path": "vitess.io/vitess/go/vt/proto/vtrpc", "path": "vitess.io/vitess/go/vt/proto/vtrpc",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "IDe+9Bn42lZVsuoYO/epdguiErk=", "checksumSHA1": "IDe+9Bn42lZVsuoYO/epdguiErk=",
"path": "vitess.io/vitess/go/vt/sqlparser", "path": "vitess.io/vitess/go/vt/sqlparser",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
}, },
{ {
"checksumSHA1": "Jx+gOh/kiBDSZxEIWHyYn9brjdo=", "checksumSHA1": "Jx+gOh/kiBDSZxEIWHyYn9brjdo=",
"path": "vitess.io/vitess/go/vt/vterrors", "path": "vitess.io/vitess/go/vt/vterrors",
"revision": "b90b3c0bee9198c345702cce56c31fd69505c334", "revision": "6cf46db00d35072b69e7dcbec207d99836da0419",
"revisionTime": "2018-12-24T22:04:56Z" "revisionTime": "2019-01-03T03:49:25Z"
} }
], ],
"rootPath": "github.com/XiaoMi/soar" "rootPath": "github.com/XiaoMi/soar"
......
...@@ -48,7 +48,7 @@ func (x KeyspaceIdType) String() string { ...@@ -48,7 +48,7 @@ func (x KeyspaceIdType) String() string {
return proto.EnumName(KeyspaceIdType_name, int32(x)) return proto.EnumName(KeyspaceIdType_name, int32(x))
} }
func (KeyspaceIdType) EnumDescriptor() ([]byte, []int) { func (KeyspaceIdType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{0}
} }
// TabletType represents the type of a given tablet. // TabletType represents the type of a given tablet.
...@@ -117,7 +117,7 @@ func (x TabletType) String() string { ...@@ -117,7 +117,7 @@ func (x TabletType) String() string {
return proto.EnumName(TabletType_name, int32(x)) return proto.EnumName(TabletType_name, int32(x))
} }
func (TabletType) EnumDescriptor() ([]byte, []int) { func (TabletType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{1} return fileDescriptor_topodata_693bf5422a92a7f4, []int{1}
} }
// KeyRange describes a range of sharding keys, when range-based // KeyRange describes a range of sharding keys, when range-based
...@@ -134,7 +134,7 @@ func (m *KeyRange) Reset() { *m = KeyRange{} } ...@@ -134,7 +134,7 @@ func (m *KeyRange) Reset() { *m = KeyRange{} }
func (m *KeyRange) String() string { return proto.CompactTextString(m) } func (m *KeyRange) String() string { return proto.CompactTextString(m) }
func (*KeyRange) ProtoMessage() {} func (*KeyRange) ProtoMessage() {}
func (*KeyRange) Descriptor() ([]byte, []int) { func (*KeyRange) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{0}
} }
func (m *KeyRange) XXX_Unmarshal(b []byte) error { func (m *KeyRange) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_KeyRange.Unmarshal(m, b) return xxx_messageInfo_KeyRange.Unmarshal(m, b)
...@@ -184,7 +184,7 @@ func (m *TabletAlias) Reset() { *m = TabletAlias{} } ...@@ -184,7 +184,7 @@ func (m *TabletAlias) Reset() { *m = TabletAlias{} }
func (m *TabletAlias) String() string { return proto.CompactTextString(m) } func (m *TabletAlias) String() string { return proto.CompactTextString(m) }
func (*TabletAlias) ProtoMessage() {} func (*TabletAlias) ProtoMessage() {}
func (*TabletAlias) Descriptor() ([]byte, []int) { func (*TabletAlias) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{1} return fileDescriptor_topodata_693bf5422a92a7f4, []int{1}
} }
func (m *TabletAlias) XXX_Unmarshal(b []byte) error { func (m *TabletAlias) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TabletAlias.Unmarshal(m, b) return xxx_messageInfo_TabletAlias.Unmarshal(m, b)
...@@ -260,7 +260,7 @@ func (m *Tablet) Reset() { *m = Tablet{} } ...@@ -260,7 +260,7 @@ func (m *Tablet) Reset() { *m = Tablet{} }
func (m *Tablet) String() string { return proto.CompactTextString(m) } func (m *Tablet) String() string { return proto.CompactTextString(m) }
func (*Tablet) ProtoMessage() {} func (*Tablet) ProtoMessage() {}
func (*Tablet) Descriptor() ([]byte, []int) { func (*Tablet) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{2} return fileDescriptor_topodata_693bf5422a92a7f4, []int{2}
} }
func (m *Tablet) XXX_Unmarshal(b []byte) error { func (m *Tablet) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Tablet.Unmarshal(m, b) return xxx_messageInfo_Tablet.Unmarshal(m, b)
...@@ -394,7 +394,7 @@ func (m *Shard) Reset() { *m = Shard{} } ...@@ -394,7 +394,7 @@ func (m *Shard) Reset() { *m = Shard{} }
func (m *Shard) String() string { return proto.CompactTextString(m) } func (m *Shard) String() string { return proto.CompactTextString(m) }
func (*Shard) ProtoMessage() {} func (*Shard) ProtoMessage() {}
func (*Shard) Descriptor() ([]byte, []int) { func (*Shard) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{3} return fileDescriptor_topodata_693bf5422a92a7f4, []int{3}
} }
func (m *Shard) XXX_Unmarshal(b []byte) error { func (m *Shard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard.Unmarshal(m, b) return xxx_messageInfo_Shard.Unmarshal(m, b)
...@@ -469,7 +469,7 @@ func (m *Shard_ServedType) Reset() { *m = Shard_ServedType{} } ...@@ -469,7 +469,7 @@ func (m *Shard_ServedType) Reset() { *m = Shard_ServedType{} }
func (m *Shard_ServedType) String() string { return proto.CompactTextString(m) } func (m *Shard_ServedType) String() string { return proto.CompactTextString(m) }
func (*Shard_ServedType) ProtoMessage() {} func (*Shard_ServedType) ProtoMessage() {}
func (*Shard_ServedType) Descriptor() ([]byte, []int) { func (*Shard_ServedType) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{3, 0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 0}
} }
func (m *Shard_ServedType) XXX_Unmarshal(b []byte) error { func (m *Shard_ServedType) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_ServedType.Unmarshal(m, b) return xxx_messageInfo_Shard_ServedType.Unmarshal(m, b)
...@@ -526,7 +526,7 @@ func (m *Shard_SourceShard) Reset() { *m = Shard_SourceShard{} } ...@@ -526,7 +526,7 @@ func (m *Shard_SourceShard) Reset() { *m = Shard_SourceShard{} }
func (m *Shard_SourceShard) String() string { return proto.CompactTextString(m) } func (m *Shard_SourceShard) String() string { return proto.CompactTextString(m) }
func (*Shard_SourceShard) ProtoMessage() {} func (*Shard_SourceShard) ProtoMessage() {}
func (*Shard_SourceShard) Descriptor() ([]byte, []int) { func (*Shard_SourceShard) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{3, 1} return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 1}
} }
func (m *Shard_SourceShard) XXX_Unmarshal(b []byte) error { func (m *Shard_SourceShard) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_SourceShard.Unmarshal(m, b) return xxx_messageInfo_Shard_SourceShard.Unmarshal(m, b)
...@@ -601,7 +601,7 @@ func (m *Shard_TabletControl) Reset() { *m = Shard_TabletControl{} } ...@@ -601,7 +601,7 @@ func (m *Shard_TabletControl) Reset() { *m = Shard_TabletControl{} }
func (m *Shard_TabletControl) String() string { return proto.CompactTextString(m) } func (m *Shard_TabletControl) String() string { return proto.CompactTextString(m) }
func (*Shard_TabletControl) ProtoMessage() {} func (*Shard_TabletControl) ProtoMessage() {}
func (*Shard_TabletControl) Descriptor() ([]byte, []int) { func (*Shard_TabletControl) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{3, 2} return fileDescriptor_topodata_693bf5422a92a7f4, []int{3, 2}
} }
func (m *Shard_TabletControl) XXX_Unmarshal(b []byte) error { func (m *Shard_TabletControl) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Shard_TabletControl.Unmarshal(m, b) return xxx_messageInfo_Shard_TabletControl.Unmarshal(m, b)
...@@ -676,7 +676,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} } ...@@ -676,7 +676,7 @@ func (m *Keyspace) Reset() { *m = Keyspace{} }
func (m *Keyspace) String() string { return proto.CompactTextString(m) } func (m *Keyspace) String() string { return proto.CompactTextString(m) }
func (*Keyspace) ProtoMessage() {} func (*Keyspace) ProtoMessage() {}
func (*Keyspace) Descriptor() ([]byte, []int) { func (*Keyspace) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{4} return fileDescriptor_topodata_693bf5422a92a7f4, []int{4}
} }
func (m *Keyspace) XXX_Unmarshal(b []byte) error { func (m *Keyspace) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Keyspace.Unmarshal(m, b) return xxx_messageInfo_Keyspace.Unmarshal(m, b)
...@@ -735,7 +735,7 @@ func (m *Keyspace_ServedFrom) Reset() { *m = Keyspace_ServedFrom{} } ...@@ -735,7 +735,7 @@ func (m *Keyspace_ServedFrom) Reset() { *m = Keyspace_ServedFrom{} }
func (m *Keyspace_ServedFrom) String() string { return proto.CompactTextString(m) } func (m *Keyspace_ServedFrom) String() string { return proto.CompactTextString(m) }
func (*Keyspace_ServedFrom) ProtoMessage() {} func (*Keyspace_ServedFrom) ProtoMessage() {}
func (*Keyspace_ServedFrom) Descriptor() ([]byte, []int) { func (*Keyspace_ServedFrom) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{4, 0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{4, 0}
} }
func (m *Keyspace_ServedFrom) XXX_Unmarshal(b []byte) error { func (m *Keyspace_ServedFrom) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Keyspace_ServedFrom.Unmarshal(m, b) return xxx_messageInfo_Keyspace_ServedFrom.Unmarshal(m, b)
...@@ -791,7 +791,7 @@ func (m *ShardReplication) Reset() { *m = ShardReplication{} } ...@@ -791,7 +791,7 @@ func (m *ShardReplication) Reset() { *m = ShardReplication{} }
func (m *ShardReplication) String() string { return proto.CompactTextString(m) } func (m *ShardReplication) String() string { return proto.CompactTextString(m) }
func (*ShardReplication) ProtoMessage() {} func (*ShardReplication) ProtoMessage() {}
func (*ShardReplication) Descriptor() ([]byte, []int) { func (*ShardReplication) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{5} return fileDescriptor_topodata_693bf5422a92a7f4, []int{5}
} }
func (m *ShardReplication) XXX_Unmarshal(b []byte) error { func (m *ShardReplication) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReplication.Unmarshal(m, b) return xxx_messageInfo_ShardReplication.Unmarshal(m, b)
...@@ -830,7 +830,7 @@ func (m *ShardReplication_Node) Reset() { *m = ShardReplication_Node{} } ...@@ -830,7 +830,7 @@ func (m *ShardReplication_Node) Reset() { *m = ShardReplication_Node{} }
func (m *ShardReplication_Node) String() string { return proto.CompactTextString(m) } func (m *ShardReplication_Node) String() string { return proto.CompactTextString(m) }
func (*ShardReplication_Node) ProtoMessage() {} func (*ShardReplication_Node) ProtoMessage() {}
func (*ShardReplication_Node) Descriptor() ([]byte, []int) { func (*ShardReplication_Node) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{5, 0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{5, 0}
} }
func (m *ShardReplication_Node) XXX_Unmarshal(b []byte) error { func (m *ShardReplication_Node) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReplication_Node.Unmarshal(m, b) return xxx_messageInfo_ShardReplication_Node.Unmarshal(m, b)
...@@ -871,7 +871,7 @@ func (m *ShardReference) Reset() { *m = ShardReference{} } ...@@ -871,7 +871,7 @@ func (m *ShardReference) Reset() { *m = ShardReference{} }
func (m *ShardReference) String() string { return proto.CompactTextString(m) } func (m *ShardReference) String() string { return proto.CompactTextString(m) }
func (*ShardReference) ProtoMessage() {} func (*ShardReference) ProtoMessage() {}
func (*ShardReference) Descriptor() ([]byte, []int) { func (*ShardReference) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{6} return fileDescriptor_topodata_693bf5422a92a7f4, []int{6}
} }
func (m *ShardReference) XXX_Unmarshal(b []byte) error { func (m *ShardReference) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShardReference.Unmarshal(m, b) return xxx_messageInfo_ShardReference.Unmarshal(m, b)
...@@ -922,7 +922,7 @@ func (m *SrvKeyspace) Reset() { *m = SrvKeyspace{} } ...@@ -922,7 +922,7 @@ func (m *SrvKeyspace) Reset() { *m = SrvKeyspace{} }
func (m *SrvKeyspace) String() string { return proto.CompactTextString(m) } func (m *SrvKeyspace) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace) ProtoMessage() {} func (*SrvKeyspace) ProtoMessage() {}
func (*SrvKeyspace) Descriptor() ([]byte, []int) { func (*SrvKeyspace) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{7} return fileDescriptor_topodata_693bf5422a92a7f4, []int{7}
} }
func (m *SrvKeyspace) XXX_Unmarshal(b []byte) error { func (m *SrvKeyspace) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace.Unmarshal(m, b) return xxx_messageInfo_SrvKeyspace.Unmarshal(m, b)
...@@ -984,7 +984,7 @@ func (m *SrvKeyspace_KeyspacePartition) Reset() { *m = SrvKeyspace_Keysp ...@@ -984,7 +984,7 @@ func (m *SrvKeyspace_KeyspacePartition) Reset() { *m = SrvKeyspace_Keysp
func (m *SrvKeyspace_KeyspacePartition) String() string { return proto.CompactTextString(m) } func (m *SrvKeyspace_KeyspacePartition) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace_KeyspacePartition) ProtoMessage() {} func (*SrvKeyspace_KeyspacePartition) ProtoMessage() {}
func (*SrvKeyspace_KeyspacePartition) Descriptor() ([]byte, []int) { func (*SrvKeyspace_KeyspacePartition) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{7, 0} return fileDescriptor_topodata_693bf5422a92a7f4, []int{7, 0}
} }
func (m *SrvKeyspace_KeyspacePartition) XXX_Unmarshal(b []byte) error { func (m *SrvKeyspace_KeyspacePartition) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace_KeyspacePartition.Unmarshal(m, b) return xxx_messageInfo_SrvKeyspace_KeyspacePartition.Unmarshal(m, b)
...@@ -1034,7 +1034,7 @@ func (m *SrvKeyspace_ServedFrom) Reset() { *m = SrvKeyspace_ServedFrom{} ...@@ -1034,7 +1034,7 @@ func (m *SrvKeyspace_ServedFrom) Reset() { *m = SrvKeyspace_ServedFrom{}
func (m *SrvKeyspace_ServedFrom) String() string { return proto.CompactTextString(m) } func (m *SrvKeyspace_ServedFrom) String() string { return proto.CompactTextString(m) }
func (*SrvKeyspace_ServedFrom) ProtoMessage() {} func (*SrvKeyspace_ServedFrom) ProtoMessage() {}
func (*SrvKeyspace_ServedFrom) Descriptor() ([]byte, []int) { func (*SrvKeyspace_ServedFrom) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{7, 1} return fileDescriptor_topodata_693bf5422a92a7f4, []int{7, 1}
} }
func (m *SrvKeyspace_ServedFrom) XXX_Unmarshal(b []byte) error { func (m *SrvKeyspace_ServedFrom) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SrvKeyspace_ServedFrom.Unmarshal(m, b) return xxx_messageInfo_SrvKeyspace_ServedFrom.Unmarshal(m, b)
...@@ -1092,7 +1092,7 @@ func (m *CellInfo) Reset() { *m = CellInfo{} } ...@@ -1092,7 +1092,7 @@ func (m *CellInfo) Reset() { *m = CellInfo{} }
func (m *CellInfo) String() string { return proto.CompactTextString(m) } func (m *CellInfo) String() string { return proto.CompactTextString(m) }
func (*CellInfo) ProtoMessage() {} func (*CellInfo) ProtoMessage() {}
func (*CellInfo) Descriptor() ([]byte, []int) { func (*CellInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_topodata_23985cc74c86747c, []int{8} return fileDescriptor_topodata_693bf5422a92a7f4, []int{8}
} }
func (m *CellInfo) XXX_Unmarshal(b []byte) error { func (m *CellInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CellInfo.Unmarshal(m, b) return xxx_messageInfo_CellInfo.Unmarshal(m, b)
...@@ -1156,9 +1156,9 @@ func init() { ...@@ -1156,9 +1156,9 @@ func init() {
proto.RegisterEnum("topodata.TabletType", TabletType_name, TabletType_value) proto.RegisterEnum("topodata.TabletType", TabletType_name, TabletType_value)
} }
func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_23985cc74c86747c) } func init() { proto.RegisterFile("topodata.proto", fileDescriptor_topodata_693bf5422a92a7f4) }
var fileDescriptor_topodata_23985cc74c86747c = []byte{ var fileDescriptor_topodata_693bf5422a92a7f4 = []byte{
// 1162 bytes of a gzipped FileDescriptorProto // 1162 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x6f, 0x8f, 0xda, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x6f, 0x8f, 0xda, 0x46,
0x13, 0x7f, 0x0c, 0x86, 0x33, 0x63, 0x8e, 0x38, 0xfb, 0x24, 0x95, 0xe5, 0x2a, 0x2a, 0x42, 0x8a, 0x13, 0x7f, 0x0c, 0x86, 0x33, 0x63, 0x8e, 0x38, 0xfb, 0x24, 0x95, 0xe5, 0x2a, 0x2a, 0x42, 0x8a,
......
...@@ -168,7 +168,7 @@ func (x Code) String() string { ...@@ -168,7 +168,7 @@ func (x Code) String() string {
return proto.EnumName(Code_name, int32(x)) return proto.EnumName(Code_name, int32(x))
} }
func (Code) EnumDescriptor() ([]byte, []int) { func (Code) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_vtrpc_63266364cf161411, []int{0} return fileDescriptor_vtrpc_88a14d8f1bc03cf5, []int{0}
} }
// LegacyErrorCode is the enum values for Errors. This type is deprecated. // LegacyErrorCode is the enum values for Errors. This type is deprecated.
...@@ -276,7 +276,7 @@ func (x LegacyErrorCode) String() string { ...@@ -276,7 +276,7 @@ func (x LegacyErrorCode) String() string {
return proto.EnumName(LegacyErrorCode_name, int32(x)) return proto.EnumName(LegacyErrorCode_name, int32(x))
} }
func (LegacyErrorCode) EnumDescriptor() ([]byte, []int) { func (LegacyErrorCode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_vtrpc_63266364cf161411, []int{1} return fileDescriptor_vtrpc_88a14d8f1bc03cf5, []int{1}
} }
// CallerID is passed along RPCs to identify the originating client // CallerID is passed along RPCs to identify the originating client
...@@ -311,7 +311,7 @@ func (m *CallerID) Reset() { *m = CallerID{} } ...@@ -311,7 +311,7 @@ func (m *CallerID) Reset() { *m = CallerID{} }
func (m *CallerID) String() string { return proto.CompactTextString(m) } func (m *CallerID) String() string { return proto.CompactTextString(m) }
func (*CallerID) ProtoMessage() {} func (*CallerID) ProtoMessage() {}
func (*CallerID) Descriptor() ([]byte, []int) { func (*CallerID) Descriptor() ([]byte, []int) {
return fileDescriptor_vtrpc_63266364cf161411, []int{0} return fileDescriptor_vtrpc_88a14d8f1bc03cf5, []int{0}
} }
func (m *CallerID) XXX_Unmarshal(b []byte) error { func (m *CallerID) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CallerID.Unmarshal(m, b) return xxx_messageInfo_CallerID.Unmarshal(m, b)
...@@ -369,7 +369,7 @@ func (m *RPCError) Reset() { *m = RPCError{} } ...@@ -369,7 +369,7 @@ func (m *RPCError) Reset() { *m = RPCError{} }
func (m *RPCError) String() string { return proto.CompactTextString(m) } func (m *RPCError) String() string { return proto.CompactTextString(m) }
func (*RPCError) ProtoMessage() {} func (*RPCError) ProtoMessage() {}
func (*RPCError) Descriptor() ([]byte, []int) { func (*RPCError) Descriptor() ([]byte, []int) {
return fileDescriptor_vtrpc_63266364cf161411, []int{1} return fileDescriptor_vtrpc_88a14d8f1bc03cf5, []int{1}
} }
func (m *RPCError) XXX_Unmarshal(b []byte) error { func (m *RPCError) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RPCError.Unmarshal(m, b) return xxx_messageInfo_RPCError.Unmarshal(m, b)
...@@ -417,9 +417,9 @@ func init() { ...@@ -417,9 +417,9 @@ func init() {
proto.RegisterEnum("vtrpc.LegacyErrorCode", LegacyErrorCode_name, LegacyErrorCode_value) proto.RegisterEnum("vtrpc.LegacyErrorCode", LegacyErrorCode_name, LegacyErrorCode_value)
} }
func init() { proto.RegisterFile("vtrpc.proto", fileDescriptor_vtrpc_63266364cf161411) } func init() { proto.RegisterFile("vtrpc.proto", fileDescriptor_vtrpc_88a14d8f1bc03cf5) }
var fileDescriptor_vtrpc_63266364cf161411 = []byte{ var fileDescriptor_vtrpc_88a14d8f1bc03cf5 = []byte{
// 605 bytes of a gzipped FileDescriptorProto // 605 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x93, 0x4d, 0x4f, 0x1b, 0x3b, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x93, 0x4d, 0x4f, 0x1b, 0x3b,
0x14, 0x86, 0xc9, 0x07, 0xf9, 0x38, 0x13, 0x88, 0x31, 0x5f, 0xe1, 0x5e, 0xae, 0xee, 0x55, 0x56, 0x14, 0x86, 0xc9, 0x07, 0xf9, 0x38, 0x13, 0x88, 0x31, 0x5f, 0xe1, 0x5e, 0xae, 0xee, 0x55, 0x56,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册