From 5fd17dd7f4cef3f2e103f12427cb9197d9838b73 Mon Sep 17 00:00:00 2001 From: JmPotato Date: Tue, 18 May 2021 16:27:40 +0800 Subject: [PATCH] expression: fix the spelling of word arithmetical (#24713) --- expression/builtin_time.go | 238 ++++++++++++++++---------------- expression/builtin_time_test.go | 2 +- 2 files changed, 120 insertions(+), 120 deletions(-) diff --git a/expression/builtin_time.go b/expression/builtin_time.go index 13b3d1eef3def..67413dab11374 100644 --- a/expression/builtin_time.go +++ b/expression/builtin_time.go @@ -2769,20 +2769,20 @@ func (b *builtinExtractDurationSig) evalInt(row chunk.Row) (int64, bool, error) return res, err != nil, err } -// baseDateArithmitical is the base class for all "builtinAddDateXXXSig" and "builtinSubDateXXXSig", +// baseDateArithmetical is the base class for all "builtinAddDateXXXSig" and "builtinSubDateXXXSig", // which provides parameter getter and date arithmetical calculate functions. -type baseDateArithmitical struct { +type baseDateArithmetical struct { // intervalRegexp is "*Regexp" used to extract string interval for "DAY" unit. intervalRegexp *regexp.Regexp } -func newDateArighmeticalUtil() baseDateArithmitical { - return baseDateArithmitical{ +func newDateArighmeticalUtil() baseDateArithmetical { + return baseDateArithmetical{ intervalRegexp: regexp.MustCompile(`-?[\d]+`), } } -func (du *baseDateArithmitical) getDateFromString(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { +func (du *baseDateArithmetical) getDateFromString(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { dateStr, isNull, err := args[0].EvalString(ctx, row) if isNull || err != nil { return types.ZeroTime, true, err @@ -2807,7 +2807,7 @@ func (du *baseDateArithmitical) getDateFromString(ctx sessionctx.Context, args [ return date, false, handleInvalidTimeError(ctx, err) } -func (du *baseDateArithmitical) getDateFromInt(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { +func (du *baseDateArithmetical) getDateFromInt(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { dateInt, isNull, err := args[0].EvalInt(ctx, row) if isNull || err != nil { return types.ZeroTime, true, err @@ -2827,7 +2827,7 @@ func (du *baseDateArithmitical) getDateFromInt(ctx sessionctx.Context, args []Ex return date, false, nil } -func (du *baseDateArithmitical) getDateFromDatetime(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { +func (du *baseDateArithmetical) getDateFromDatetime(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (types.Time, bool, error) { date, isNull, err := args[0].EvalTime(ctx, row) if isNull || err != nil { return types.ZeroTime, true, err @@ -2839,7 +2839,7 @@ func (du *baseDateArithmitical) getDateFromDatetime(ctx sessionctx.Context, args return date, false, nil } -func (du *baseDateArithmitical) getIntervalFromString(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { +func (du *baseDateArithmetical) getIntervalFromString(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { interval, isNull, err := args[1].EvalString(ctx, row) if isNull || err != nil { return "", true, err @@ -2857,7 +2857,7 @@ func (du *baseDateArithmitical) getIntervalFromString(ctx sessionctx.Context, ar return interval, false, nil } -func (du *baseDateArithmitical) getIntervalFromDecimal(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { +func (du *baseDateArithmetical) getIntervalFromDecimal(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { decimal, isNull, err := args[1].EvalDecimal(ctx, row) if isNull || err != nil { return "", true, err @@ -2911,7 +2911,7 @@ func (du *baseDateArithmitical) getIntervalFromDecimal(ctx sessionctx.Context, a return interval, false, nil } -func (du *baseDateArithmitical) getIntervalFromInt(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { +func (du *baseDateArithmetical) getIntervalFromInt(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { interval, isNull, err := args[1].EvalInt(ctx, row) if isNull || err != nil { return "", true, err @@ -2919,7 +2919,7 @@ func (du *baseDateArithmitical) getIntervalFromInt(ctx sessionctx.Context, args return strconv.FormatInt(interval, 10), false, nil } -func (du *baseDateArithmitical) getIntervalFromReal(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { +func (du *baseDateArithmetical) getIntervalFromReal(ctx sessionctx.Context, args []Expression, row chunk.Row, unit string) (string, bool, error) { interval, isNull, err := args[1].EvalReal(ctx, row) if isNull || err != nil { return "", true, err @@ -2927,7 +2927,7 @@ func (du *baseDateArithmitical) getIntervalFromReal(ctx sessionctx.Context, args return strconv.FormatFloat(interval, 'f', args[1].GetType().Decimal, 64), false, nil } -func (du *baseDateArithmitical) add(ctx sessionctx.Context, date types.Time, interval string, unit string) (types.Time, bool, error) { +func (du *baseDateArithmetical) add(ctx sessionctx.Context, date types.Time, interval string, unit string) (types.Time, bool, error) { year, month, day, nano, err := types.ParseDurationValue(unit, interval) if err := handleInvalidTimeError(ctx, err); err != nil { return types.ZeroTime, true, err @@ -2935,7 +2935,7 @@ func (du *baseDateArithmitical) add(ctx sessionctx.Context, date types.Time, int return du.addDate(ctx, date, year, month, day, nano) } -func (du *baseDateArithmitical) addDate(ctx sessionctx.Context, date types.Time, year, month, day, nano int64) (types.Time, bool, error) { +func (du *baseDateArithmetical) addDate(ctx sessionctx.Context, date types.Time, year, month, day, nano int64) (types.Time, bool, error) { goTime, err := date.GoTime(time.UTC) if err := handleInvalidTimeError(ctx, err); err != nil { return types.ZeroTime, true, err @@ -2972,7 +2972,7 @@ func (du *baseDateArithmitical) addDate(ctx sessionctx.Context, date types.Time, return date, false, nil } -func (du *baseDateArithmitical) addDuration(ctx sessionctx.Context, d types.Duration, interval string, unit string) (types.Duration, bool, error) { +func (du *baseDateArithmetical) addDuration(ctx sessionctx.Context, d types.Duration, interval string, unit string) (types.Duration, bool, error) { dur, err := types.ExtractDurationValue(unit, interval) if err != nil { return types.ZeroDuration, true, handleInvalidTimeError(ctx, err) @@ -2984,7 +2984,7 @@ func (du *baseDateArithmitical) addDuration(ctx sessionctx.Context, d types.Dura return retDur, false, nil } -func (du *baseDateArithmitical) subDuration(ctx sessionctx.Context, d types.Duration, interval string, unit string) (types.Duration, bool, error) { +func (du *baseDateArithmetical) subDuration(ctx sessionctx.Context, d types.Duration, interval string, unit string) (types.Duration, bool, error) { dur, err := types.ExtractDurationValue(unit, interval) if err != nil { return types.ZeroDuration, true, handleInvalidTimeError(ctx, err) @@ -2996,7 +2996,7 @@ func (du *baseDateArithmitical) subDuration(ctx sessionctx.Context, d types.Dura return retDur, false, nil } -func (du *baseDateArithmitical) sub(ctx sessionctx.Context, date types.Time, interval string, unit string) (types.Time, bool, error) { +func (du *baseDateArithmetical) sub(ctx sessionctx.Context, date types.Time, interval string, unit string) (types.Time, bool, error) { year, month, day, nano, err := types.ParseDurationValue(unit, interval) if err := handleInvalidTimeError(ctx, err); err != nil { return types.ZeroTime, true, err @@ -3004,7 +3004,7 @@ func (du *baseDateArithmitical) sub(ctx sessionctx.Context, date types.Time, int return du.addDate(ctx, date, -year, -month, -day, -nano) } -func (du *baseDateArithmitical) vecGetDateFromInt(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetDateFromInt(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETInt, n) if err != nil { @@ -3046,7 +3046,7 @@ func (du *baseDateArithmitical) vecGetDateFromInt(b *baseBuiltinFunc, input *chu return nil } -func (du *baseDateArithmitical) vecGetDateFromString(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetDateFromString(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETString, n) if err != nil { @@ -3090,7 +3090,7 @@ func (du *baseDateArithmitical) vecGetDateFromString(b *baseBuiltinFunc, input * return nil } -func (du *baseDateArithmitical) vecGetDateFromDatetime(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetDateFromDatetime(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() result.ResizeTime(n, false) if err := b.args[0].VecEvalTime(b.ctx, input, result); err != nil { @@ -3111,7 +3111,7 @@ func (du *baseDateArithmitical) vecGetDateFromDatetime(b *baseBuiltinFunc, input return nil } -func (du *baseDateArithmitical) vecGetIntervalFromString(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetIntervalFromString(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETString, n) if err != nil { @@ -3148,7 +3148,7 @@ func (du *baseDateArithmitical) vecGetIntervalFromString(b *baseBuiltinFunc, inp return nil } -func (du *baseDateArithmitical) vecGetIntervalFromDecimal(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetIntervalFromDecimal(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETDecimal, n) if err != nil { @@ -3249,7 +3249,7 @@ func (du *baseDateArithmitical) vecGetIntervalFromDecimal(b *baseBuiltinFunc, in return nil } -func (du *baseDateArithmitical) vecGetIntervalFromInt(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetIntervalFromInt(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETInt, n) if err != nil { @@ -3272,7 +3272,7 @@ func (du *baseDateArithmitical) vecGetIntervalFromInt(b *baseBuiltinFunc, input return nil } -func (du *baseDateArithmitical) vecGetIntervalFromReal(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { +func (du *baseDateArithmetical) vecGetIntervalFromReal(b *baseBuiltinFunc, input *chunk.Chunk, unit string, result *chunk.Column) error { n := input.NumRows() buf, err := b.bufAllocator.get(types.ETReal, n) if err != nil { @@ -3356,97 +3356,97 @@ func (c *addDateFunctionClass) getFunction(ctx sessionctx.Context, args []Expres case dateEvalTp == types.ETString && intervalEvalTp == types.ETString: sig = &builtinAddDateStringStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateStringString) case dateEvalTp == types.ETString && intervalEvalTp == types.ETInt: sig = &builtinAddDateStringIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateStringInt) case dateEvalTp == types.ETString && intervalEvalTp == types.ETReal: sig = &builtinAddDateStringRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateStringReal) case dateEvalTp == types.ETString && intervalEvalTp == types.ETDecimal: sig = &builtinAddDateStringDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateStringDecimal) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETString: sig = &builtinAddDateIntStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateIntString) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETInt: sig = &builtinAddDateIntIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateIntInt) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETReal: sig = &builtinAddDateIntRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateIntReal) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETDecimal: sig = &builtinAddDateIntDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateIntDecimal) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETString: sig = &builtinAddDateDatetimeStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDatetimeString) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETInt: sig = &builtinAddDateDatetimeIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDatetimeInt) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETReal: sig = &builtinAddDateDatetimeRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDatetimeReal) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETDecimal: sig = &builtinAddDateDatetimeDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDatetimeDecimal) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETString: sig = &builtinAddDateDurationStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDurationString) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETInt: sig = &builtinAddDateDurationIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDurationInt) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETReal: sig = &builtinAddDateDurationRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDurationReal) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETDecimal: sig = &builtinAddDateDurationDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_AddDateDurationDecimal) } @@ -3455,11 +3455,11 @@ func (c *addDateFunctionClass) getFunction(ctx sessionctx.Context, args []Expres type builtinAddDateStringStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateStringStringSig) Clone() builtinFunc { - newSig := &builtinAddDateStringStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateStringStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3488,11 +3488,11 @@ func (b *builtinAddDateStringStringSig) evalTime(row chunk.Row) (types.Time, boo type builtinAddDateStringIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateStringIntSig) Clone() builtinFunc { - newSig := &builtinAddDateStringIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateStringIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3521,11 +3521,11 @@ func (b *builtinAddDateStringIntSig) evalTime(row chunk.Row) (types.Time, bool, type builtinAddDateStringRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateStringRealSig) Clone() builtinFunc { - newSig := &builtinAddDateStringRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateStringRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3554,11 +3554,11 @@ func (b *builtinAddDateStringRealSig) evalTime(row chunk.Row) (types.Time, bool, type builtinAddDateStringDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateStringDecimalSig) Clone() builtinFunc { - newSig := &builtinAddDateStringDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateStringDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3587,11 +3587,11 @@ func (b *builtinAddDateStringDecimalSig) evalTime(row chunk.Row) (types.Time, bo type builtinAddDateIntStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateIntStringSig) Clone() builtinFunc { - newSig := &builtinAddDateIntStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateIntStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3620,11 +3620,11 @@ func (b *builtinAddDateIntStringSig) evalTime(row chunk.Row) (types.Time, bool, type builtinAddDateIntIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateIntIntSig) Clone() builtinFunc { - newSig := &builtinAddDateIntIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateIntIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3653,11 +3653,11 @@ func (b *builtinAddDateIntIntSig) evalTime(row chunk.Row) (types.Time, bool, err type builtinAddDateIntRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateIntRealSig) Clone() builtinFunc { - newSig := &builtinAddDateIntRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateIntRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3686,11 +3686,11 @@ func (b *builtinAddDateIntRealSig) evalTime(row chunk.Row) (types.Time, bool, er type builtinAddDateIntDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateIntDecimalSig) Clone() builtinFunc { - newSig := &builtinAddDateIntDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateIntDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3719,11 +3719,11 @@ func (b *builtinAddDateIntDecimalSig) evalTime(row chunk.Row) (types.Time, bool, type builtinAddDateDatetimeStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDatetimeStringSig) Clone() builtinFunc { - newSig := &builtinAddDateDatetimeStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDatetimeStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3752,11 +3752,11 @@ func (b *builtinAddDateDatetimeStringSig) evalTime(row chunk.Row) (types.Time, b type builtinAddDateDatetimeIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDatetimeIntSig) Clone() builtinFunc { - newSig := &builtinAddDateDatetimeIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDatetimeIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3785,11 +3785,11 @@ func (b *builtinAddDateDatetimeIntSig) evalTime(row chunk.Row) (types.Time, bool type builtinAddDateDatetimeRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDatetimeRealSig) Clone() builtinFunc { - newSig := &builtinAddDateDatetimeRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDatetimeRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3818,11 +3818,11 @@ func (b *builtinAddDateDatetimeRealSig) evalTime(row chunk.Row) (types.Time, boo type builtinAddDateDatetimeDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDatetimeDecimalSig) Clone() builtinFunc { - newSig := &builtinAddDateDatetimeDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDatetimeDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3851,11 +3851,11 @@ func (b *builtinAddDateDatetimeDecimalSig) evalTime(row chunk.Row) (types.Time, type builtinAddDateDurationStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDurationStringSig) Clone() builtinFunc { - newSig := &builtinAddDateDurationStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDurationStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3882,11 +3882,11 @@ func (b *builtinAddDateDurationStringSig) evalDuration(row chunk.Row) (types.Dur type builtinAddDateDurationIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDurationIntSig) Clone() builtinFunc { - newSig := &builtinAddDateDurationIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDurationIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3912,11 +3912,11 @@ func (b *builtinAddDateDurationIntSig) evalDuration(row chunk.Row) (types.Durati type builtinAddDateDurationDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDurationDecimalSig) Clone() builtinFunc { - newSig := &builtinAddDateDurationDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDurationDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -3942,11 +3942,11 @@ func (b *builtinAddDateDurationDecimalSig) evalDuration(row chunk.Row) (types.Du type builtinAddDateDurationRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinAddDateDurationRealSig) Clone() builtinFunc { - newSig := &builtinAddDateDurationRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinAddDateDurationRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4030,97 +4030,97 @@ func (c *subDateFunctionClass) getFunction(ctx sessionctx.Context, args []Expres case dateEvalTp == types.ETString && intervalEvalTp == types.ETString: sig = &builtinSubDateStringStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateStringString) case dateEvalTp == types.ETString && intervalEvalTp == types.ETInt: sig = &builtinSubDateStringIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateStringInt) case dateEvalTp == types.ETString && intervalEvalTp == types.ETReal: sig = &builtinSubDateStringRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateStringReal) case dateEvalTp == types.ETString && intervalEvalTp == types.ETDecimal: sig = &builtinSubDateStringDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateStringDecimal) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETString: sig = &builtinSubDateIntStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateIntString) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETInt: sig = &builtinSubDateIntIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateIntInt) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETReal: sig = &builtinSubDateIntRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateIntReal) case dateEvalTp == types.ETInt && intervalEvalTp == types.ETDecimal: sig = &builtinSubDateIntDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateIntDecimal) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETString: sig = &builtinSubDateDatetimeStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDatetimeString) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETInt: sig = &builtinSubDateDatetimeIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDatetimeInt) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETReal: sig = &builtinSubDateDatetimeRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDatetimeReal) case dateEvalTp == types.ETDatetime && intervalEvalTp == types.ETDecimal: sig = &builtinSubDateDatetimeDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDatetimeDecimal) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETString: sig = &builtinSubDateDurationStringSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDurationString) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETInt: sig = &builtinSubDateDurationIntSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDurationInt) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETReal: sig = &builtinSubDateDurationRealSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDurationReal) case dateEvalTp == types.ETDuration && intervalEvalTp == types.ETDecimal: sig = &builtinSubDateDurationDecimalSig{ baseBuiltinFunc: bf, - baseDateArithmitical: newDateArighmeticalUtil(), + baseDateArithmetical: newDateArighmeticalUtil(), } sig.setPbCode(tipb.ScalarFuncSig_SubDateDurationDecimal) } @@ -4129,11 +4129,11 @@ func (c *subDateFunctionClass) getFunction(ctx sessionctx.Context, args []Expres type builtinSubDateStringStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateStringStringSig) Clone() builtinFunc { - newSig := &builtinSubDateStringStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateStringStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4162,11 +4162,11 @@ func (b *builtinSubDateStringStringSig) evalTime(row chunk.Row) (types.Time, boo type builtinSubDateStringIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateStringIntSig) Clone() builtinFunc { - newSig := &builtinSubDateStringIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateStringIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4195,11 +4195,11 @@ func (b *builtinSubDateStringIntSig) evalTime(row chunk.Row) (types.Time, bool, type builtinSubDateStringRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateStringRealSig) Clone() builtinFunc { - newSig := &builtinSubDateStringRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateStringRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4228,11 +4228,11 @@ func (b *builtinSubDateStringRealSig) evalTime(row chunk.Row) (types.Time, bool, type builtinSubDateStringDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateStringDecimalSig) Clone() builtinFunc { - newSig := &builtinSubDateStringDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateStringDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4259,11 +4259,11 @@ func (b *builtinSubDateStringDecimalSig) evalTime(row chunk.Row) (types.Time, bo type builtinSubDateIntStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateIntStringSig) Clone() builtinFunc { - newSig := &builtinSubDateIntStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateIntStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4292,11 +4292,11 @@ func (b *builtinSubDateIntStringSig) evalTime(row chunk.Row) (types.Time, bool, type builtinSubDateIntIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateIntIntSig) Clone() builtinFunc { - newSig := &builtinSubDateIntIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateIntIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4325,11 +4325,11 @@ func (b *builtinSubDateIntIntSig) evalTime(row chunk.Row) (types.Time, bool, err type builtinSubDateIntRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateIntRealSig) Clone() builtinFunc { - newSig := &builtinSubDateIntRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateIntRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4358,16 +4358,16 @@ func (b *builtinSubDateIntRealSig) evalTime(row chunk.Row) (types.Time, bool, er type builtinSubDateDatetimeStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } type builtinSubDateIntDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateIntDecimalSig) Clone() builtinFunc { - newSig := &builtinSubDateIntDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateIntDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4395,7 +4395,7 @@ func (b *builtinSubDateIntDecimalSig) evalTime(row chunk.Row) (types.Time, bool, } func (b *builtinSubDateDatetimeStringSig) Clone() builtinFunc { - newSig := &builtinSubDateDatetimeStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDatetimeStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4424,11 +4424,11 @@ func (b *builtinSubDateDatetimeStringSig) evalTime(row chunk.Row) (types.Time, b type builtinSubDateDatetimeIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDatetimeIntSig) Clone() builtinFunc { - newSig := &builtinSubDateDatetimeIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDatetimeIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4457,11 +4457,11 @@ func (b *builtinSubDateDatetimeIntSig) evalTime(row chunk.Row) (types.Time, bool type builtinSubDateDatetimeRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDatetimeRealSig) Clone() builtinFunc { - newSig := &builtinSubDateDatetimeRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDatetimeRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4490,11 +4490,11 @@ func (b *builtinSubDateDatetimeRealSig) evalTime(row chunk.Row) (types.Time, boo type builtinSubDateDatetimeDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDatetimeDecimalSig) Clone() builtinFunc { - newSig := &builtinSubDateDatetimeDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDatetimeDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4523,11 +4523,11 @@ func (b *builtinSubDateDatetimeDecimalSig) evalTime(row chunk.Row) (types.Time, type builtinSubDateDurationStringSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDurationStringSig) Clone() builtinFunc { - newSig := &builtinSubDateDurationStringSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDurationStringSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4554,11 +4554,11 @@ func (b *builtinSubDateDurationStringSig) evalDuration(row chunk.Row) (types.Dur type builtinSubDateDurationIntSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDurationIntSig) Clone() builtinFunc { - newSig := &builtinSubDateDurationIntSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDurationIntSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4585,11 +4585,11 @@ func (b *builtinSubDateDurationIntSig) evalDuration(row chunk.Row) (types.Durati type builtinSubDateDurationDecimalSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDurationDecimalSig) Clone() builtinFunc { - newSig := &builtinSubDateDurationDecimalSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDurationDecimalSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } @@ -4616,11 +4616,11 @@ func (b *builtinSubDateDurationDecimalSig) evalDuration(row chunk.Row) (types.Du type builtinSubDateDurationRealSig struct { baseBuiltinFunc - baseDateArithmitical + baseDateArithmetical } func (b *builtinSubDateDurationRealSig) Clone() builtinFunc { - newSig := &builtinSubDateDurationRealSig{baseDateArithmitical: b.baseDateArithmitical} + newSig := &builtinSubDateDurationRealSig{baseDateArithmetical: b.baseDateArithmetical} newSig.cloneFrom(&b.baseBuiltinFunc) return newSig } diff --git a/expression/builtin_time_test.go b/expression/builtin_time_test.go index 161912b07e973..e247e8756ae9a 100644 --- a/expression/builtin_time_test.go +++ b/expression/builtin_time_test.go @@ -2955,7 +2955,7 @@ func (s *testEvaluatorSuite) TestTiDBBoundedStaleness(c *C) { } func (s *testEvaluatorSuite) TestGetIntervalFromDecimal(c *C) { - du := baseDateArithmitical{} + du := baseDateArithmetical{} tests := []struct { param string