Skip to content

Commit cd7eb68

Browse files
committed
Merge branch 'main' of https://github.com/dolthub/go-mysql-server into angela/emptystringset
2 parents 68a8ed8 + 0429d89 commit cd7eb68

Some content is hidden

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

78 files changed

+193
-209
lines changed

enginetest/evaluation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ func WidenRow(t *testing.T, sch sql.Schema, row sql.Row) sql.Row {
852852
widened := make(sql.Row, len(row))
853853
for i, v := range row {
854854
if i < len(sch) && types.IsJSON(sch[i].Type) {
855-
widened[i] = widenJSONValues(v)
855+
widened[i] = widenJSONValues(t.Context(), v)
856856
continue
857857
}
858858

@@ -893,7 +893,7 @@ func widenValue(t *testing.T, v interface{}) (vw interface{}) {
893893
return vw
894894
}
895895

896-
func widenJSONValues(val interface{}) sql.JSONWrapper {
896+
func widenJSONValues(ctx context.Context, val interface{}) sql.JSONWrapper {
897897
if val == nil {
898898
return nil
899899
}
@@ -907,7 +907,7 @@ func widenJSONValues(val interface{}) sql.JSONWrapper {
907907
js = types.MustJSON(str)
908908
}
909909

910-
doc, err := js.ToInterface()
910+
doc, err := js.ToInterface(ctx)
911911
if err != nil {
912912
panic(err)
913913
}

enginetest/memory_engine_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ func TestSingleQuery(t *testing.T) {
156156
Expected: []sql.Row{{-1}},
157157
}
158158

159-
fmt.Sprintf("%v", test)
160159
harness := enginetest.NewMemoryHarness("", 1, testNumPartitions, true, nil)
161160
// harness.UseServer()
162161
harness.Setup(setup.MydbData, setup.NiltableData)
@@ -186,7 +185,6 @@ func TestSingleQueryPrepared(t *testing.T) {
186185
},
187186
}
188187

189-
fmt.Sprintf("%v", test)
190188
harness := enginetest.NewMemoryHarness("", 1, testNumPartitions, false, nil)
191189
harness.Setup(setup.KeylessSetup...)
192190
engine, err := harness.NewEngine(t)

enginetest/server_engine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ func TestServerPreparedStatements(t *testing.T) {
368368
require.True(t, ok)
369369
})
370370
}
371-
for _, stmt := range append(commonTeardown) {
371+
for _, stmt := range commonTeardown {
372372
_, err := conn.Exec(stmt)
373373
require.NoError(t, err)
374374
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ require (
4242
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
4343
)
4444

45-
go 1.23.3
45+
go 1.24.0

memory/persisted_session_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
)
2828

2929
func newPersistedSqlContext() *sql.Context {
30-
ctx, _ := context.WithCancel(context.TODO())
30+
ctx := context.Background()
3131
pro := NewDBProvider()
3232
sess := sql.NewBaseSession()
3333

processlist.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package sqle
1717
import (
1818
"context"
1919
"errors"
20-
"fmt"
2120
"sync"
2221
"time"
2322

@@ -387,7 +386,7 @@ func getLongQueryTime() float64 {
387386
}
388387
longQueryTime, ok := longQueryTimeValue.(float64)
389388
if !ok {
390-
logrus.Errorf(fmt.Sprintf("unexpected type for value of long_query_time system variable: %T", longQueryTimeValue))
389+
logrus.Errorf("unexpected type for value of long_query_time system variable: %T", longQueryTimeValue)
391390
return 0
392391
}
393392
return longQueryTime

sql/analyzer/analyzer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func (a *Analyzer) LogDiff(prev, next sql.Node) {
369369
panic(err)
370370
}
371371
if len(diff) > 0 {
372-
a.Log(diff)
372+
a.Log("%s", diff)
373373
} else {
374374
a.Log("nodes are different, but no textual diff found (implement better DebugString?)")
375375
}

sql/analyzer/indexed_joins.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func replanJoin(ctx *sql.Context, n *plan.JoinNode, a *Analyzer, scope *plan.Sco
217217
}
218218

219219
if a.Verbose && a.Debug {
220-
a.Log(m.String())
220+
a.Log("%s", m.String())
221221
}
222222
if scope != nil {
223223
scope.JoinTrees = append(scope.JoinTrees, m.String())
@@ -489,7 +489,6 @@ func convertSemiToInnerJoin(m *memo.Memo) error {
489489
}
490490
if srcNode == nil {
491491
break
492-
return fmt.Errorf("table for column not found: %d", colId)
493492
}
494493

495494
sch := srcNode.Schema()

sql/core.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package sql
1616

1717
import (
18+
"context"
1819
"encoding/json"
1920
"fmt"
2021
trace2 "runtime/trace"
@@ -324,7 +325,7 @@ func ConvertToBool(ctx *Context, v interface{}) (bool, error) {
324325
}
325326
}
326327

327-
func ConvertToVector(v interface{}) ([]float64, error) {
328+
func ConvertToVector(ctx context.Context, v interface{}) ([]float64, error) {
328329
switch b := v.(type) {
329330
case []float64:
330331
return b, nil
@@ -336,7 +337,7 @@ func ConvertToVector(v interface{}) ([]float64, error) {
336337
}
337338
return convertJsonInterfaceToVector(val)
338339
case JSONWrapper:
339-
val, err := b.ToInterface()
340+
val, err := b.ToInterface(ctx)
340341
if err != nil {
341342
return nil, err
342343
}

sql/errors.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package sql
1717
import (
1818
"fmt"
1919
"io"
20-
"strings"
2120

2221
"github.com/dolthub/vitess/go/mysql"
2322
"gopkg.in/src-d/go-errors.v1"
@@ -1021,8 +1020,7 @@ func CastSQLError(err error) *mysql.SQLError {
10211020
code = mysql.ERUnknownError
10221021
}
10231022

1024-
// This uses the given error as a format string, so we have to escape any percentage signs else they'll show up as "%!(MISSING)"
1025-
return mysql.NewSQLError(code, sqlState, strings.Replace(err.Error(), `%`, `%%`, -1))
1023+
return mysql.NewSQLError(code, sqlState, "%s", err.Error())
10261024
}
10271025

10281026
// UnwrapError removes any wrapping errors (e.g. WrappedInsertError) around the specified error and

0 commit comments

Comments
 (0)