Skip to content

Commit

Permalink
[parser] add from_tso function (pingcap#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
yu34po authored and xhebox committed Oct 8, 2021
1 parent a18d780 commit 0caa802
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions parser/ast/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ const (
Year = "year"
YearWeek = "yearweek"
LastDay = "last_day"
Tso = "tidb_parse_tso"

// string functions
ASCII = "ascii"
Expand Down
5 changes: 5 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,11 @@ func (s *testParserSuite) TestWindowFunctions(c *C) {
{`SELECT FIRST_VALUE(year) OVER (w ORDER BY year ASC) AS first FROM sales WINDOW w AS (PARTITION BY country);`, true},
{`SELECT RANK() OVER w1 FROM t WINDOW w1 AS (w2), w2 AS (), w3 AS (w1);`, true},
{`SELECT RANK() OVER w1 FROM t WINDOW w1 AS (w2), w2 AS (w3), w3 AS (w1);`, true},

// For tidb_parse_tso
{`select tidb_parse_tso(1)`, true},
{`select from_unixtime(404411537129996288)`, true},
{`select from_unixtime(404411537129996288.22)`, true},
}
s.enableWindowFunc = true
s.RunTest(c, table)
Expand Down

0 comments on commit 0caa802

Please sign in to comment.