Skip to content

Commit

Permalink
Merge branch 'vec-builtinLogicAndSig' of github.com:lauhg/tidb into v…
Browse files Browse the repository at this point in the history
…ec-builtinLogicAndSig
  • Loading branch information
lauhg committed Sep 25, 2019
2 parents 3f5adcf + f1f1d31 commit 8f19cd5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 0 additions & 3 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,6 @@ func FormatSQL(sql string, pps variable.PreparedParams) stringutil.StringerFunc
func (a *ExecStmt) LogSlowQuery(txnTS uint64, succ bool) {
sessVars := a.Ctx.GetSessionVars()
level := log.GetLevel()
if level > zapcore.WarnLevel {
return
}
cfg := config.GetGlobalConfig()
costTime := time.Since(a.Ctx.GetSessionVars().StartTime)
threshold := time.Duration(atomic.LoadUint64(&cfg.Log.SlowThreshold)) * time.Millisecond
Expand Down
18 changes: 18 additions & 0 deletions expression/builtin_math_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,24 @@ func (b *builtinPowSig) vectorized() bool {
return true
}

func (b *builtinCeilRealSig) vecEvalReal(input *chunk.Chunk, result *chunk.Column) error {
if err := b.args[0].VecEvalReal(b.ctx, input, result); err != nil {
return err
}
f64s := result.Float64s()
for i := 0; i < len(f64s); i++ {
if result.IsNull(i) {
continue
}
f64s[i] = math.Ceil(f64s[i])
}
return nil
}

func (b *builtinCeilRealSig) vectorized() bool {
return true
}

func (b *builtinRoundRealSig) vecEvalReal(input *chunk.Chunk, result *chunk.Column) error {
if err := b.args[0].VecEvalReal(b.ctx, input, result); err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions expression/builtin_math_vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ var vecBuiltinMathCases = map[string][]vecExprBenchCase{
ast.Pow: {
{retEvalType: types.ETReal, childrenTypes: []types.EvalType{types.ETReal, types.ETReal}, geners: []dataGenerator{&rangeRealGener{0, 10, 0.5}, &rangeRealGener{0, 100, 0.5}}},
},
ast.Ceil: {
{retEvalType: types.ETReal, childrenTypes: []types.EvalType{types.ETReal}, geners: nil},
},
ast.Truncate: {
{retEvalType: types.ETReal, childrenTypes: []types.EvalType{types.ETReal, types.ETInt}, geners: []dataGenerator{nil, &rangeInt64Gener{-10, 10}}},
},
Expand Down

0 comments on commit 8f19cd5

Please sign in to comment.