Skip to content

Commit

Permalink
[parser] *: Add format_bytes and format_nano_time function (pingcap#754)
Browse files Browse the repository at this point in the history
* add Performance Schema Functions format_bytes and format_nano_time

Signed-off-by: gauss <[email protected]>

* remove a test case

Signed-off-by: gauss <[email protected]>

Co-authored-by: kennytm <[email protected]>
  • Loading branch information
2 people authored and xhebox committed Oct 8, 2021
1 parent 7606f36 commit 64ca8e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions parser/ast/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ const (
TiDBVersion = "tidb_version"
TiDBIsDDLOwner = "tidb_is_ddl_owner"
TiDBDecodePlan = "tidb_decode_plan"
FormatBytes = "format_bytes"
FormatNanoTime = "format_nano_time"

// control functions
If = "if"
Expand Down
2 changes: 2 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,8 @@ func (s *testParserSuite) TestBuiltin(c *C) {
{"SELECT ROW_COUNT();", true, "SELECT ROW_COUNT()"},
{"SELECT SESSION_USER();", true, "SELECT SESSION_USER()"},
{"SELECT SYSTEM_USER();", true, "SELECT SYSTEM_USER()"},
{"SELECT FORMAT_BYTES(512);", true, "SELECT FORMAT_BYTES(512)"},
{"SELECT FORMAT_NANO_TIME(3501);", true, "SELECT FORMAT_NANO_TIME(3501)"},

{"SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);", true, "SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2)"},
{"SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);", true, "SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2)"},
Expand Down

0 comments on commit 64ca8e2

Please sign in to comment.