diff --git a/go/vt/sqlparser/cow.go b/go/vt/sqlparser/cow.go index e807fdeef63..be376f84403 100644 --- a/go/vt/sqlparser/cow.go +++ b/go/vt/sqlparser/cow.go @@ -53,6 +53,32 @@ func CopyOnRewrite( return out } +func CopyAndReplaceExpr(node SQLNode, replaceFn func(node Expr) (Expr, bool)) SQLNode { + var replace Expr + pre := func(node, _ SQLNode) bool { + expr, ok := node.(Expr) + if !ok { + return true + } + newExpr, ok := replaceFn(expr) + if !ok { + return true + } + replace = newExpr + return false + } + + post := func(cursor *CopyOnWriteCursor) { + if replace == nil { + return + } + cursor.Replace(replace) + replace = nil + } + + return CopyOnRewrite(node, pre, post, nil) +} + // StopTreeWalk aborts the current tree walking. No more nodes will be visited, and the rewriter will exit out early func (c *CopyOnWriteCursor) StopTreeWalk() { c.stop = true diff --git a/go/vt/vtgate/executorcontext/vcursor_impl.go b/go/vt/vtgate/executorcontext/vcursor_impl.go index 4a249059983..6b83953fe23 100644 --- a/go/vt/vtgate/executorcontext/vcursor_impl.go +++ b/go/vt/vtgate/executorcontext/vcursor_impl.go @@ -1130,8 +1130,8 @@ func (vc *VCursorImpl) SetFoundRows(foundRows uint64) { vc.SafeSession.SetFoundRows(foundRows) } -func (vc *vcursorImpl) SetLastInsertID(id uint64) { - vc.safeSession.LastInsertId = id +func (vc *VCursorImpl) SetLastInsertID(id uint64) { + vc.SafeSession.LastInsertId = id } // SetDDLStrategy implements the SessionActions interface diff --git a/go/vt/vtgate/planbuilder/operators/query_planning.go b/go/vt/vtgate/planbuilder/operators/query_planning.go index f47d6b6927c..5e0718404ea 100644 --- a/go/vt/vtgate/planbuilder/operators/query_planning.go +++ b/go/vt/vtgate/planbuilder/operators/query_planning.go @@ -32,8 +32,7 @@ import ( func planQuery(ctx *plancontext.PlanningContext, root Operator) Operator { var selExpr sqlparser.SelectExprs if horizon, isHorizon := root.(*Horizon); isHorizon { - sel := sqlparser.GetFirstSelect(horizon.Query) - selExpr = sqlparser.Clone(sel.SelectExprs) + selExpr = extractSelectExpressions(horizon) } output := runPhases(ctx, root) @@ -821,36 +820,46 @@ func tryPushUnion(ctx *plancontext.PlanningContext, op *Union) (Operator, *Apply return newUnion(sources, selects, op.unionColumns, op.distinct), Rewrote("merge union inputs") } -// addTruncationOrProjectionToReturnOutput uses the original Horizon to make sure that the output columns line up with what the user asked for -func addTruncationOrProjectionToReturnOutput(ctx *plancontext.PlanningContext, selExprs sqlparser.SelectExprs, output Operator) Operator { - if len(selExprs) == 0 { - return output - } - - cols := output.GetSelectExprs(ctx) - sizeCorrect := len(selExprs) == len(cols) || tryTruncateColumnsAt(output, len(selExprs)) - if !sizeCorrect || !colNamesAlign(selExprs, cols) { - output = createSimpleProjection(ctx, selExprs, output) - } - - if !ctx.SemTable.QuerySignature.LastInsertIDArg { - return output - } - - var offset int - for i, expr := range selExprs { +func handleLastInsertIDColumns(ctx *plancontext.PlanningContext, output Operator) Operator { + offset := -1 + topLevel := false + var arg sqlparser.Expr + for i, expr := range output.GetSelectExprs(ctx) { ae, ok := expr.(*sqlparser.AliasedExpr) if !ok { panic(vterrors.VT09015()) } - fnc, ok := ae.Expr.(*sqlparser.FuncExpr) - if !ok || !fnc.Name.EqualString("last_insert_id") { - continue + + replaceFn := func(node sqlparser.Expr) (sqlparser.Expr, bool) { + fnc, ok := node.(*sqlparser.FuncExpr) + if !ok || !fnc.Name.EqualString("last_insert_id") { + return node, false + } + if offset != -1 { + panic(vterrors.VT12001("last_insert_id() found multiple times in select list")) + } + arg = fnc.Exprs[0] + if node == ae.Expr { + topLevel = true + } + offset = i + return arg, true + } + + newExpr := sqlparser.CopyAndReplaceExpr(ae.Expr, replaceFn) + ae.Expr = newExpr.(sqlparser.Expr) + } + + if topLevel { + return &SaveToSession{ + unaryOperator: unaryOperator{ + Source: output, + }, + Offset: offset, } - offset = i - break } + offset = output.AddColumn(ctx, false, false, aeWrap(arg)) return &SaveToSession{ unaryOperator: unaryOperator{ Source: output, @@ -859,6 +868,40 @@ func addTruncationOrProjectionToReturnOutput(ctx *plancontext.PlanningContext, s } } +// addTruncationOrProjectionToReturnOutput uses the original Horizon to make sure that the output columns line up with what the user asked for +func addTruncationOrProjectionToReturnOutput(ctx *plancontext.PlanningContext, selExprs sqlparser.SelectExprs, output Operator) Operator { + if len(selExprs) == 0 { + return output + } + + if ctx.SemTable.QuerySignature.LastInsertIDArg { + output = handleLastInsertIDColumns(ctx, output) + } + + cols := output.GetSelectExprs(ctx) + sizeCorrect := len(selExprs) == len(cols) || tryTruncateColumnsAt(output, len(selExprs)) + if sizeCorrect && colNamesAlign(selExprs, cols) { + return output + } + + return createSimpleProjection(ctx, selExprs, output) +} + +func extractSelectExpressions(horizon *Horizon) sqlparser.SelectExprs { + sel := sqlparser.GetFirstSelect(horizon.Query) + // we handle last_insert_id with arguments separately - no need to send this down to mysql + selExprs := sqlparser.CopyAndReplaceExpr(sel.SelectExprs, func(node sqlparser.Expr) (sqlparser.Expr, bool) { + fnc, ok := node.(*sqlparser.FuncExpr) + if !ok || !fnc.Name.EqualString("last_insert_id") || len(fnc.Exprs) != 1 { + return nil, false + } + + return fnc.Exprs[0], true + }) + + return selExprs.(sqlparser.SelectExprs) +} + func colNamesAlign(expected, actual sqlparser.SelectExprs) bool { if len(expected) > len(actual) { // if we expect more columns than we have, we can't align diff --git a/go/vt/vtgate/planbuilder/plan_test.go b/go/vt/vtgate/planbuilder/plan_test.go index 89f0b5ed01b..7135f4dff29 100644 --- a/go/vt/vtgate/planbuilder/plan_test.go +++ b/go/vt/vtgate/planbuilder/plan_test.go @@ -664,8 +664,9 @@ func (s *planTestSuite) testFile(filename string, vschema *vschemawrapper.VSchem continue } current := PlanTest{ - Comment: testName, + Comment: tcase.Comment, Query: tcase.Query, + SkipE2E: tcase.SkipE2E, } vschema.Version = Gen4 out := getPlanOutput(tcase, vschema, render) diff --git a/go/vt/vtgate/planbuilder/testdata/select_cases.json b/go/vt/vtgate/planbuilder/testdata/select_cases.json index b1134becef6..2d2cdd9381f 100644 --- a/go/vt/vtgate/planbuilder/testdata/select_cases.json +++ b/go/vt/vtgate/planbuilder/testdata/select_cases.json @@ -68,7 +68,6 @@ { "comment": "join on sharding column with limit - should be a simple scatter query and limit on top with non resolved columns", "query": "select * from user u join user_metadata um on u.id = um.user_id where foo=41 limit 20", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user u join user_metadata um on u.id = um.user_id where foo=41 limit 20", @@ -93,7 +92,8 @@ "user.user", "user.user_metadata" ] - } + }, + "skip_e2e": true }, { "comment": "select with timeout directive sets QueryTimeout in the route", @@ -180,7 +180,6 @@ { "comment": "select limit with timeout directive sets QueryTimeout in the route", "query": "select /*vt+ QUERY_TIMEOUT_MS=1000 */ * from main.unsharded limit 10", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select /*vt+ QUERY_TIMEOUT_MS=1000 */ * from main.unsharded limit 10", @@ -199,7 +198,8 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "select with partial scatter directive", @@ -404,8 +404,8 @@ { "comment": "test table lookup failure for authoritative code path", "query": "select a.* from authoritative", - "skip_e2e": true, - "plan": "Unknown table 'a'" + "plan": "Unknown table 'a'", + "skip_e2e": true }, { "comment": "select * from qualified authoritative table", @@ -455,7 +455,6 @@ { "comment": "select authoritative.* with intermixing still expands", "query": "select user.id, a.*, user.col1 from authoritative a join user on a.user_id=user.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id, a.*, user.col1 from authoritative a join user on a.user_id=user.id", @@ -474,12 +473,12 @@ "user.authoritative", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "auto-resolve anonymous columns for simple route", "query": "select anon_col from user join user_extra on user.id = user_extra.user_id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select anon_col from user join user_extra on user.id = user_extra.user_id", @@ -498,12 +497,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "json_arrayagg in single sharded query", "query": "select count(1) from user where id = 'abc' group by n_id having json_arrayagg(a_id) = '[]'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select count(1) from user where id = 'abc' group by n_id having json_arrayagg(a_id) = '[]'", @@ -525,12 +524,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "json_objectagg in single sharded query", "query": "select count(1) from user where id = 'abc' group by n_id having json_objectagg(a_id, b_id) = '[]'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select count(1) from user where id = 'abc' group by n_id having json_objectagg(a_id, b_id) = '[]'", @@ -552,24 +551,24 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "unsupported json aggregation expressions in scatter query", "query": "select count(1) from user where cola = 'abc' group by n_id having json_arrayagg(a_id) = '[]'", - "skip_e2e": true, - "plan": "VT12001: unsupported: in scatter query: aggregation function 'json_arrayagg(a_id)'" + "plan": "VT12001: unsupported: in scatter query: aggregation function 'json_arrayagg(a_id)'", + "skip_e2e": true }, { "comment": "Cannot auto-resolve for cross-shard joins", "query": "select col from user join user_extra", - "skip_e2e": true, - "plan": "Column 'col' in field list is ambiguous" + "plan": "Column 'col' in field list is ambiguous", + "skip_e2e": true }, { "comment": "Auto-resolve should work if unique vindex columns are referenced", "query": "select id, user_id from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select id, user_id from user join user_extra", @@ -607,12 +606,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "database calls should be substituted", "query": "select database() from dual", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select database() from dual", @@ -630,12 +629,12 @@ "TablesUsed": [ "main.dual" ] - } + }, + "skip_e2e": true }, { "comment": "last_insert_id for unsharded route", "query": "select last_insert_id() as x from main.unsharded", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select last_insert_id() as x from main.unsharded", @@ -653,7 +652,8 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "select from dual on unqualified keyspace", @@ -706,13 +706,12 @@ { "comment": "prefixing dual with a keyspace should not work", "query": "select 1 from user.dual", - "skip_e2e": true, - "plan": "table dual not found" + "plan": "table dual not found", + "skip_e2e": true }, { "comment": "RHS route referenced", "query": "select user_extra.id from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user_extra.id from user join user_extra", @@ -750,12 +749,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Both routes referenced", "query": "select user.col, user_extra.id from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.col, user_extra.id from user join user_extra", @@ -793,12 +792,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Expression with single-route reference", "query": "select user.col, user_extra.id + user_extra.col from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.col, user_extra.id + user_extra.col from user join user_extra", @@ -836,12 +835,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "subquery with an aggregation in order by that can be merged into a single route", "query": "select col, trim((select user_name from user where id = 3)) val from user_extra where user_id = 3 group by col order by val", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select col, trim((select user_name from user where id = 3)) val from user_extra where user_id = 3 group by col order by val", @@ -864,12 +863,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Jumbled references", "query": "select user.col, user_extra.id, user.col2 from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.col, user_extra.id, user.col2 from user join user_extra", @@ -907,12 +906,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Comments", "query": "select /* comment */ user.col from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select /* comment */ user.col from user join user_extra", @@ -950,12 +949,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "for update", "query": "select user.col from user join user_extra for update", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.col from user join user_extra for update", @@ -993,12 +992,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Field query should work for joins select bind vars", "query": "select user.id, (select user.id+outm.m+unsharded.m from unsharded) from user join unsharded outm", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id, (select user.id+outm.m+unsharded.m from unsharded) from user join unsharded outm", @@ -1039,12 +1038,12 @@ "main.unsharded", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Case preservation", "query": "select user.Col, user_extra.Id from user join user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.Col, user_extra.Id from user join user_extra", @@ -1082,13 +1081,14 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "syntax error", "query": "the quick brown fox", - "skip_e2e": true, - "plan": "syntax error at position 4 near 'the'" + "plan": "syntax error at position 4 near 'the'", + "skip_e2e": true }, { "comment": "Hex number is not treated as a simple value", @@ -1119,7 +1119,6 @@ { "comment": "Selection but explicitly ignore a vindex", "query": "select * from user ignore vindex (user_index) where id = 1", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user ignore vindex (user_index) where id = 1", @@ -1137,12 +1136,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Selection but make the planner explicitly use a vindex", "query": "select intcol, id from user use vindex (name_user_map) where costly = 'aa' and name = 'bb' and id = 3", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select intcol, id from user use vindex (name_user_map) where costly = 'aa' and name = 'bb' and id = 3", @@ -1189,13 +1188,14 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Vindex hint on a non-existing vindex", "query": "select * from user use vindex (does_not_exist) where id = 1", - "skip_e2e": true, - "plan": "VT09021: Vindex 'does_not_exist' does not exist in table 'user.user'" + "plan": "VT09021: Vindex 'does_not_exist' does not exist in table 'user.user'", + "skip_e2e": true }, { "comment": "sharded limit offset", @@ -1231,7 +1231,6 @@ { "comment": "sharded limit offset with arguments", "query": "select user_id from music order by user_id limit :limit, :offset", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user_id from music order by user_id limit :limit, :offset", @@ -1258,12 +1257,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Sharding Key Condition in Parenthesis", "query": "select * from user where name ='abc' AND (id = 4) limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where name ='abc' AND (id = 4) limit 5", @@ -1285,12 +1284,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Multiple parenthesized expressions", "query": "select * from user where (id = 4) AND (name ='abc') limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where (id = 4) AND (name ='abc') limit 5", @@ -1312,12 +1311,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Multiple parenthesized expressions", "query": "select * from user where (id = 4 and name ='abc') limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where (id = 4 and name ='abc') limit 5", @@ -1339,7 +1338,8 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Column Aliasing with Table.Column", @@ -1396,7 +1396,6 @@ { "comment": "Booleans and parenthesis", "query": "select * from user where (id = 1) AND name = true limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where (id = 1) AND name = true limit 5", @@ -1418,12 +1417,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Column as boolean-ish", "query": "select * from user where (id = 1) AND name limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where (id = 1) AND name limit 5", @@ -1445,12 +1444,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "PK as fake boolean, and column as boolean-ish", "query": "select * from user where (id = 5) AND name = true limit 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from user where (id = 5) AND name = true limit 5", @@ -1472,12 +1471,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "top level subquery in select", "query": "select a, (select col from user) from unsharded", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select a, (select col from user) from unsharded", @@ -1518,12 +1517,12 @@ "main.unsharded", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "sub-expression subquery in select", "query": "select a, 1+(select col from user) from unsharded", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select a, 1+(select col from user) from unsharded", @@ -1564,12 +1563,12 @@ "main.unsharded", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "select * from derived table expands specific columns", "query": "select * from (select user.id id1, user_extra.id id2 from user join user_extra) as t", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from (select user.id id1, user_extra.id id2 from user join user_extra) as t", @@ -1607,24 +1606,24 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "duplicate columns not allowed in derived table", "query": "select * from (select user.id, user_extra.id from user join user_extra) as t", - "skip_e2e": true, - "plan": "Duplicate column name 'id'" + "plan": "Duplicate column name 'id'", + "skip_e2e": true }, { "comment": "non-existent symbol in cross-shard derived table", "query": "select t.col from (select user.id from user join user_extra) as t", - "skip_e2e": true, - "plan": "column 't.col' not found" + "plan": "column 't.col' not found", + "skip_e2e": true }, { "comment": "union with the same target shard", "query": "select * from music where user_id = 1 union select * from user where id = 1", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from music where user_id = 1 union select * from user where id = 1", @@ -1647,12 +1646,12 @@ "user.music", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "union with the same target shard last_insert_id", "query": "select *, last_insert_id() from music where user_id = 1 union select * from user where id = 1", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select *, last_insert_id() from music where user_id = 1 union select * from user where id = 1", @@ -1675,7 +1674,8 @@ "user.music", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "unsharded union in derived table", @@ -1815,7 +1815,6 @@ { "comment": "routing rules: ensure directives are not lost", "query": "select /*vt+ QUERY_TIMEOUT_MS=1000 */ * from route2", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select /*vt+ QUERY_TIMEOUT_MS=1000 */ * from route2", @@ -1834,12 +1833,12 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "routing table on music", "query": "select * from second_user.bar where id > 2", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from second_user.bar where id > 2", @@ -1857,7 +1856,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "testing SingleRow Projection", @@ -1892,14 +1892,15 @@ "ColumnNames": [ "0:avg_col" ], - "Columns": "0", + "Columns": "3", "Inputs": [ { "OperatorType": "Projection", "Expressions": [ "sum(intcol) / count(intcol) as avg_col", ":1 as textcol1", - ":2 as textcol2" + ":2 as textcol2", + "sum(intcol) as avg_col" ], "Inputs": [ { @@ -1956,7 +1957,6 @@ { "comment": "Complex expression in a subquery used in IN clause of an aggregate query", "query": "select count(*) from user where user.id = 2 or user.id in (select id from unsharded_a where colb = 2)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select count(*) from user where user.id = 2 or user.id in (select id from unsharded_a where colb = 2)", @@ -2005,12 +2005,12 @@ "main.unsharded_a", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Complex expression in a subquery used in NOT IN clause of an aggregate query", "query": "select count(*) from user where user.id = 2 or user.id not in (select id from unsharded_a where colb = 2)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select count(*) from user where user.id = 2 or user.id not in (select id from unsharded_a where colb = 2)", @@ -2059,7 +2059,8 @@ "main.unsharded_a", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "testing SingleRow Projection with arithmetics", @@ -2177,8 +2178,8 @@ "Name": "main", "Sharded": false }, - "FieldQuery": "select last_insert_id(12) from dual where 1 != 1", - "Query": "select last_insert_id(12) from dual", + "FieldQuery": "select 12 from dual where 1 != 1", + "Query": "select 12 from dual", "Table": "dual" } ] @@ -2205,8 +2206,8 @@ "Name": "user", "Sharded": true }, - "FieldQuery": "select bar, 12, last_insert_id(foo) from `user` where 1 != 1", - "Query": "select bar, 12, last_insert_id(foo) from `user`", + "FieldQuery": "select bar, 12, foo from `user` where 1 != 1", + "Query": "select bar, 12, foo from `user`", "Table": "`user`" } ] @@ -2346,19 +2347,18 @@ { "comment": "sql_calc_found_rows in sub queries", "query": "select * from music where user_id IN (select sql_calc_found_rows * from music limit 10)", - "skip_e2e": true, - "plan": "Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'" + "plan": "Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'", + "skip_e2e": true }, { "comment": "sql_calc_found_rows in derived table", "query": "select sql_calc_found_rows * from (select sql_calc_found_rows * from music limit 10) t limit 1", - "skip_e2e": true, - "plan": "Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'" + "plan": "Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'", + "skip_e2e": true }, { "comment": "select from unsharded keyspace into dumpfile", "query": "select * from main.unsharded into Dumpfile 'x.txt'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from main.unsharded into Dumpfile 'x.txt'", @@ -2376,12 +2376,12 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "select from unsharded keyspace into outfile", "query": "select * from main.unsharded into outfile 'x.txt' character set binary fields terminated by 'term' optionally enclosed by 'c' escaped by 'e' lines starting by 'a' terminated by '\n'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from main.unsharded into outfile 'x.txt' character set binary fields terminated by 'term' optionally enclosed by 'c' escaped by 'e' lines starting by 'a' terminated by '\n'", @@ -2399,12 +2399,12 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "select from unsharded keyspace into outfile s3", "query": "select * from main.unsharded into outfile s3 'out_file_name' character set binary format csv header fields terminated by 'term' optionally enclosed by 'c' escaped by 'e' lines starting by 'a' terminated by '\n' manifest on overwrite off", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from main.unsharded into outfile s3 'out_file_name' character set binary format csv header fields terminated by 'term' optionally enclosed by 'c' escaped by 'e' lines starting by 'a' terminated by '\n' manifest on overwrite off", @@ -2422,7 +2422,8 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "left join with a dual table on left - merge-able", @@ -2633,20 +2634,20 @@ { "comment": "Union after into outfile is incorrect", "query": "select id from user into outfile 'out_file_name' union all select id from music", - "skip_e2e": true, - "plan": "syntax error at position 55 near 'union'" + "plan": "syntax error at position 55 near 'union'", + "skip_e2e": true }, { "comment": "Into outfile s3 in derived table is incorrect", "query": "select id from (select id from user into outfile s3 'inner_outfile') as t2", - "skip_e2e": true, - "plan": "syntax error at position 41 near 'into'" + "plan": "syntax error at position 41 near 'into'", + "skip_e2e": true }, { "comment": "Into outfile s3 in derived table with union incorrect", "query": "select id from (select id from user into outfile s3 'inner_outfile' union select 1) as t2", - "skip_e2e": true, - "plan": "syntax error at position 41 near 'into'" + "plan": "syntax error at position 41 near 'into'", + "skip_e2e": true }, { "comment": "select (select u.id from user as u where u.id = 1), a.id from user as a where a.id = 1", @@ -2677,7 +2678,6 @@ { "comment": "Add two tables with the same column in a join", "query": "select t.id, s.id from user t join user_extra s on t.id = s.user_id join unsharded", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select t.id, s.id from user t join user_extra s on t.id = s.user_id join unsharded", @@ -2716,7 +2716,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "((((select 1))))", @@ -2743,7 +2744,6 @@ { "comment": "Merging dual with user", "query": "select 42, id from dual, user", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 42, id from dual, user", @@ -2762,12 +2762,12 @@ "main.dual", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "subquery in select expression of derived table", "query": "select t.a from (select (select col from user limit 1) as a from user join user_extra) t", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select t.a from (select (select col from user limit 1) as a from user join user_extra) t", @@ -2833,12 +2833,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "ORDER BY subquery", "query": "select (select col from user limit 1) as a from user join user_extra order by a", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select (select col from user limit 1) as a from user join user_extra order by a", @@ -2904,7 +2904,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "plan test for a natural character set string", @@ -2931,7 +2932,6 @@ { "comment": "select expression having dependencies on both sides of a join", "query": "select user.id * user_id as amount from user, user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id * user_id as amount from user, user_extra", @@ -2972,12 +2972,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Straight Join ensures specific ordering of joins", "query": "select user.id, user_extra.user_id from user straight_join user_extra where user.id = user_extra.foo", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id, user_extra.user_id from user straight_join user_extra where user.id = user_extra.foo", @@ -3018,7 +3018,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Dual query should be handled on the vtgate even with a LIMIT", @@ -3045,7 +3046,6 @@ { "comment": "PullOut subquery with an aggregation that should be typed in the final output", "query": "select (select sum(col) from user) from user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select (select sum(col) from user) from user_extra", @@ -3093,12 +3093,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Straight Join preserved in MySQL query", "query": "select user.id, user_extra.user_id from user straight_join user_extra where user.id = user_extra.user_id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id, user_extra.user_id from user straight_join user_extra where user.id = user_extra.user_id", @@ -3117,12 +3117,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "correlated subquery in exists clause", "query": "select col from user where exists(select user_id from user_extra where user_id = 3 and user_id < user.id)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select col from user where exists(select user_id from user_extra where user_id = 3 and user_id < user.id)", @@ -3176,12 +3176,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "correlated subquery in exists clause with an order by", "query": "select col from user where exists(select user_id from user_extra where user_id = 3 and user_id < user.id) order by col", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select col from user where exists(select user_id from user_extra where user_id = 3 and user_id < user.id) order by col", @@ -3236,12 +3236,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "correlated subquery having dependencies on two tables", "query": "select 1 from user u1, user u2 where exists (select 1 from user_extra ue where ue.col = u1.col and ue.col = u2.col)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from user u1, user u2 where exists (select 1 from user_extra ue where ue.col = u1.col and ue.col = u2.col)", @@ -3310,12 +3310,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "correlated subquery using a column twice", "query": "select 1 from user u where exists (select 1 from user_extra ue where ue.col = u.col and u.col = ue.col2)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from user u where exists (select 1 from user_extra ue where ue.col = u.col and u.col = ue.col2)", @@ -3368,7 +3368,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "correlated subquery that is dependent on one side of a join, fully mergeable", @@ -3400,7 +3401,6 @@ { "comment": "Complex join with multiple conditions merged into single route", "query": "select 0 from user as u join user_extra as s on u.id = s.user_id join music as m on m.user_id = u.id and (s.foo or m.bar)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 0 from user as u join user_extra as s on u.id = s.user_id join music as m on m.user_id = u.id and (s.foo or m.bar)", @@ -3420,7 +3420,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "union as a derived table", @@ -3464,7 +3465,6 @@ { "comment": "use output column containing data from both sides of the join", "query": "select user_extra.col + user.col from user join user_extra on user.id = user_extra.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user_extra.col + user.col from user join user_extra on user.id = user_extra.id", @@ -3510,12 +3510,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "mergeable derived table with order by and limit", "query": "select 1 from (select col from main.unsharded order by main.unsharded.col1 desc limit 12 offset 0) as f left join unsharded as u on f.col = u.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from (select col from main.unsharded order by main.unsharded.col1 desc limit 12 offset 0) as f left join unsharded as u on f.col = u.id", @@ -3533,12 +3533,12 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "mergeable derived table with group by and limit", "query": "select 1 from (select col, count(*) as a from main.unsharded group by col having a > 0 limit 12 offset 0) as f left join unsharded as u on f.col = u.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from (select col, count(*) as a from main.unsharded group by col having a > 0 limit 12 offset 0) as f left join unsharded as u on f.col = u.id", @@ -3556,12 +3556,12 @@ "TablesUsed": [ "main.unsharded" ] - } + }, + "skip_e2e": true }, { "comment": "select user.id, trim(leading 'x' from user.name) from user", "query": "select user.id, trim(leading 'x' from user.name) from user", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.id, trim(leading 'x' from user.name) from user", @@ -3579,12 +3579,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "json utility functions", "query": "select jcol, JSON_STORAGE_SIZE(jcol), JSON_STORAGE_FREE(jcol), JSON_PRETTY(jcol) from user", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select jcol, JSON_STORAGE_SIZE(jcol), JSON_STORAGE_FREE(jcol), JSON_PRETTY(jcol) from user", @@ -3602,7 +3602,8 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "dual query with exists clause", @@ -3653,7 +3654,6 @@ { "comment": "select (select id from user order by id limit 1) from user_extra", "query": "select (select id from user order by id limit 1) from user_extra", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select (select id from user order by id limit 1) from user_extra", @@ -3701,7 +3701,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "yeah, it does not make sense, but it's valid", @@ -3777,7 +3778,6 @@ { "comment": "Json extract and json unquote shorthands", "query": "SELECT a->\"$[4]\", a->>\"$[3]\" FROM user", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT a->\"$[4]\", a->>\"$[3]\" FROM user", @@ -3795,12 +3795,12 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "groupe by with non aggregated columns and table alias", "query": "select u.id, u.age from user u group by u.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select u.id, u.age from user u group by u.id", @@ -3818,7 +3818,8 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Functions that return JSON value attributes", @@ -4006,7 +4007,6 @@ { "comment": "insert function using column names as arguments", "query": "select insert(tcol1, id, 3, tcol2) from user", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select insert(tcol1, id, 3, tcol2) from user", @@ -4024,7 +4024,8 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "gtid functions", @@ -4051,7 +4052,6 @@ { "comment": "Predicate in apply join which is merged", "query": "select user.col, user_metadata.user_id from user join user_extra on user.col = user_extra.col join user_metadata on user_extra.user_id = user_metadata.user_id where user.textcol1 = 'alice@gmail.com'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.col, user_metadata.user_id from user join user_extra on user.col = user_extra.col join user_metadata on user_extra.user_id = user_metadata.user_id where user.textcol1 = 'alice@gmail.com'", @@ -4093,12 +4093,12 @@ "user.user_extra", "user.user_metadata" ] - } + }, + "skip_e2e": true }, { "comment": "Join across multiple tables, with conditions on different vindexes, but mergeable through join predicates", "query": "SELECT user.id FROM user INNER JOIN music_extra ON user.id = music_extra.user_id INNER JOIN music ON music_extra.user_id = music.user_id WHERE user.id = 123 and music.id = 456", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT user.id FROM user INNER JOIN music_extra ON user.id = music_extra.user_id INNER JOIN music ON music_extra.user_id = music.user_id WHERE user.id = 123 and music.id = 456", @@ -4122,12 +4122,12 @@ "user.music_extra", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "SQL_CALC_FOUND_ROWS with vindex lookup", "query": "select SQL_CALC_FOUND_ROWS id, name from user where name = 'aa' order by id limit 2", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select SQL_CALC_FOUND_ROWS id, name from user where name = 'aa' order by id limit 2", @@ -4234,7 +4234,8 @@ "TablesUsed": [ "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "`None` route being merged with another route via join predicate on Vindex columns", @@ -4262,7 +4263,6 @@ { "comment": "Treating single value tuples as `EqualUnique` routes", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.user_id IN (5)) AND music.user_id = 5", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.user_id IN (5)) AND music.user_id = 5", @@ -4284,7 +4284,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Subquery with `IN` condition using columns with matching lookup vindexes", @@ -4341,7 +4342,6 @@ { "comment": "Subquery with `IN` condition using columns with matching lookup vindexes, with inner scatter query", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.foo = 'bar') AND music.user_id IN (3, 4, 5)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.foo = 'bar') AND music.user_id IN (3, 4, 5)", @@ -4363,7 +4363,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Subquery with `IN` condition using columns with matching lookup vindexes", @@ -4460,7 +4461,6 @@ { "comment": "Mergeable scatter subquery", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop')", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop')", @@ -4478,12 +4478,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Mergeable scatter subquery with `GROUP BY` on unique vindex column", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' GROUP BY music.id)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' GROUP BY music.id)", @@ -4501,12 +4501,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Unmergeable scatter subquery with `GROUP BY` on-non vindex column", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' GROUP BY music.genre)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' GROUP BY music.genre)", @@ -4585,12 +4585,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Unmergeable scatter subquery with LIMIT", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' LIMIT 10)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT music.id FROM music WHERE music.genre = 'pop' LIMIT 10)", @@ -4666,12 +4666,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Mergeable subquery with `MAX` aggregate and grouped by unique vindex", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT MAX(music.id) FROM music WHERE music.user_id IN (5, 6) GROUP BY music.user_id)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT MAX(music.id) FROM music WHERE music.user_id IN (5, 6) GROUP BY music.user_id)", @@ -4745,7 +4745,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Unmergeable subquery with `MAX` aggregate", @@ -4913,7 +4914,6 @@ { "comment": "Mergeable subquery with `LIMIT` due to `EqualUnique` route", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT MAX(music.id) FROM music WHERE music.user_id = 5 LIMIT 10)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT MAX(music.id) FROM music WHERE music.user_id = 5 LIMIT 10)", @@ -4987,7 +4987,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Mergeable subquery with multiple levels of derived statements", @@ -5044,7 +5045,6 @@ { "comment": "Unmergeable subquery with multiple levels of derived statements, using a multi value `IN` predicate", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT * FROM (SELECT * FROM (SELECT music.id FROM music WHERE music.user_id IN (5, 6) LIMIT 10) subquery_for_limit) subquery_for_limit)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT * FROM (SELECT * FROM (SELECT music.id FROM music WHERE music.user_id IN (5, 6) LIMIT 10) subquery_for_limit) subquery_for_limit)", @@ -5124,12 +5124,12 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "Unmergeable subquery with multiple levels of derived statements", "query": "SELECT music.id FROM music WHERE music.id IN (SELECT * FROM (SELECT * FROM (SELECT music.id FROM music LIMIT 10) subquery_for_limit) subquery_for_limit)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT music.id FROM music WHERE music.id IN (SELECT * FROM (SELECT * FROM (SELECT music.id FROM music LIMIT 10) subquery_for_limit) subquery_for_limit)", @@ -5205,7 +5205,8 @@ "TablesUsed": [ "user.music" ] - } + }, + "skip_e2e": true }, { "comment": "`None` subquery as top level predicate - outer query changes from `Scatter` to `None` on merge", @@ -5354,7 +5355,6 @@ { "comment": "limit on the vtgate has to be executed on the LHS of a join", "query": "select id from user join (select user_id from user_extra limit 10) ue on user.id = ue.user_id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select id from user join (select user_id from user_extra limit 10) ue on user.id = ue.user_id", @@ -5405,12 +5405,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "select user.a, t.b from user join (select id, count(*) b, req from user_extra group by req, id) as t on user.id = t.id", "query": "select user.a, t.b from user join (select id, count(*) b, req from user_extra group by req, id) as t on user.id = t.id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select user.a, t.b from user join (select id, count(*) b, req from user_extra group by req, id) as t on user.id = t.id", @@ -5470,7 +5470,8 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "SELECT music.id FROM (SELECT MAX(id) as maxt FROM music WHERE music.user_id = 5) other JOIN music ON other.maxt = music.id", @@ -5575,7 +5576,6 @@ { "comment": "query with a derived table and dual table in unsharded keyspace", "query": "SELECT * FROM unsharded_a AS t1 JOIN (SELECT trim((SELECT MAX(name) FROM unsharded_a)) AS name) AS t2 WHERE t1.name >= t2.name ORDER BY t1.name ASC LIMIT 1;", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT * FROM unsharded_a AS t1 JOIN (SELECT trim((SELECT MAX(name) FROM unsharded_a)) AS name) AS t2 WHERE t1.name >= t2.name ORDER BY t1.name ASC LIMIT 1;", @@ -5594,7 +5594,8 @@ "main.dual", "main.unsharded_a" ] - } + }, + "skip_e2e": true }, { "comment": "subquery having join table on clause, using column reference of outer select table", @@ -5625,7 +5626,6 @@ { "comment": "SOME modifier on unsharded table works well", "query": "select 1 from unsharded where foo = SOME (select 1 from unsharded_a where foo = 1)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from unsharded where foo = SOME (select 1 from unsharded_a where foo = 1)", @@ -5644,12 +5644,12 @@ "main.unsharded", "main.unsharded_a" ] - } + }, + "skip_e2e": true }, { "comment": "ALL modifier on unsharded table works well", "query": "select 1 from unsharded where foo = ALL (select 1 from unsharded_a where foo = 1)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from unsharded where foo = ALL (select 1 from unsharded_a where foo = 1)", @@ -5668,7 +5668,8 @@ "main.unsharded", "main.unsharded_a" ] - } + }, + "skip_e2e": true }, { "comment": "allow last_insert_id with argument", @@ -5687,8 +5688,8 @@ "Name": "user", "Sharded": true }, - "FieldQuery": "select last_insert_id(id) from `user` where 1 != 1", - "Query": "select last_insert_id(id) from `user`", + "FieldQuery": "select id from `user` where 1 != 1", + "Query": "select id from `user`", "Table": "`user`" } ] @@ -5701,7 +5702,6 @@ { "comment": "merge subquery using MAX and join into single route", "query": "select 1 from user join music_extra on user.id = music_extra.user_id where music_extra.music_id = (select max(music_id) from music_extra where user_id = user.id)", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select 1 from user join music_extra on user.id = music_extra.user_id where music_extra.music_id = (select max(music_id) from music_extra where user_id = user.id)", @@ -5720,12 +5720,12 @@ "user.music_extra", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "Query with non-plannable lookup vindex", "query": "SELECT * FROM user_metadata WHERE user_metadata.non_planable = 'foo'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT * FROM user_metadata WHERE user_metadata.non_planable = 'foo'", @@ -5747,12 +5747,12 @@ "TablesUsed": [ "user.user_metadata" ] - } + }, + "skip_e2e": true }, { "comment": "join query with lookup and join on different vindex column", "query": "select u.id from user u, user_metadata um where u.name = 'foo' and u.id = um.user_id", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select u.id from user u, user_metadata um where u.name = 'foo' and u.id = um.user_id", @@ -5800,7 +5800,8 @@ "user.user", "user.user_metadata" ] - } + }, + "skip_e2e": true }, { "comment": "pick email as vindex lookup", @@ -5878,7 +5879,6 @@ { "comment": "name is in backfill vindex - not selected for vindex lookup", "query": "select * from customer where name = 'x'", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from customer where name = 'x'", @@ -5896,7 +5896,8 @@ "TablesUsed": [ "user.customer" ] - } + }, + "skip_e2e": true }, { "comment": "email vindex is costly than phone vindex - but phone vindex is backfiling hence ignored", @@ -6003,7 +6004,6 @@ { "comment": "invisible column is not expanded, but valid in predicate", "query": "select * from samecolvin where secret = 12", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select * from samecolvin where secret = 12", @@ -6021,12 +6021,12 @@ "TablesUsed": [ "user.samecolvin" ] - } + }, + "skip_e2e": true }, { "comment": "column with qualifier is correctly used", "query": "select u.foo, ue.foo as apa from user u, user_extra ue order by foo ", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select u.foo, ue.foo as apa from user u, user_extra ue order by foo ", @@ -6065,12 +6065,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Derived tables going to a single shard still need to expand derived table columns", "query": "SELECT c.column_name FROM user c JOIN (SELECT table_name FROM unsharded LIMIT 1) AS tables ON tables.table_name = c.table_name", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT c.column_name FROM user c JOIN (SELECT table_name FROM unsharded LIMIT 1) AS tables ON tables.table_name = c.table_name", @@ -6111,12 +6111,12 @@ "main.unsharded", "user.user" ] - } + }, + "skip_e2e": true }, { "comment": "column name aliases in outer join queries", "query": "select name as t0, name as t1 from user left outer join user_extra on user.cola = user_extra.cola", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "select name as t0, name as t1 from user left outer join user_extra on user.cola = user_extra.cola", @@ -6167,12 +6167,12 @@ "user.user", "user.user_extra" ] - } + }, + "skip_e2e": true }, { "comment": "Over clause works for unsharded tables", "query": "SELECT val, CUME_DIST() OVER w, ROW_NUMBER() OVER w, DENSE_RANK() OVER w, PERCENT_RANK() OVER w, RANK() OVER w AS 'cd' FROM unsharded_a", - "skip_e2e": true, "plan": { "QueryType": "SELECT", "Original": "SELECT val, CUME_DIST() OVER w, ROW_NUMBER() OVER w, DENSE_RANK() OVER w, PERCENT_RANK() OVER w, RANK() OVER w AS 'cd' FROM unsharded_a", @@ -6190,7 +6190,8 @@ "TablesUsed": [ "main.unsharded_a" ] - } + }, + "skip_e2e": true }, { "comment": "join with derived table with alias and join condition - merge into route",