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
2 changes: 0 additions & 2 deletions enginetest/memory_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ func TestSingleQuery(t *testing.T) {
Expected: []sql.Row{{-1}},
}

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

fmt.Sprintf("%v", test)
harness := enginetest.NewMemoryHarness("", 1, testNumPartitions, false, nil)
harness.Setup(setup.KeylessSetup...)
engine, err := harness.NewEngine(t)
Expand Down
2 changes: 1 addition & 1 deletion enginetest/server_engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func TestServerPreparedStatements(t *testing.T) {
require.True(t, ok)
})
}
for _, stmt := range append(commonTeardown) {
for _, stmt := range commonTeardown {
_, err := conn.Exec(stmt)
require.NoError(t, err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ require (
gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b // indirect
)

go 1.23.3
go 1.24.0
2 changes: 1 addition & 1 deletion memory/persisted_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

func newPersistedSqlContext() *sql.Context {
ctx, _ := context.WithCancel(context.TODO())
ctx := context.Background()
pro := NewDBProvider()
sess := sql.NewBaseSession()

Expand Down
3 changes: 1 addition & 2 deletions processlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package sqle
import (
"context"
"errors"
"fmt"
"sync"
"time"

Expand Down Expand Up @@ -387,7 +386,7 @@ func getLongQueryTime() float64 {
}
longQueryTime, ok := longQueryTimeValue.(float64)
if !ok {
logrus.Errorf(fmt.Sprintf("unexpected type for value of long_query_time system variable: %T", longQueryTimeValue))
logrus.Errorf("unexpected type for value of long_query_time system variable: %T", longQueryTimeValue)
return 0
}
return longQueryTime
Expand Down
2 changes: 1 addition & 1 deletion sql/analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (a *Analyzer) LogDiff(prev, next sql.Node) {
panic(err)
}
if len(diff) > 0 {
a.Log(diff)
a.Log("%s", diff)
} else {
a.Log("nodes are different, but no textual diff found (implement better DebugString?)")
}
Expand Down
3 changes: 1 addition & 2 deletions sql/analyzer/indexed_joins.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func replanJoin(ctx *sql.Context, n *plan.JoinNode, a *Analyzer, scope *plan.Sco
}

if a.Verbose && a.Debug {
a.Log(m.String())
a.Log("%s", m.String())
}
if scope != nil {
scope.JoinTrees = append(scope.JoinTrees, m.String())
Expand Down Expand Up @@ -489,7 +489,6 @@ func convertSemiToInnerJoin(m *memo.Memo) error {
}
if srcNode == nil {
break
return fmt.Errorf("table for column not found: %d", colId)
}

sch := srcNode.Schema()
Expand Down
4 changes: 1 addition & 3 deletions sql/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package sql
import (
"fmt"
"io"
"strings"

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

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

// UnwrapError removes any wrapping errors (e.g. WrappedInsertError) around the specified error and
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (c *Convert) DebugString() string {
children = append(children, fmt.Sprintf("typeScale: %v", c.typeScale))
}

children = append(children, fmt.Sprintf(sql.DebugString(c.Child)))
children = append(children, sql.DebugString(c.Child))

_ = pr.WriteChildren(children...)
return pr.String()
Expand Down
6 changes: 3 additions & 3 deletions sql/expression/function/days.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (t *ToDays) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

date, _, err = types.Date.Convert(ctx, date)
if err != nil {
ctx.Warn(1292, err.Error())
ctx.Warn(1292, "%s", err.Error())
return nil, nil
}
d := date.(time.Time)
Expand Down Expand Up @@ -215,7 +215,7 @@ func (f *FromDays) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

d, _, err = types.Int64.Convert(ctx, d)
if err != nil {
ctx.Warn(1292, err.Error())
ctx.Warn(1292, "%s", err.Error())
return "0000-00-00", nil
}

Expand Down Expand Up @@ -299,7 +299,7 @@ func (f *LastDay) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

date, _, err = types.Date.Convert(ctx, date)
if err != nil {
ctx.Warn(1292, err.Error())
ctx.Warn(1292, "%s", err.Error())
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (td *Extract) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

right, err = types.DatetimeMaxPrecision.ConvertWithoutRangeCheck(ctx, right)
if err != nil {
ctx.Warn(1292, err.Error())
ctx.Warn(1292, "%s", err.Error())
return nil, nil
}

Expand Down
8 changes: 4 additions & 4 deletions sql/expression/function/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (f *Uncompress) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

val, _, err := types.LongBlob.Convert(ctx, arg)
if err != nil {
ctx.Warn(1258, err.Error())
ctx.Warn(1258, "%s", err.Error())
return nil, nil
}
valBytes := val.([]byte)
Expand All @@ -387,14 +387,14 @@ func (f *Uncompress) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

outLen := binary.LittleEndian.Uint32(valBytes[:compressHeaderSize])
if outLen > compressMaxSize {
ctx.Warn(1258, fmt.Sprintf("Uncompressed data too large; the maximum size is %d", compressMaxSize))
ctx.Warn(1258, "Uncompressed data too large; the maximum size is %d", compressMaxSize)
return nil, nil
}

outBuf := make([]byte, outLen)
readLen, err := reader.Read(outBuf)
if err != nil && err != io.EOF {
ctx.Warn(1258, err.Error())
ctx.Warn(1258, "%s", err.Error())
return nil, nil
}
// if we don't receive io.EOF, then received outLen was too small
Expand Down Expand Up @@ -453,7 +453,7 @@ func (f *UncompressedLength) Eval(ctx *sql.Context, row sql.Row) (interface{}, e

val, _, err := types.LongBlob.Convert(ctx, arg)
if err != nil {
ctx.Warn(1258, err.Error())
ctx.Warn(1258, "%s", err.Error())
return nil, nil
}
valBytes := val.([]byte)
Expand Down
8 changes: 4 additions & 4 deletions sql/expression/function/hash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func TestCompress(t *testing.T) {

for _, test := range tests {
f := NewCompress(test.val)
t.Run(fmt.Sprintf(f.String()), func(t *testing.T) {
t.Run(f.String(), func(t *testing.T) {
res, err := f.Eval(sql.NewEmptyContext(), nil)
require.NoError(t, err)
if test.exp == nil {
Expand Down Expand Up @@ -370,7 +370,7 @@ func TestUncompress(t *testing.T) {

for _, test := range tests {
f := NewUncompress(test.val)
t.Run(fmt.Sprintf(f.String()), func(t *testing.T) {
t.Run(f.String(), func(t *testing.T) {
res, err := f.Eval(sql.NewEmptyContext(), nil)
require.NoError(t, err)
if test.exp == nil {
Expand Down Expand Up @@ -430,7 +430,7 @@ func TestUncompressedLength(t *testing.T) {

for _, test := range tests {
f := NewUncompressedLength(test.val)
t.Run(fmt.Sprintf(f.String()), func(t *testing.T) {
t.Run(f.String(), func(t *testing.T) {
res, err := f.Eval(sql.NewEmptyContext(), nil)
require.NoError(t, err)
require.Equal(t, test.exp, res)
Expand Down Expand Up @@ -475,7 +475,7 @@ func TestValidatePasswordStrength(t *testing.T) {

for _, test := range tests {
f := NewValidatePasswordStrength(test.val)
t.Run(fmt.Sprintf(f.String()), func(t *testing.T) {
t.Run(f.String(), func(t *testing.T) {
res, err := f.Eval(sql.NewEmptyContext(), nil)
require.NoError(t, err)
require.Equal(t, test.exp, res)
Expand Down
12 changes: 6 additions & 6 deletions sql/expression/function/inet_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ func (i *InetAton) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
ip := net.ParseIP(ipstr)
if ip == nil {
// Failed to Parse IP correctly
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName())
return nil, nil
}

// Expect an IPv4 address
ipv4 := ip.To4()
if ipv4 == nil {
// Received invalid IPv4 address (IPv6 address are invalid)
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName())
return nil, nil
}

Expand Down Expand Up @@ -165,7 +165,7 @@ func (i *Inet6Aton) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
ip := net.ParseIP(ipstr)
if ip == nil {
// Failed to Parse IP correctly
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName())
return nil, nil
}

Expand All @@ -179,7 +179,7 @@ func (i *Inet6Aton) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
ipv6 := ip.To16()
if ipv6 == nil {
// Invalid IPv6 address
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%s'' for function %s", ipstr, i.FunctionName())
return nil, nil
}

Expand Down Expand Up @@ -326,7 +326,7 @@ func (i *Inet6Ntoa) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

// There must be exactly 4 or 16 bytes (len == 4 satisfied above)
if len(ipbytes) != 16 {
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%s'' for function %s", string(val.([]byte)), i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%s'' for function %s", string(val.([]byte)), i.FunctionName())
return nil, nil
}

Expand Down Expand Up @@ -355,7 +355,7 @@ func (i *Inet6Ntoa) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
var ipv6 net.IP = ipbytes
return ipv6.String(), nil
default:
ctx.Warn(1411, fmt.Sprintf("Incorrect string value: ''%v'' for function %s", val, i.FunctionName()))
ctx.Warn(1411, "Incorrect string value: ''%v'' for function %s", val, i.FunctionName())
return nil, nil
}
}
16 changes: 8 additions & 8 deletions sql/expression/function/json/jsontests/json_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,42 +121,42 @@ func TestJSONType(t *testing.T) {

{
f: f1,
row: sql.Row{types.JSONDocument{nil}},
row: sql.Row{types.JSONDocument{Val: nil}},
exp: "NULL",
},
{
f: f1,
row: sql.Row{types.JSONDocument{uint64(1)}},
row: sql.Row{types.JSONDocument{Val: uint64(1)}},
exp: "UNSIGNED INTEGER",
},
{
f: f1,
row: sql.Row{types.JSONDocument{int64(1)}},
row: sql.Row{types.JSONDocument{Val: int64(1)}},
exp: "INTEGER",
},
{
f: f1,
row: sql.Row{types.JSONDocument{true}},
row: sql.Row{types.JSONDocument{Val: true}},
exp: "BOOLEAN",
},
{
f: f1,
row: sql.Row{types.JSONDocument{123.456}},
row: sql.Row{types.JSONDocument{Val: 123.456}},
exp: "DOUBLE",
},
{
f: f1,
row: sql.Row{types.JSONDocument{decimal.New(123456, -3)}},
row: sql.Row{types.JSONDocument{Val: decimal.New(123456, -3)}},
exp: "DECIMAL",
},
{
f: f1,
row: sql.Row{types.JSONDocument{[]interface{}{}}},
row: sql.Row{types.JSONDocument{Val: []interface{}{}}},
exp: "ARRAY",
},
{
f: f1,
row: sql.Row{types.JSONDocument{map[string]interface{}{}}},
row: sql.Row{types.JSONDocument{Val: map[string]interface{}{}}},
exp: "OBJECT",
},
}
Expand Down
4 changes: 2 additions & 2 deletions sql/expression/function/logarithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ func (l *Log) Eval(

func computeLog(ctx *sql.Context, v float64, base float64) (interface{}, error) {
if v <= 0 {
ctx.Warn(3020, ErrInvalidArgumentForLogarithm.New(v).Error())
ctx.Warn(3020, "%s", ErrInvalidArgumentForLogarithm.New(v).Error())
return nil, nil
}
if base == float64(1) || base <= float64(0) {
ctx.Warn(3020, ErrInvalidArgumentForLogarithm.New(base).Error())
ctx.Warn(3020, "%s", ErrInvalidArgumentForLogarithm.New(base).Error())
return nil, nil
}
switch base {
Expand Down
2 changes: 1 addition & 1 deletion sql/expression/function/str_to_date.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *StrToDate) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {

goTime, err := dateparse.ParseDateWithFormat(dateStr, formatStr)
if err != nil {
ctx.Warn(1411, fmt.Sprintf("Incorrect value: '%s' for function %s", dateStr, s.FunctionName()))
ctx.Warn(1411, "Incorrect value: '%s' for function %s", dateStr, s.FunctionName())
return nil, nil
}

Expand Down
Loading
Loading