Commit Graph

47 Commits

Author SHA1 Message Date
3337405dd0 expression, parser: add built-in func is_uuid (#30318) 2021-12-07 02:47:55 +08:00
xhe
94e30df8e2 parser: fix compiling, add unit tests (#28700) 2021-10-11 23:15:25 +08:00
eb90a169f5 [parser] ast/functions: Add built-in function tidb_decode_sql_digests (#1289) 2021-10-09 14:53:23 +08:00
217cd12248 [parser] parser: support Oracle translate function (#1283) 2021-10-09 14:53:23 +08:00
e8aea0f97d [parser] parser: add AsOfClause for START TRANSACTION READ ONLY statement (#1215)
* Add AsOfClause for START TRANSACTION READ ONLY statement

Signed-off-by: JmPotato <ghzpotato@gmail.com>
2021-10-09 14:53:23 +08:00
85c41d1017 [parser] parser: support builtin function SOUNDEX (#1161)
* add soundex

* add unit test
2021-10-09 14:53:23 +08:00
c3ac91c0ac [parser] ast: fix restore panic for TRIM() when arguments contain column name (#1124) 2021-10-09 14:53:23 +08:00
d61bcedfa7 [parser] Adding vitess_hash function to ast (#1089)
Co-authored-by: Arenatlx <ailinsilence4@gmail.com>
2021-10-09 14:53:23 +08:00
123af51c0c [parser] expression: Support bin-to-uuid and uuid-to-bin (#1038)
* add uuid-to-bin bin-to-uuid

* add test

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
1ffb873bba [parser] executor: add builtin aggregate function json_arrayagg (#1020) 2021-10-09 14:53:23 +08:00
3478f82e55 [parser] fix incorrect convert function restore (#1015)
* fix convert restore bug

* fmt

* fix
2021-10-09 14:53:23 +08:00
958292eb74 [parser] remove IsTruth to IsTruthWithoutNull (#1016) 2021-10-09 14:53:23 +08:00
e00ce30482 [parser] withNull (#1005)
Co-authored-by: Yuanjia Zhang <zhangyuanjia@pingcap.com>
2021-10-09 14:53:23 +08:00
d215bbeaf1 [parser] Support APPROX_PERCENTILE function (#1002)
* support approx_percentile function

* update

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
a329df515d [parser] fix tiny bug about cast function (#995) 2021-10-09 14:53:23 +08:00
01de34b128 [parser] Add std and stddev function (#972) 2021-10-09 14:53:23 +08:00
xhe
2dbf28d553 [parser] fix: correct file permission (#918)
Commit 334dfef16055ffaf9c704b7ad25ce7540cb6ce38 changed several files into
executables. Commit f6e17887c998e7c7d460bfabb198ed5f53dd22a2 reverted the
permission of parser_test.go from 755 to 644, but missed all other
files. Later go.mod1/go.sum1 are removed. This commit fixed the
permission of remaining affected files.
2021-10-09 14:53:23 +08:00
f50f4dcdc3 [parser] ast/functions: add tidb_decode_base64 function (#911) 2021-10-09 14:53:23 +08:00
fa0c1896c7 [parser] let function names like a.b() be parsed successfully (#876) 2021-10-09 14:53:23 +08:00
7550c31db7 [parser] parser: add new agg function APPROX_COUNT_DISTINCT (#854)
Signed-off-by: Tong Zhigao <tongzhigao@pingcap.com>
2021-10-09 14:53:23 +08:00
29c3fc2591 [parser] parser: add order by clause in group_concat (#813) 2021-10-09 14:53:23 +08:00
928eb78a0e [parser] add func: mvcc_get_by_hex (#805)
Signed-off-by: Qiannan Lyu <lvqiannan@gmail.com>

Co-authored-by: Lingyu Song <songlingyu@pingcap.com>
2021-10-09 14:53:23 +08:00
58f9e70de7 [parser] *: support parsing BACKUP and RESTORE statements (#746)
* *: support parsing BACKUP and RESTORE statements

* parser: add SNAPSHOT = 'str' option to BACKUP statement
2021-10-09 14:53:23 +08:00
1f323f3aa7 [parser] *: Add format_bytes and format_nano_time function (#754)
* add Performance Schema Functions format_bytes and format_nano_time

Signed-off-by: gauss <gauss1314@gmail.com>

* remove a test case

Signed-off-by: gauss <gauss1314@gmail.com>

Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-09 14:53:23 +08:00
9fe4e83705 [parser] parser: add WEIGHT_STRING() function (#743) 2021-10-09 14:53:23 +08:00
6eb2909901 [parser] change all dot import, according to staticcheck (#730)
* change all dot import, according to staticcheck

* make staticcheck happy
2021-10-09 14:53:23 +08:00
313a0d13e4 [parser] parser: support sequence function & next value for (#713) 2021-10-09 14:53:23 +08:00
048bd7d569 [parser] add definition of json_objectagg (#378) 2021-10-09 14:53:23 +08:00
26b362d28c [parser] parser: rename 'timestampliteral' to avoid misuse of 'select timestampliteral()' (#591)
When the input is select timestamp '2019-10-29 16:14:42', it's parsed to something like

> 'select timestampliteral()'

`timestampliteral` is a valid function name in TiDB, used to implement the timestamp literal.

However, if the input is 'select timestampliteral()', we should reject this query.
This PR renames `timestampliteral` to avoid conflict.
2021-10-09 14:53:23 +08:00
6c5bccec30 [parser] ast/functions: add tidb_decode_plan() function (#557) 2021-10-09 14:53:23 +08:00
76dc8603e6 [parser] ast/functions: add tidb_decode_key() function (#560) 2021-10-09 14:53:23 +08:00
5fe457fc98 [parser] ast,parser: added several expression types to represent keyword arguments (#142)
* ast,parser: added several expression types to represent keyword arguments

Added TimeUnitExpr to represent time and timestamp units like SECOND in
DATE_ADD(time, INTERVAL x SECOND).

Added GetFormatSelectorExpr to represent the selectors like DATETIME in
GET_FORMAT(DATETIME, locale).

Added TrimDirectionExpr to represent the direction like BOTH in
TRIM(BOTH 'x' FROM 'xyz').

Changed FrameBound's Unit to use TimeUnitType directly.

Previously these were all converted into a string or integer ValueExpr,
which made Restore() implementation very ugly.

* ast: change type of PartitionMethod.Unit from ValueExpr to TimeUnitType
2021-10-09 14:53:23 +08:00
f189c0a2bf [parser] parser : add support for octet_length function (#401) 2021-10-09 14:53:23 +08:00
568898c8d7 [parser] type/compatibility: fix show create table output of generated column (#235) 2021-10-09 14:53:23 +08:00
bee7de1fb7 [parser] parser, ast: add SET ROLE support (#228) 2021-10-09 14:53:23 +08:00
0e6164a43e [parser] parser: implement Restore for SelectStmt (#153) 2021-10-09 14:53:23 +08:00
779495f792 [parser] parser: change the location of RestoreCtx (#157) 2021-10-09 14:53:23 +08:00
4597f2d3c8 [parser] parser: implement Restore for FrameClause, PartitionByClause, WindowSpec and WindowFuncExpr (#143) 2021-10-09 14:53:23 +08:00
6d3f99487a [parser] parser: implement Restore for FuncCallExpr and AggregateFuncExpr (#102) 2021-10-09 14:53:23 +08:00
3d7841959f [parser] parser: add RestoreCtx and change the Node interface (#78) 2021-10-09 14:53:23 +08:00
8a205ccc0a [parser] *: support AST to SQL text (#56)
* ast2sql demo

* add SQLSentence

* mock func Restore

* change copyright

* add comment

* add test

* change tidb dependentment

* fix error comment

* use strings.Builder

* fix test

* add error return value for Recoverable

* add error return value for Recoverable

* add error return value for Recoverable

* impl Restore of UnaryOperationExpr

* integrate utils

* switch tidb dependency

* add comment

* add comment

* update unit test

* fix Restore of DatabaseOption

* fix Restore of DatabaseOption

* fix Restore of DatabaseOption

* update unit test

* use errorf
2021-10-09 14:53:23 +08:00
7507d986f9 [parser] *: support new aggregation function var_pop and var_samp (#53) 2021-10-09 14:53:23 +08:00
c962b11ce3 [parser] ast: change Tso function name to TiDBParseTso (#50) 2021-10-09 14:53:23 +08:00
b9e1bf0af6 [parser] add from_tso function (#48) 2021-10-09 14:53:23 +08:00
1b27e9e11e [parser] parser: support window function ast (#37) 2021-10-09 14:53:23 +08:00
e7578634a3 [parser] ci 2021-10-09 14:53:23 +08:00
c270f55405 [parser] *: move github.com/pingcap/tidb/parser here (#1) 2021-10-09 14:53:23 +08:00