expression:implement vectorized evaluation for builtinUnixTimestampCurrentSig (#13510)

This commit is contained in:
CWang
2019-11-19 15:58:02 +08:00
committed by pingcap-github-bot
parent 8535b90104
commit bca3cfa7f8
2 changed files with 21 additions and 2 deletions

View File

@ -436,11 +436,27 @@ func (b *builtinSubDateIntIntSig) vecEvalTime(input *chunk.Chunk, result *chunk.
}
func (b *builtinUnixTimestampCurrentSig) vectorized() bool {
return false
return true
}
func (b *builtinUnixTimestampCurrentSig) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
return errors.Errorf("not implemented")
nowTs, err := getStmtTimestamp(b.ctx)
if err != nil {
return err
}
dec, err := goTimeToMysqlUnixTimestamp(nowTs, 1)
if err != nil {
return err
}
intVal, err := dec.ToInt()
terror.Log(err)
n := input.NumRows()
result.ResizeInt64(n, false)
intRes := result.Int64s()
for i := 0; i < n; i++ {
intRes[i] = intVal
}
return nil
}
func (b *builtinSubDateIntRealSig) vectorized() bool {

View File

@ -209,6 +209,9 @@ var vecBuiltinTimeCases = map[string][]vecExprBenchCase{
{retEvalType: types.ETTimestamp},
{retEvalType: types.ETTimestamp, childrenTypes: []types.EvalType{types.ETInt}, geners: []dataGenerator{&rangeInt64Gener{begin: 0, end: 7}}},
},
ast.UnixTimestamp: {
{retEvalType: types.ETInt},
},
ast.UTCTime: {
{retEvalType: types.ETDuration},
{retEvalType: types.ETDuration, childrenTypes: []types.EvalType{types.ETInt}, geners: []dataGenerator{&rangeInt64Gener{begin: 0, end: 7}}},