@@ -46,7 +46,7 @@ func (s *testParserSuite) TestSimple(c *C) {
46
46
"column" , "constraint" , "convert" , "create" , "cross" , "current_date" , "current_time" ,
47
47
"current_timestamp" , "current_user" , "database" , "databases" , "day_hour" , "day_microsecond" ,
48
48
"day_minute" , "day_second" , "decimal" , "default" , "delete" , "desc" , "describe" ,
49
- "distinct" , "div" , "double" , "drop" , "dual" , "else" , "enclosed" , "escaped" ,
49
+ "distinct" , "distinctRow" , " div" , "double" , "drop" , "dual" , "else" , "enclosed" , "escaped" ,
50
50
"exists" , "explain" , "false" , "float" , "for" , "force" , "foreign" , "from" ,
51
51
"fulltext" , "grant" , "group" , "having" , "hour_microsecond" , "hour_minute" ,
52
52
"hour_second" , "if" , "ignore" , "in" , "index" , "infile" , "inner" , "insert" , "int" , "into" , "integer" ,
@@ -218,6 +218,10 @@ func (s *testParserSuite) TestDMLStmt(c *C) {
218
218
// 30
219
219
{"SELECT DISTINCTS * FROM t" , false },
220
220
{"SELECT DISTINCT * FROM t" , true },
221
+ {"SELECT DISTINCTROW * FROM t" , true },
222
+ {"SELECT ALL * FROM t" , true },
223
+ {"SELECT DISTINCT ALL * FROM t" , false },
224
+ {"SELECT DISTINCTROW ALL * FROM t" , false },
221
225
{"INSERT INTO foo (a) VALUES (42)" , true },
222
226
{"INSERT INTO foo (a,) VALUES (42,)" , false },
223
227
// 35
@@ -1014,26 +1018,45 @@ func (s *testParserSuite) TestBuiltin(c *C) {
1014
1018
// for aggregate functions
1015
1019
{`select avg(), avg(c1,c2) from t;` , false },
1016
1020
{`select avg(distinct c1) from t;` , true },
1021
+ {`select avg(distinctrow c1) from t;` , true },
1022
+ {`select avg(distinct all c1) from t;` , true },
1023
+ {`select avg(distinctrow all c1) from t;` , true },
1017
1024
{`select avg(c2) from t;` , true },
1018
1025
{`select bit_xor(c1) from t;` , true },
1019
1026
{`select bit_xor(), bit_xor(distinct c1) from t;` , false },
1027
+ {`select bit_xor(), bit_xor(distinctrow c1) from t;` , false },
1028
+ {`select bit_xor(), bit_xor(all c1) from t;` , false },
1020
1029
{`select max(c1,c2) from t;` , false },
1021
1030
{`select max(distinct c1) from t;` , true },
1031
+ {`select max(distinctrow c1) from t;` , true },
1032
+ {`select max(distinct all c1) from t;` , true },
1033
+ {`select max(distinctrow all c1) from t;` , true },
1022
1034
{`select max(c2) from t;` , true },
1023
1035
{`select min(c1,c2) from t;` , false },
1024
1036
{`select min(distinct c1) from t;` , true },
1037
+ {`select min(distinctrow c1) from t;` , true },
1038
+ {`select min(distinct all c1) from t;` , true },
1039
+ {`select min(distinctrow all c1) from t;` , true },
1025
1040
{`select min(c2) from t;` , true },
1026
1041
{`select sum(c1,c2) from t;` , false },
1027
1042
{`select sum(distinct c1) from t;` , true },
1043
+ {`select sum(distinctrow c1) from t;` , true },
1044
+ {`select sum(distinct all c1) from t;` , true },
1045
+ {`select sum(distinctrow all c1) from t;` , true },
1028
1046
{`select sum(c2) from t;` , true },
1029
1047
{`select count(c1) from t;` , true },
1030
1048
{`select count(distinct *) from t;` , false },
1049
+ {`select count(distinctrow *) from t;` , false },
1031
1050
{`select count(*) from t;` , true },
1032
1051
{`select count(distinct c1, c2) from t;` , true },
1052
+ {`select count(distinctrow c1, c2) from t;` , true },
1033
1053
{`select count(c1, c2) from t;` , false },
1034
1054
{`select count(all c1) from t;` , true },
1055
+ {`select count(distinct all c1) from t;` , false },
1056
+ {`select count(distinctrow all c1) from t;` , false },
1035
1057
{`select group_concat(c2,c1) from t group by c1;` , true },
1036
1058
{`select group_concat(distinct c2,c1) from t group by c1;` , true },
1059
+ {`select group_concat(distinctrow c2,c1) from t group by c1;` , true },
1037
1060
1038
1061
// for encryption and compression functions
1039
1062
{`select AES_ENCRYPT('text',UNHEX('F3229A0B371ED2D9441B830D21A390C3'))` , true },
@@ -1562,7 +1585,10 @@ func (s *testParserSuite) TestUnion(c *C) {
1562
1585
{"select c1 from t1 union (select c2 from t2) limit 1, 1" , true },
1563
1586
{"select c1 from t1 union (select c2 from t2) order by c1 limit 1" , true },
1564
1587
{"(select c1 from t1) union distinct select c2 from t2" , true },
1588
+ {"(select c1 from t1) union distinctrow select c2 from t2" , true },
1565
1589
{"(select c1 from t1) union all select c2 from t2" , true },
1590
+ {"(select c1 from t1) union distinct all select c2 from t2" , false },
1591
+ {"(select c1 from t1) union distinctrow all select c2 from t2" , false },
1566
1592
{"(select c1 from t1) union (select c2 from t2) order by c1 union select c3 from t3" , false },
1567
1593
{"(select c1 from t1) union (select c2 from t2) limit 1 union select c3 from t3" , false },
1568
1594
{"(select c1 from t1) union select c2 from t2 union (select c3 from t3) order by c1 limit 1" , true },
0 commit comments