Skip to content

Commit

Permalink
Update TestValidUnionCases and TestValidSelectCases
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com>
  • Loading branch information
timvaillancourt committed Jun 19, 2024
1 parent b978f63 commit 35353c5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions go/vt/sqlparser/testdata/select_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2438,7 +2438,7 @@ INPUT
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
END
OUTPUT
select case when count(*) < MAX_REQ then 1 else 0 end from t1 where t1.USR_ID = 1 group by MAX_REQ
select case when Count(*) < MAX_REQ then 1 else 0 end from t1 where t1.USR_ID = 1 group by MAX_REQ
END
INPUT
select t1.*,t2.* from t1 inner join t2 using (a);
Expand Down Expand Up @@ -7220,7 +7220,7 @@ INPUT
select userid,count(*) from t1 group by userid having 3 IN (1,COUNT(*)) order by userid desc;
END
OUTPUT
select userid, count(*) from t1 group by userid having 3 in (1, count(*)) order by userid desc
select userid, count(*) from t1 group by userid having 3 in (1, COUNT(*)) order by userid desc
END
INPUT
select count(distinct t) from t1;
Expand Down
24 changes: 12 additions & 12 deletions go/vt/sqlparser/testdata/union_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1) UNION ALL SELECT a FROM t1;
END
OUTPUT
(select a from t1 order by count(*) asc limit 1) union all select a from t1
(select a from t1 order by COUNT(*) asc limit 1) union all select a from t1
END
INPUT
SELECT ST_AsText(ST_Union(ST_GEOMFROMTEXT( 'GEOMETRYCOLLECTION(POLYGON((0 0, 3 0, 3 3, 0 3, 0 0)), LINESTRING(3 1, 4 1))'), ST_GEOMFROMTEXT('GEOMETRYCOLLECTION()'))) as result;
Expand Down Expand Up @@ -452,7 +452,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*)) UNION ALL SELECT a FROM t1;
END
OUTPUT
(select a from t1 order by count(*) asc) union all select a from t1
(select a from t1 order by COUNT(*) asc) union all select a from t1
END
INPUT
(SELECT * FROM t1 LIMIT 5 OFFSET 4) UNION ALL (SELECT * FROM t2 LIMIT 4 OFFSET 2) LIMIT 7 OFFSET 1;
Expand Down Expand Up @@ -524,7 +524,7 @@ INPUT
SELECT a FROM t1 UNION (SELECT a FROM t1 ORDER BY COUNT(*));
END
OUTPUT
select a from t1 union (select a from t1 order by count(*) asc)
select a from t1 union (select a from t1 order by COUNT(*) asc)
END
INPUT
select min(`col002`) from t1 union select `col002` from t1;
Expand Down Expand Up @@ -746,7 +746,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1) UNION SELECT a FROM t1;
END
OUTPUT
(select a from t1 order by count(*) asc limit 1) union select a from t1
(select a from t1 order by COUNT(*) asc limit 1) union select a from t1
END
INPUT
select * from t1 union select * from t2 order by 1 limit 1;
Expand Down Expand Up @@ -794,7 +794,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*)) UNION SELECT a FROM t1;
END
OUTPUT
(select a from t1 order by count(*) asc) union select a from t1
(select a from t1 order by COUNT(*) asc) union select a from t1
END
INPUT
select 1 union select 1;
Expand Down Expand Up @@ -836,7 +836,7 @@ INPUT
SELECT a FROM t1 UNION (SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1 OFFSET 1);
END
OUTPUT
select a from t1 union (select a from t1 order by count(*) asc limit 1, 1)
select a from t1 union (select a from t1 order by COUNT(*) asc limit 1, 1)
END
INPUT
(SELECT * FROM t1 LIMIT 5) UNION SELECT * FROM t2 LIMIT 8;
Expand Down Expand Up @@ -908,7 +908,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1) UNION (SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1 OFFSET 1);
END
OUTPUT
(select a from t1 order by count(*) asc limit 1) union (select a from t1 order by count(*) asc limit 1, 1)
(select a from t1 order by COUNT(*) asc limit 1) union (select a from t1 order by COUNT(*) asc limit 1, 1)
END
INPUT
SELECT 2 as "my_col" UNION SELECT 1;
Expand Down Expand Up @@ -974,7 +974,7 @@ INPUT
SELECT a FROM t1 UNION ALL (SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1 OFFSET 1);
END
OUTPUT
select a from t1 union all (select a from t1 order by count(*) asc limit 1, 1)
select a from t1 union all (select a from t1 order by COUNT(*) asc limit 1, 1)
END
INPUT
(SELECT p1 FROM v2 LEFT JOIN v1 ON b = a WHERE p2 = 1 GROUP BY p1 ORDER BY p1) UNION (SELECT NULL LIMIT 0);
Expand Down Expand Up @@ -1106,7 +1106,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1) UNION ALL (SELECT a FROM t1 ORDER BY COUNT(*) LIMIT 1 OFFSET 1);
END
OUTPUT
(select a from t1 order by count(*) asc limit 1) union all (select a from t1 order by count(*) asc limit 1, 1)
(select a from t1 order by COUNT(*) asc limit 1) union all (select a from t1 order by COUNT(*) asc limit 1, 1)
END
INPUT
select 'a' union select concat('a', -(4 + 1));
Expand Down Expand Up @@ -1208,7 +1208,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*)) UNION ALL (SELECT a FROM t1 ORDER BY COUNT(*));
END
OUTPUT
(select a from t1 order by count(*) asc) union all (select a from t1 order by count(*) asc)
(select a from t1 order by COUNT(*) asc) union all (select a from t1 order by COUNT(*) asc)
END
INPUT
select 1 as a union all select 1 union all select 2 union select 1 union all select 2;
Expand Down Expand Up @@ -1280,7 +1280,7 @@ INPUT
SELECT a FROM t1 UNION ALL (SELECT a FROM t1 ORDER BY COUNT(*));
END
OUTPUT
select a from t1 union all (select a from t1 order by count(*) asc)
select a from t1 union all (select a from t1 order by COUNT(*) asc)
END
INPUT
SELECT ST_ASTEXT(ST_UNION(ST_GEOMFROMTEXT('MULTIPOLYGON(((-7 -9,-3 7,0 -10,-6 5,10 10,-3 -4,7 9,2 -9)),((1 -10,-3 10,-2 5)))'), ST_GEOMFROMTEXT('POLYGON((6 10,-7 10,-1 -6,0 5,5 4,1 -9,1 3,-10 -7,-10 8))'))) as result;
Expand Down Expand Up @@ -1418,7 +1418,7 @@ INPUT
(SELECT a FROM t1 ORDER BY COUNT(*)) UNION (SELECT a FROM t1 ORDER BY COUNT(*));
END
OUTPUT
(select a from t1 order by count(*) asc) union (select a from t1 order by count(*) asc)
(select a from t1 order by COUNT(*) asc) union (select a from t1 order by COUNT(*) asc)
END
INPUT
SELECT GROUP_CONCAT(t.c) as c FROM t1 t UNION SELECT '' as c;
Expand Down
3 changes: 2 additions & 1 deletion go/vt/vtgate/planbuilder/testdata/onecase.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"comment": "Add your test case here for debugging and run go test -run=One.",
"query": "select Count(*) from user join user_extra where user.intcol + user_extra.incol < 5 limit 5",
"plan": {
"v3-plan": "table user not found",
"gen4-plan": {
"QueryType": "SELECT",
"Original": "select Count(*) from user join user_extra where user.intcol + user_extra.incol < 5 limit 5",
"Instructions": {
Expand Down

0 comments on commit 35353c5

Please sign in to comment.