Skip to content

Commit

Permalink
*: remove useless conversions and omit some types (pingcap#16262)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 authored Apr 9, 2020
1 parent 2a2bf37 commit c561d5a
Show file tree
Hide file tree
Showing 63 changed files with 154 additions and 154 deletions.
2 changes: 1 addition & 1 deletion cmd/ddltest/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ func (s *TestDDLSuite) TestSimpleConflictUpdate(c *C) {
k := randomNum(rowCount)
s.mustExec(c, fmt.Sprintf("update test_conflict_update set c2 = %d where c1 = %d", defaultValue, k))
mu.Lock()
keysMap[int64(k)] = int64(defaultValue)
keysMap[int64(k)] = defaultValue
mu.Unlock()
}
}()
Expand Down
2 changes: 1 addition & 1 deletion cmd/importer/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func getValidPrefix(lower, upper string) string {
randCh := uint8(rand.Intn(int(upper[i]-lower[i]))) + lower[i]
newBytes := make([]byte, i, i+1)
copy(newBytes, lower[:i])
newBytes = append(newBytes, byte(randCh))
newBytes = append(newBytes, randCh)
return string(newBytes)
}
}
Expand Down
2 changes: 1 addition & 1 deletion ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ func (s *serialTestStateChangeSuite) TestParallelFlashbackTable(c *C) {
// Disable emulator GC, otherwise, emulator GC will delete table record as soon as possible after executing drop table DDL.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down
8 changes: 4 additions & 4 deletions ddl/serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ func (s *testSerialSuite) TestRecoverTableByJobID(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeAfterDrop := time.Now().Add(time.Duration(48 * 60 * 60 * time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
timeAfterDrop := time.Now().Add(48 * 60 * 60 * time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down Expand Up @@ -595,7 +595,7 @@ func (s *testSerialSuite) TestRecoverTableByJobIDFail(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down Expand Up @@ -664,7 +664,7 @@ func (s *testSerialSuite) TestRecoverTableByTableNameFail(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down
2 changes: 1 addition & 1 deletion ddl/split_region.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func splitPreSplitedTable(store kv.SplittableStore, tbInfo *model.TableInfo, sca
step := int64(1 << (tbInfo.ShardRowIDBits - tbInfo.PreSplitRegions))
max := int64(1 << tbInfo.ShardRowIDBits)
splitTableKeys := make([][]byte, 0, 1<<(tbInfo.PreSplitRegions))
for p := int64(step); p < max; p += step {
for p := step; p < max; p += step {
recordID := p << (64 - tbInfo.ShardRowIDBits - 1)
recordPrefix := tablecodec.GenTableRecordPrefix(tbInfo.ID)
key := tablecodec.EncodeRecordKey(recordPrefix, recordID)
Expand Down
2 changes: 1 addition & 1 deletion distsql/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func GetSystemEndian() tipb.Endian {
}

func init() {
var i int = 0x0100
i := 0x0100
ptr := unsafe.Pointer(&i)
if 0x01 == *(*byte)(ptr) {
systemEndian = tipb.Endian_BigEndian
Expand Down
2 changes: 1 addition & 1 deletion domain/global_vars_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type GlobalVariableCache struct {
disable bool
}

const globalVariableCacheExpiry time.Duration = 2 * time.Second
const globalVariableCacheExpiry = 2 * time.Second

// Update updates the global variable cache.
func (gvc *GlobalVariableCache) Update(rows []chunk.Row, fields []*ast.ResultField) {
Expand Down
6 changes: 3 additions & 3 deletions executor/aggfuncs/func_bitfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (e *bitOrUint64) UpdatePartialResult(sctx sessionctx.Context, rowsInGroup [

func (*bitOrUint64) MergePartialResult(sctx sessionctx.Context, src, dst PartialResult) error {
p1, p2 := (*partialResult4BitFunc)(src), (*partialResult4BitFunc)(dst)
*p2 |= uint64(*p1)
*p2 |= *p1
return nil
}

Expand All @@ -87,7 +87,7 @@ func (e *bitXorUint64) UpdatePartialResult(sctx sessionctx.Context, rowsInGroup

func (*bitXorUint64) MergePartialResult(sctx sessionctx.Context, src, dst PartialResult) error {
p1, p2 := (*partialResult4BitFunc)(src), (*partialResult4BitFunc)(dst)
*p2 ^= uint64(*p1)
*p2 ^= *p1
return nil
}

Expand Down Expand Up @@ -123,6 +123,6 @@ func (e *bitAndUint64) UpdatePartialResult(sctx sessionctx.Context, rowsInGroup

func (*bitAndUint64) MergePartialResult(sctx sessionctx.Context, src, dst PartialResult) error {
p1, p2 := (*partialResult4BitFunc)(src), (*partialResult4BitFunc)(dst)
*p2 &= uint64(*p1)
*p2 &= *p1
return nil
}
2 changes: 1 addition & 1 deletion executor/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ func (s *testSuite6) TestAlterTableAddColumn(c *C) {
tk.MustExec("insert into alter_test values(1)")
tk.MustExec("alter table alter_test add column c2 timestamp default current_timestamp")
time.Sleep(1 * time.Millisecond)
now := time.Now().Add(-time.Duration(1 * time.Millisecond)).Format(types.TimeFormat)
now := time.Now().Add(-1 * time.Millisecond).Format(types.TimeFormat)
r, err := tk.Exec("select c2 from alter_test")
c.Assert(err, IsNil)
req := r.NewChunk()
Expand Down
6 changes: 3 additions & 3 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4616,8 +4616,8 @@ func (s *testRecoverTable) TestRecoverTable(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeAfterDrop := time.Now().Add(time.Duration(48 * 60 * 60 * time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
timeAfterDrop := time.Now().Add(48 * 60 * 60 * time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down Expand Up @@ -4728,7 +4728,7 @@ func (s *testRecoverTable) TestFlashbackTable(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down
4 changes: 2 additions & 2 deletions executor/index_lookup_hash_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (e *IndexNestedLoopHashJoin) startWorkers(ctx context.Context) {
e.resultCh = nil
}
e.joinChkResourceCh = make([]chan *chunk.Chunk, concurrency)
for i := int(0); i < concurrency; i++ {
for i := 0; i < concurrency; i++ {
if !e.keepOuterOrder {
e.joinChkResourceCh[i] = make(chan *chunk.Chunk, 1)
e.joinChkResourceCh[i] <- newFirstChunk(e)
Expand All @@ -179,7 +179,7 @@ func (e *IndexNestedLoopHashJoin) startWorkers(ctx context.Context) {
}

e.workerWg.Add(concurrency)
for i := int(0); i < concurrency; i++ {
for i := 0; i < concurrency; i++ {
workerID := i
go util.WithRecovery(func() { e.newInnerWorker(innerCh, workerID).run(workerCtx, cancelFunc) }, e.finishJoinWorkers)
}
Expand Down
2 changes: 1 addition & 1 deletion executor/seqtest/seq_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ func (s *seqTestSuite) TestAutoRandRecoverTable(c *C) {
// Otherwise emulator GC will delete table record as soon as possible after execute drop table ddl.
ddl.EmulatorGCDisable()
gcTimeFormat := "20060102-15:04:05 -0700 MST"
timeBeforeDrop := time.Now().Add(0 - time.Duration(48*60*60*time.Second)).Format(gcTimeFormat)
timeBeforeDrop := time.Now().Add(0 - 48*60*60*time.Second).Format(gcTimeFormat)
safePointSQL := `INSERT HIGH_PRIORITY INTO mysql.tidb VALUES ('tikv_gc_safe_point', '%[1]s', '')
ON DUPLICATE KEY
UPDATE variable_value = '%[1]s'`
Expand Down
2 changes: 1 addition & 1 deletion expression/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ func genVecEvalBool(numCols int, colTypes, eTypes []types.EvalType) (CNFExprs, *

func generateRandomSel() []int {
randGen := newDefaultRandGen()
randGen.Seed(int64(time.Now().UnixNano()))
randGen.Seed(time.Now().UnixNano())
var sel []int
count := 0
// Use constant 256 to make it faster to generate randomly arranged sel slices
Expand Down
8 changes: 4 additions & 4 deletions expression/builtin_cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func (s *testEvaluatorSuite) TestCastXXX(c *C) {
var (
year, month, day = time.Now().In(time.UTC).Date()
curDateInt = int64(year*10000 + int(month)*100 + day)
curTimeInt = int64(curDateInt*1000000 + 125959)
curTimeInt = curDateInt*1000000 + 125959
curTimeWithFspReal = float64(curTimeInt) + 0.555
curTimeString = fmt.Sprintf("%4d-%02d-%02d 12:59:59", year, int(month), day)
curTimeWithFspString = fmt.Sprintf("%4d-%02d-%02d 12:59:59.555000", year, int(month), day)
Expand All @@ -281,12 +281,12 @@ var (
// timeWithFspDatum indicates datetime "curYear-curMonth-curDay 12:59:59.555000".
timeWithFspDatum = types.NewDatum(tmWithFsp)
duration = types.Duration{
Duration: time.Duration(12*time.Hour + 59*time.Minute + 59*time.Second),
Duration: 12*time.Hour + 59*time.Minute + 59*time.Second,
Fsp: types.DefaultFsp}
// durationDatum indicates duration "12:59:59".
durationDatum = types.NewDatum(duration)
durationWithFsp = types.Duration{
Duration: time.Duration(12*time.Hour + 59*time.Minute + 59*time.Second + 555*time.Millisecond),
Duration: 12*time.Hour + 59*time.Minute + 59*time.Second + 555*time.Millisecond,
Fsp: 3}
// durationWithFspDatum indicates duration "12:59:59.555"
durationWithFspDatum = types.NewDatum(durationWithFsp)
Expand Down Expand Up @@ -1187,7 +1187,7 @@ func (s *testEvaluatorSuite) TestWrapWithCastAsTypesClasses(c *C) {
{
&Column{RetType: types.NewFieldType(mysql.TypeDatetime), Index: 0},
chunk.MutRowFromDatums([]types.Datum{timeWithFspDatum}),
int64(curDateInt*1000000 + 130000), curTimeWithFspReal, types.NewDecFromFloatForTest(curTimeWithFspReal), curTimeWithFspString,
curDateInt*1000000 + 130000, curTimeWithFspReal, types.NewDecFromFloatForTest(curTimeWithFspReal), curTimeWithFspString,
},
{
durationColumn0,
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_cast_vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ type randJSONDuration struct{}

func (g *randJSONDuration) gen() interface{} {
d := types.Duration{
Duration: time.Duration(time.Duration(rand.Intn(12))*time.Hour + time.Duration(rand.Intn(60))*time.Minute + time.Duration(rand.Intn(60))*time.Second + time.Duration(rand.Intn(1000))*time.Millisecond),
Duration: time.Duration(rand.Intn(12))*time.Hour + time.Duration(rand.Intn(60))*time.Minute + time.Duration(rand.Intn(60))*time.Second + time.Duration(rand.Intn(1000))*time.Millisecond,
Fsp: 3}
return json.CreateBinary(d.String())
}
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_compare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (s *testEvaluatorSuite) TestCompareFunctionWithRefine(c *C) {
func (s *testEvaluatorSuite) TestCompare(c *C) {
intVal, uintVal, realVal, stringVal, decimalVal := 1, uint64(1), 1.1, "123", types.NewDecFromFloatForTest(123.123)
timeVal := types.NewTime(types.FromGoTime(time.Now()), mysql.TypeDatetime, 6)
durationVal := types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second)}
durationVal := types.Duration{Duration: 12*time.Hour + 1*time.Minute + 1*time.Second}
jsonVal := json.CreateBinary("123")
// test cases for generating function signatures.
tests := []struct {
Expand Down
4 changes: 2 additions & 2 deletions expression/builtin_compare_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@ func (b *builtinLeastTimeSig) vecEvalString(input *chunk.Chunk, result *chunk.Co
}
var argTime types.Time

var findInvalidTime []bool = make([]bool, n)
var invalidValue []string = make([]string, n)
findInvalidTime := make([]bool, n)
invalidValue := make([]string, n)

for j := 0; j < len(b.args); j++ {
if err := b.args[j].VecEvalString(b.ctx, input, result); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ func decodeKey(ctx sessionctx.Context, s string) string {
return s
}
// Auto decode byte if needed.
_, bs, err := codec.DecodeBytes([]byte(key), nil)
_, bs, err := codec.DecodeBytes(key, nil)
if err == nil {
key = bs
}
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_json.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ func (b *builtinJSONSearchSig) evalJSON(row chunk.Row) (res json.BinaryJSON, isN
if isNull || len(escapeStr) == 0 {
escape = byte('\\')
} else if len(escapeStr) == 1 {
escape = byte(escapeStr[0])
escape = escapeStr[0]
} else {
return res, true, errIncorrectArgs.GenWithStackByArgs("ESCAPE")
}
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_miscellaneous_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func (s *testEvaluatorSuite) TestIsIPv4Compat(c *C) {
func (s *testEvaluatorSuite) TestNameConst(c *C) {
dec := types.NewDecFromFloatForTest(123.123)
tm := types.NewTime(types.FromGoTime(time.Now()), mysql.TypeDatetime, 6)
du := types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second), Fsp: types.DefaultFsp}
du := types.Duration{Duration: 12*time.Hour + 1*time.Minute + 1*time.Second, Fsp: types.DefaultFsp}
cases := []struct {
colName string
arg interface{}
Expand Down
10 changes: 5 additions & 5 deletions expression/builtin_other_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (s *testEvaluatorSuite) TestBitCount(c *C) {
{float64(-1.1), int64(64)},
{float64(-3.1), int64(63)},
{uint64(math.MaxUint64), int64(64)},
{string("xxx"), int64(0)},
{"xxx", int64(0)},
{nil, nil},
}
for _, test := range bitCountCases {
Expand Down Expand Up @@ -83,10 +83,10 @@ func (s *testEvaluatorSuite) TestInFunc(c *C) {
time2 := types.NewTime(types.FromGoTime(time.Date(2017, 1, 2, 1, 1, 1, 1, time.UTC)), mysql.TypeDatetime, 6)
time3 := types.NewTime(types.FromGoTime(time.Date(2017, 1, 3, 1, 1, 1, 1, time.UTC)), mysql.TypeDatetime, 6)
time4 := types.NewTime(types.FromGoTime(time.Date(2017, 1, 4, 1, 1, 1, 1, time.UTC)), mysql.TypeDatetime, 6)
duration1 := types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second)}
duration2 := types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Minute)}
duration3 := types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Second)}
duration4 := types.Duration{Duration: time.Duration(12 * time.Hour)}
duration1 := types.Duration{Duration: 12*time.Hour + 1*time.Minute + 1*time.Second}
duration2 := types.Duration{Duration: 12*time.Hour + 1*time.Minute}
duration3 := types.Duration{Duration: 12*time.Hour + 1*time.Second}
duration4 := types.Duration{Duration: 12 * time.Hour}
json1 := json.CreateBinary("123")
json2 := json.CreateBinary("123.1")
json3 := json.CreateBinary("123.2")
Expand Down
44 changes: 22 additions & 22 deletions expression/builtin_string_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (s *testEvaluatorSuite) TestLengthAndOctetLength(c *C) {
{types.NewTime(types.FromGoTime(time.Now()), mysql.TypeDatetime, 6), 26, false, false},
{types.NewBinaryLiteralFromUint(0x01, -1), 1, false, false},
{types.Set{Value: 1, Name: "abc"}, 3, false, false},
{types.Duration{Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second), Fsp: types.DefaultFsp}, 8, false, false},
{types.Duration{Duration: 12*time.Hour + 1*time.Minute + 1*time.Second, Fsp: types.DefaultFsp}, 8, false, false},
{nil, 0, true, false},
{errors.New("must error"), 0, false, true},
}
Expand Down Expand Up @@ -133,7 +133,7 @@ func (s *testEvaluatorSuite) TestConcat(c *C) {
types.NewDecFromFloatForTest(1.1),
types.NewTime(types.FromDate(2000, 1, 1, 12, 01, 01, 0), mysql.TypeDatetime, types.DefaultFsp),
types.Duration{
Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second),
Duration: 12*time.Hour + 1*time.Minute + 1*time.Second,
Fsp: types.DefaultFsp},
},
false, false, "ab121.11.21.12000-01-01 12:01:0112:01:01",
Expand Down Expand Up @@ -251,7 +251,7 @@ func (s *testEvaluatorSuite) TestConcatWS(c *C) {
types.NewDecFromFloatForTest(1.1),
types.NewTime(types.FromDate(2000, 1, 1, 12, 01, 01, 0), mysql.TypeDatetime, types.DefaultFsp),
types.Duration{
Duration: time.Duration(12*time.Hour + 1*time.Minute + 1*time.Second),
Duration: 12*time.Hour + 1*time.Minute + 1*time.Second,
Fsp: types.DefaultFsp},
},
false, false, "a,b,1,2,1.1,0.11,1.1,2000-01-01 12:01:01,12:01:01",
Expand Down Expand Up @@ -1852,27 +1852,27 @@ func (s *testEvaluatorSuite) TestFromBase64(c *C) {
args interface{}
expect interface{}
}{
{string(""), string("")},
{string("YWJj"), string("abc")},
{string("YWIgYw=="), string("ab c")},
{string("YWIKYw=="), string("ab\nc")},
{string("YWIJYw=="), string("ab\tc")},
{string("cXdlcnR5MTIzNDU2"), string("qwerty123456")},
{"", ""},
{"YWJj", "abc"},
{"YWIgYw==", "ab c"},
{"YWIKYw==", "ab\nc"},
{"YWIJYw==", "ab\tc"},
{"cXdlcnR5MTIzNDU2", "qwerty123456"},
{
string("QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0\nNTY3ODkrL0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4\neXowMTIzNDU2Nzg5Ky9BQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3Bx\ncnN0dXZ3eHl6MDEyMzQ1Njc4OSsv"),
string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0\nNTY3ODkrL0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4\neXowMTIzNDU2Nzg5Ky9BQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3Bx\ncnN0dXZ3eHl6MDEyMzQ1Njc4OSsv",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
},
{
string("QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw=="),
string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
},
{
string("QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw=="),
string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
"QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
},
{
string("QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw=="),
string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
"QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
},
}
fc := funcs[ast.FromBase64]
Expand Down Expand Up @@ -1902,16 +1902,16 @@ func (s *testEvaluatorSuite) TestFromBase64Sig(c *C) {
isNil bool
maxAllowPacket uint64
}{
{string("YWJj"), string("abc"), false, 3},
{string("YWJj"), "", true, 2},
{"YWJj", "abc", false, 3},
{"YWJj", "", true, 2},
{
string("QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw=="),
string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),
"QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
false,
70,
},
{
string("QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw=="),
"QUJDREVGR0hJSkt\tMTU5PUFFSU1RVVld\nYWVphYmNkZ\rWZnaGlqa2xt bm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLw==",
"",
true,
69,
Expand Down
2 changes: 1 addition & 1 deletion expression/builtin_time_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ func (b *builtinWeekWithModeSig) vecEvalInt(input *chunk.Chunk, result *chunk.Co
continue
}
mode := int(ms[i])
week := date.Week(int(mode))
week := date.Week(mode)
i64s[i] = int64(week)
}
return nil
Expand Down
Loading

0 comments on commit c561d5a

Please sign in to comment.