Skip to content

Instantly share code, notes, and snippets.

@lilinghai
Created November 22, 2019 07:35
Show Gist options
  • Save lilinghai/7c1397d72ca48de870e70031989397f6 to your computer and use it in GitHub Desktop.
Save lilinghai/7c1397d72ca48de870e70031989397f6 to your computer and use it in GitHub Desktop.
qa
1.在tidb/planner/core/planbuilder.go 文件
func (b *PlanBuilder) Build(ctx context.Context, node ast.Node) (Plan, error) 函数中加入日志
case *ast.SelectStmt:
p,err:= b.buildSelect(ctx, x)
var sb2 strings.Builder
node.Restore(format.NewRestoreCtx(format.DefaultRestoreFlags, &sb2))
logutil.Logger(context.Background()).Info("restore", zap.String("stmt",sb2.String()))
return p,err
2.编译运行tidb,连接数据库,执行
use test;
create table t(a int);
SELECT ROW_NUMBER() OVER `w` FROM `test`.`t` WINDOW `w` AS (ORDER BY `a`);
3.观察tidb的日志,如果输出的restore和原始select一样,则通过
复现的是 SELECT ROW_NUMBER() OVER `w` AS (ORDER BY `a`) FROM `test`.`t` WINDOW `w` AS (ORDER BY `a`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment