Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion enginetest/enginetests.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,9 @@ func TestQueryPlans(t *testing.T, harness Harness, planTests []queries.QueryPlan
TestQueryPlanWithName(t, options.String(), harness, e, query, expectedPlan, options)
}
for _, tt := range planTests {
if tt.Skip {
t.Skip()
}
t.Run(tt.Query, func(t *testing.T) {
runTestWithDescribeOptions(t, tt.Query, tt.ExpectedPlan, sql.DescribeOptions{
Debug: true,
Expand All @@ -442,7 +445,6 @@ func TestQueryPlans(t *testing.T, harness Harness, planTests []queries.QueryPlan
})
}
})

}
}

Expand Down
2 changes: 0 additions & 2 deletions enginetest/join_op_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,6 @@ SELECT SUM(x) FROM xy WHERE x IN (
Expected: []sql.Row{
{"testing", 3},
},
Skip: true,
},
{
Query: `SELECT
Expand All @@ -555,7 +554,6 @@ SELECT SUM(x) FROM xy WHERE x IN (
Expected: []sql.Row{
{"testing", 4},
},
Skip: true,
},
{
Query: "SELECT substring(mytable.s, 1, 5) AS s FROM mytable INNER JOIN othertable ON (substring(mytable.s, 1, 5) = SUBSTRING(othertable.s2, 1, 5)) GROUP BY 1",
Expand Down
16 changes: 1 addition & 15 deletions enginetest/memory_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ func TestJSONTableScripts(t *testing.T) {

// TestBrokenJSONTableScripts runs the canonical test queries against a single threaded index enabled harness.
func TestBrokenJSONTableScripts(t *testing.T) {
t.Skip("incorrect errors and unsupported json_table functionality")
enginetest.TestBrokenJSONTableScripts(t, enginetest.NewDefaultMemoryHarness())
enginetest.TestBrokenJSONTableScripts(t, enginetest.NewSkippingMemoryHarness())
}

// Convenience test for debugging a single query. Unskip and set to the desired query.
Expand Down Expand Up @@ -346,8 +345,6 @@ func TestQueryPlans(t *testing.T) {
for _, indexInit := range indexBehaviors {
t.Run(indexInit.name, func(t *testing.T) {
harness := enginetest.NewMemoryHarness(indexInit.name, 1, 2, indexInit.nativeIndexes, indexInit.driverInitializer)
// The IN expression requires mergeable indexes meaning that an unmergeable index returns a different result, so we skip this test
harness.QueriesToSkip("SELECT a.* FROM mytable a inner join mytable b on (a.i = b.s) WHERE a.i in (1, 2, 3, 4)")
enginetest.TestQueryPlans(t, harness, queries.PlanTests)
})
}
Expand Down Expand Up @@ -464,11 +461,6 @@ func TestColumnAliases(t *testing.T) {

func TestDerivedTableOuterScopeVisibility(t *testing.T) {
harness := enginetest.NewDefaultMemoryHarness()
harness.QueriesToSkip(
"SELECT max(val), (select max(dt.a) from (SELECT val as a) as dt(a)) as a1 from numbers group by a1;", // memoization to fix
"select 'foo' as foo, (select dt.b from (select 1 as a, foo as b) dt);", // need to error
"SELECT n1.val as a1 from numbers n1, (select n1.val, n2.val * -1 from numbers n2 where n1.val = n2.val) as dt;", // different OK error
)
enginetest.TestDerivedTableOuterScopeVisibility(t, harness)
}

Expand All @@ -483,11 +475,6 @@ func TestAmbiguousColumnResolution(t *testing.T) {

func TestInsertInto(t *testing.T) {
harness := enginetest.NewDefaultMemoryHarness()
harness.QueriesToSkip(
// should be column not found error
"insert into a (select * from b) on duplicate key update b.i = a.i",
"insert into a (select * from b as t) on duplicate key update a.i = b.j + 100",
)
enginetest.TestInsertInto(t, harness)
}

Expand Down Expand Up @@ -820,7 +807,6 @@ func TestDateParse(t *testing.T) {
}

func TestJsonScripts(t *testing.T) {
// TODO different error messages
enginetest.TestJsonScripts(t, enginetest.NewDefaultMemoryHarness())
}

Expand Down
13 changes: 5 additions & 8 deletions enginetest/queries/column_alias_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,13 @@ var ColumnAliasQueries = []ScriptTest{
{
// The second query in the union subquery returns "x" instead of mytable.i
// https://github.com/dolthub/dolt/issues/4256
Skip: true,
Query: `SELECT *, (select i union select i) as a from mytable;`,
Expected: []sql.Row{{1, "first row", 1}, {2, "second row", 2}, {3, "third row", 3}},
Query: `SELECT *, (select i union select i) as a from mytable;`,
Expected: []sql.Row{
{1, "first row", 1},
{2, "second row", 2},
{3, "third row", 3}},
},
{
// Fails with an unresolved *plan.Project node error
// The second Project in the union subquery doens't seem to get its alias reference resolved
Skip: true,
Query: `SELECT 1 as a, (select a union select a) as b;`,
Expected: []sql.Row{{1, 1}},
},
Expand All @@ -270,14 +269,12 @@ var ColumnAliasQueries = []ScriptTest{
{
// GMS returns "expression 'dt.two' doesn't appear in the group by expressions", but MySQL will execute
// this query.
Skip: true,
Query: "select 1 as a, one + 1 as mod1, dt.* from mytable as t1, (select 1, 2 from mytable) as dt (one, two) where dt.one > 0 group by one;",
// column names: a, mod1, one, two
Expected: []sql.Row{{1, 2, 1, 2}},
},
{
// GMS returns `ambiguous column or alias name "b"` on both cases of `group by b` and `group by 1` inside subquery, but MySQL executes.
Skip: true,
Query: "select 1 as b, (select b group by b order by b) order by 1;",
Expected: []sql.Row{{1, 1}},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ var DerivedTableOuterScopeVisibilityQueries = []ScriptTest{
{
// A subquery containing a derived table, used in the GROUP BY clause of a top-level query as a grouping
// expression, has visibility to tables and columns in the top-level query.
Skip: true, // memoization to fix
Query: "SELECT max(val), (select max(dt.a) from (SELECT val as a) as dt(a)) as a1 from numbers group by a1;",
Expected: []sql.Row{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}},
},
Expand All @@ -94,11 +95,13 @@ var DerivedTableOuterScopeVisibilityQueries = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
// expression aliases are NOT visible from outer scopes to derived tables
Skip: true, // need to error
Query: "select 'foo' as foo, (select dt.b from (select 1 as a, foo as b) dt);",
ExpectedErr: sql.ErrColumnNotFound,
},
{
// a derived table NOT inside a subquery expression does NOT have access to any lateral scope tables.
Skip: true, // different OK error
Query: "SELECT n1.val as a1 from numbers n1, (select n1.val, n2.val * -1 from numbers n2 where n1.val = n2.val) as dt;",
ExpectedErr: sql.ErrTableNotFound,
},
Expand All @@ -113,7 +116,6 @@ var DerivedTableOuterScopeVisibilityQueries = []ScriptTest{
// to the top level of the query, and not directly inside the subquery expression, which would explain
// why MySQL does NOT give this query visibility to the 'opk' table alias. We should match MySQL's
// behavior, but this is a small edge case we can follow up on.
Skip: true,

// CTEs and Recursive CTEs may receive outer scope visibility, but only when they are contained in a
// subquery expression. The CTE in this query should NOT have visibility to the 'opk' table alias.
Expand Down
2 changes: 1 addition & 1 deletion enginetest/queries/information_schema_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'mydb'`,
{
// TODO: cardinality not supported
Skip: true,
Query: `select index_name, seq_in_index, column_name, cardinality, sub_part from information_schema.statistics where table_schema = 'mydb' and table_name = 'ptable' ORDER BY INDEX_NAME`,
Query: `select cardinality from information_schema.statistics where table_schema = 'mydb' and table_name = 'ptable' ORDER BY INDEX_NAME`,
Expected: []sql.Row{{2}, {2}, {2}, {2}, {2}},
},
{
Expand Down
1 change: 0 additions & 1 deletion enginetest/queries/insert_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1680,7 +1680,6 @@ var InsertScripts = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: `insert into a with cte as (select * from b) select * from cte on duplicate key update a.i = cte.j + 100`,
Skip: true,
Expected: []sql.Row{
{types.OkResult{RowsAffected: 4}},
},
Expand Down
1 change: 0 additions & 1 deletion enginetest/queries/join_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,6 @@ inner join pq on true order by 1,2,3,4,5,6,7,8 limit 5;`,
},
},
{
//SkipPrepared: true,
Query: `SELECT pk as pk, nt.i as i, nt2.i as i FROM one_pk
RIGHT JOIN niltable nt ON pk=nt.i
RIGHT JOIN niltable nt2 ON pk=nt2.i - 1
Expand Down
14 changes: 6 additions & 8 deletions enginetest/queries/logic_test_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var SQLLogicJoinTests = []ScriptTest{
},
Assertions: []ScriptTestAssertion{
{
// This panics somewhere in the memo
// get field index error
Skip: true,
Query: "SELECT * FROM foo JOIN bar ON max(foo.c) < 2",
ExpectedErrStr: "invalid use of group function",
Expand Down Expand Up @@ -106,23 +106,22 @@ var SQLLogicJoinTests = []ScriptTest{
{
Name: "case insensitive join with using clause",
SetUpScript: []string{
"CREATE TABLE str1 (a INT PRIMARY KEY, s TEXT COLLATE utf8mb4_0900_ai_ci)",
"INSERT INTO str1 VALUES (1, 'a' COLLATE utf8mb4_0900_ai_ci), (2, 'A' COLLATE utf8mb4_0900_ai_ci), (3, 'c' COLLATE utf8mb4_0900_ai_ci), (4, 'D' COLLATE utf8mb4_0900_ai_ci)",
"CREATE TABLE str2 (a INT PRIMARY KEY, s TEXT COLLATE utf8mb4_0900_ai_ci)",
"INSERT INTO str2 VALUES (1, 'A' COLLATE utf8mb4_0900_ai_ci), (2, 'B' COLLATE utf8mb4_0900_ai_ci), (3, 'C' COLLATE utf8mb4_0900_ai_ci), (4, 'E' COLLATE utf8mb4_0900_ai_ci)",
"CREATE TABLE str1 (a INT PRIMARY KEY, s TEXT COLLATE utf8mb4_0900_ai_ci);",
"INSERT INTO str1 VALUES (1, 'a' COLLATE utf8mb4_0900_ai_ci), (2, 'A' COLLATE utf8mb4_0900_ai_ci), (3, 'c' COLLATE utf8mb4_0900_ai_ci), (4, 'D' COLLATE utf8mb4_0900_ai_ci);",
"CREATE TABLE str2 (a INT PRIMARY KEY, s TEXT COLLATE utf8mb4_0900_ai_ci);",
"INSERT INTO str2 VALUES (1, 'A' COLLATE utf8mb4_0900_ai_ci), (2, 'B' COLLATE utf8mb4_0900_ai_ci), (3, 'C' COLLATE utf8mb4_0900_ai_ci), (4, 'E' COLLATE utf8mb4_0900_ai_ci);",
},
Assertions: []ScriptTestAssertion{
{
Skip: true,
Query: "SELECT s, str1.s, str2.s FROM str1 INNER JOIN str2 USING(s)",
Query: "SELECT s, str1.s, str2.s FROM str1 INNER JOIN str2 USING(s);",
Expected: []sql.Row{
{"A", "A", "A"},
{"a", "a", "A"},
{"c", "c", "C"},
},
},
{
Skip: true,
Query: "SELECT s, str1.s, str2.s FROM str1 LEFT OUTER JOIN str2 USING(s)",
Expected: []sql.Row{
{"a", "a", "A"},
Expand All @@ -132,7 +131,6 @@ var SQLLogicJoinTests = []ScriptTest{
},
},
{
Skip: true,
Query: "SELECT s, str1.s, str2.s FROM str1 RIGHT OUTER JOIN str2 USING(s)",
Expected: []sql.Row{
{"A", "A", "A"},
Expand Down