This article is an opportunity for me to give you TiDB Contributor, depending on whether you want it or not.


This article was written under the leadership of Liu boss. I also hope that more people will be involved through such small activities. Although these tasks are very simple, these small tasks can reflect our TiDB team's perfect pursuit of code quality. This is what we should learn. This is an opportunity for you to improve/improve your code level. You shouldn't give up easily.

Overview of the problem

Some of the % in TiDB's test cases enclose the statement with double quotes "", but Github escaping it when displayed, so it will be marked with % red, and we are doing a review of It doesn't look beautiful at the moment, so we need to change this and recommend replacing it with the Go language.

For examples: PR #5697

How to decide?

I can give you a reference note. If you use the Go syntax highlighting plug-in, then you can see that the unhighlighted part is escaping. It may be problematic. Then we need to make changes. [eg, 100%500, %W %r].

How to test and verify?

  1. First you have to fork TiDB (so that you can edit the file on GitHub).
  2. Open a suspicious file (For examples: util/stringutil/string_util_test.go).
  3. Find the code statement for the problem overview description.
  4. Modify the 3 corresponding code statement.
  5. Click Preview changes.
  6. Check and verify that your changes are correct.

Let me give you an example. It will be clear to see.

to add on

The above content is the original intention that we should change, but in fact we can do more.

Wrap all testkit's pending SQL statements with `` .

Therefore, we should modify the SQL statements of the following methods by the way when we modify them.

  • Exec
  • MustExec
  • MustQuery

Todo List

  • executor/aggregate_test.go @yangwenmai #6130
  • executor/grant_test.go @kangxiaoning #6137
  • executor/show_test.go @chenyang8094 #6138
  • expression/bench_test.go @chenyang8094 #6138
  • expression/builtin_string_test.go @chenyang8094 #6138
  • expression/builtin_time_test.go @chenyang8094 #6138
  • expression/evaluator_test.go @kangxiaoning #6137
  • expression/expr_to_pb_test.go @kangxiaoning #6137
  • expression/integration_test.go @kangxiaoning #6137
  • expression/typeinfer_test.go @kangxiaoning #6137
  • parser/parser_test.go @kangxiaoning #6137
  • plan/physical_plan_test.go @kangxiaoning #6137
  • privilege/privileges/privileges_test.go @yangwenmai #6176
  • session/bootstrap_test.go @kangxiaoning #6137
  • session/session_test.go @kangxiaoning #6137
  • session/tidb_test.go @kangxiaoning #6137
  • types/format_test.go @kangxiaoning #6137
  • util/prefix_helper_test.go @kangxiaoning #6137
  • util/stringutil/string_util_test.go @yangwenmai #6177
  • util/ranger/ranger_test.go @hechen0 #6144

The entire repair process took about 10 days.