From 35353c5d7441818db633fdf48e365e95721558ae Mon Sep 17 00:00:00 2001 From: Tim Vaillancourt Date: Wed, 19 Jun 2024 21:42:33 +0200 Subject: [PATCH] Update `TestValidUnionCases` and `TestValidSelectCases` Signed-off-by: Tim Vaillancourt --- go/vt/sqlparser/testdata/select_cases.txt | 4 ++-- go/vt/sqlparser/testdata/union_cases.txt | 24 +++++++++---------- .../vtgate/planbuilder/testdata/onecase.json | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/go/vt/sqlparser/testdata/select_cases.txt b/go/vt/sqlparser/testdata/select_cases.txt index 849dba354e4..dd3fa44e61d 100644 --- a/go/vt/sqlparser/testdata/select_cases.txt +++ b/go/vt/sqlparser/testdata/select_cases.txt @@ -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); @@ -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; diff --git a/go/vt/sqlparser/testdata/union_cases.txt b/go/vt/sqlparser/testdata/union_cases.txt index 0f74e8a3cda..57a42cac2be 100644 --- a/go/vt/sqlparser/testdata/union_cases.txt +++ b/go/vt/sqlparser/testdata/union_cases.txt @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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); @@ -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)); @@ -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; @@ -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; @@ -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; diff --git a/go/vt/vtgate/planbuilder/testdata/onecase.json b/go/vt/vtgate/planbuilder/testdata/onecase.json index 4ec3963e977..da1f6fbf0a6 100644 --- a/go/vt/vtgate/planbuilder/testdata/onecase.json +++ b/go/vt/vtgate/planbuilder/testdata/onecase.json @@ -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": {