Skip to content

Commit

Permalink
parser: add TableOptimizerHint TIDB_HASHAGG and TIDB_STREAMAGG (#394)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreyes authored Jul 23, 2019
1 parent 837bc29 commit 09602ee
Show file tree
Hide file tree
Showing 5 changed files with 6,306 additions and 6,256 deletions.
5 changes: 3 additions & 2 deletions ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2032,9 +2032,10 @@ type TableOptimizerHint struct {
func (n *TableOptimizerHint) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord(n.HintName.String())
ctx.WritePlain("(")
if n.HintName.L == "max_execution_time" {
switch n.HintName.L {
case "max_execution_time":
ctx.WritePlainf("%d", n.MaxExecutionTime)
} else {
case "tidb_hj", "tidb_smj", "tidb_inlj":
for i, table := range n.Tables {
if i != 0 {
ctx.WritePlain(", ")
Expand Down
2 changes: 2 additions & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ var tokenMap = map[string]int{
"TIDB_HJ": tidbHJ,
"TIDB_INLJ": tidbINLJ,
"TIDB_SMJ": tidbSMJ,
"TIDB_HASHAGG": tidbHASHAGG,
"TIDB_STREAMAGG": tidbSTREAMAGG,
"TIME": timeType,
"TIMESTAMP": timestampType,
"TIMESTAMPADD": timestampAdd,
Expand Down
Loading

0 comments on commit 09602ee

Please sign in to comment.