Skip to content

Commit 7d2292c

Browse files
committed
Merge branch 'main' into zachmu/split-queries
2 parents cf1fd77 + 82ed525 commit 7d2292c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+4494
-1530
lines changed

enginetest/enginetests.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,7 +4144,7 @@ func TestVariables(t *testing.T, harness Harness) {
41444144
},
41454145
{
41464146
Query: "SET GLOBAL select_into_buffer_size = 9001",
4147-
Expected: []sql.Row{{}},
4147+
Expected: []sql.Row{{types.NewOkResult(0)}},
41484148
},
41494149
{
41504150
Query: "SELECT @@SESSION.select_into_buffer_size",
@@ -4156,7 +4156,7 @@ func TestVariables(t *testing.T, harness Harness) {
41564156
},
41574157
{
41584158
Query: "SET @@GLOBAL.select_into_buffer_size = 9002",
4159-
Expected: []sql.Row{{}},
4159+
Expected: []sql.Row{{types.NewOkResult(0)}},
41604160
},
41614161
{
41624162
Query: "SELECT @@GLOBAL.select_into_buffer_size",
@@ -4165,7 +4165,7 @@ func TestVariables(t *testing.T, harness Harness) {
41654165
{
41664166
// For boolean types, OFF/ON is converted
41674167
Query: "SET @@GLOBAL.activate_all_roles_on_login = 'ON'",
4168-
Expected: []sql.Row{{}},
4168+
Expected: []sql.Row{{types.NewOkResult(0)}},
41694169
},
41704170
{
41714171
Query: "SELECT @@GLOBAL.activate_all_roles_on_login",
@@ -4174,7 +4174,7 @@ func TestVariables(t *testing.T, harness Harness) {
41744174
{
41754175
// For non-boolean types, OFF/ON is not converted
41764176
Query: "SET @@GLOBAL.delay_key_write = 'OFF'",
4177-
Expected: []sql.Row{{}},
4177+
Expected: []sql.Row{{types.NewOkResult(0)}},
41784178
},
41794179
{
41804180
Query: "SELECT @@GLOBAL.delay_key_write",
@@ -4200,7 +4200,7 @@ func TestVariables(t *testing.T, harness Harness) {
42004200
},
42014201
{
42024202
Query: "SET GLOBAL select_into_buffer_size = 131072",
4203-
Expected: []sql.Row{{}},
4203+
Expected: []sql.Row{{types.NewOkResult(0)}},
42044204
},
42054205
} {
42064206
t.Run(assertion.Query, func(t *testing.T) {
@@ -5303,17 +5303,17 @@ func TestPersist(t *testing.T, harness Harness, newPersistableSess func(ctx *sql
53035303
}{
53045304
{
53055305
Query: "SET PERSIST max_connections = 1000;",
5306-
Expected: []sql.Row{{}},
5306+
Expected: []sql.Row{{types.NewOkResult(0)}},
53075307
ExpectedGlobal: int64(1000),
53085308
ExpectedPersist: int64(1000),
53095309
}, {
53105310
Query: "SET @@PERSIST.max_connections = 1000;",
5311-
Expected: []sql.Row{{}},
5311+
Expected: []sql.Row{{types.NewOkResult(0)}},
53125312
ExpectedGlobal: int64(1000),
53135313
ExpectedPersist: int64(1000),
53145314
}, {
53155315
Query: "SET PERSIST_ONLY max_connections = 1000;",
5316-
Expected: []sql.Row{{}},
5316+
Expected: []sql.Row{{types.NewOkResult(0)}},
53175317
ExpectedGlobal: int64(151),
53185318
ExpectedPersist: int64(1000),
53195319
},

enginetest/evaluation.go

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,8 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
8484
require.NoError(t, err, nil)
8585

8686
t.Run(script.Name, func(t *testing.T) {
87-
if sh, ok := harness.(SkippingHarness); ok {
88-
if sh.SkipQueryTest(script.Name) {
89-
t.Skip()
90-
}
91-
92-
if !supportedDialect(harness, script.Dialect) {
93-
t.Skip()
94-
}
87+
if skipScript(harness, script, false) {
88+
t.Skip()
9589
}
9690

9791
for _, statement := range script.SetUpScript {
@@ -126,7 +120,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
126120
ctx = th.NewSession()
127121
}
128122

129-
if skipAssertion(t, harness, assertion) {
123+
if skipAssertion(harness, assertion) {
130124
t.Skip()
131125
}
132126

@@ -161,30 +155,26 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
161155
})
162156
}
163157

164-
func skipAssertion(t *testing.T, harness Harness, assertion queries.ScriptTestAssertion) bool {
165-
if sh, ok := harness.(SkippingHarness); ok && sh.SkipQueryTest(assertion.Query) {
158+
func skipScript(harness Harness, script queries.ScriptTest, prepared bool) bool {
159+
if sh, ok := harness.(SkippingHarness); ok && sh.SkipQueryTest(script.Name) {
166160
return true
167161
}
168162

169-
if !supportedDialect(harness, assertion.Dialect) {
170-
return true
171-
}
163+
return script.Skip || !supportedDialect(harness, script.Dialect) || (prepared && script.SkipPrepared)
164+
}
172165

173-
if assertion.Skip {
166+
func skipAssertion(harness Harness, assertion queries.ScriptTestAssertion) bool {
167+
if sh, ok := harness.(SkippingHarness); ok && sh.SkipQueryTest(assertion.Query) {
174168
return true
175169
}
176170

177-
return false
171+
return assertion.Skip || !supportedDialect(harness, assertion.Dialect)
178172
}
179173

180174
// TestScriptPrepared substitutes literals for bindvars, runs the test script given,
181175
// and makes any assertions given
182176
func TestScriptPrepared(t *testing.T, harness Harness, script queries.ScriptTest) bool {
183177
return t.Run(script.Name, func(t *testing.T) {
184-
if script.SkipPrepared {
185-
t.Skip()
186-
}
187-
188178
e := mustNewEngine(t, harness)
189179
defer e.Close()
190180
TestScriptWithEnginePrepared(t, e, harness, script)
@@ -194,6 +184,10 @@ func TestScriptPrepared(t *testing.T, harness Harness, script queries.ScriptTest
194184
// TestScriptWithEnginePrepared runs the test script with bindvars substituted for literals
195185
// using the engine provided.
196186
func TestScriptWithEnginePrepared(t *testing.T, e QueryEngine, harness Harness, script queries.ScriptTest) {
187+
if skipScript(harness, script, true) {
188+
t.Skip()
189+
}
190+
197191
ctx := NewContext(harness)
198192
err := CreateNewConnectionForServerEngine(ctx, e)
199193
require.NoError(t, err, nil)
@@ -223,13 +217,7 @@ func TestScriptWithEnginePrepared(t *testing.T, e QueryEngine, harness Harness,
223217

224218
for _, assertion := range assertions {
225219
t.Run(assertion.Query, func(t *testing.T) {
226-
227-
if sh, ok := harness.(SkippingHarness); ok {
228-
if sh.SkipQueryTest(assertion.Query) {
229-
t.Skip()
230-
}
231-
}
232-
if assertion.Skip {
220+
if skipAssertion(harness, assertion) {
233221
t.Skip()
234222
}
235223

enginetest/join_planning_tests.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/dolthub/go-mysql-server/sql/plan"
2929
"github.com/dolthub/go-mysql-server/sql/planbuilder"
3030
"github.com/dolthub/go-mysql-server/sql/transform"
31+
"github.com/dolthub/go-mysql-server/sql/types"
3132
)
3233

3334
type JoinPlanTest struct {
@@ -103,7 +104,7 @@ var JoinPlanningTests = []joinPlanScript{
103104
},
104105
{
105106
q: "set @@SESSION.disable_merge_join = 1",
106-
exp: []sql.Row{{}},
107+
exp: []sql.Row{{types.NewOkResult(0)}},
107108
},
108109
{
109110
q: "select /*+ JOIN_ORDER(ab, xy) MERGE_JOIN(ab, xy)*/ * from ab join xy on y = a order by 1, 3",

0 commit comments

Comments
 (0)