Skip to content

Commit

Permalink
expression: implement vectorized evaluation for builtinAtan1ArgSig (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
jacklightChen authored and sre-bot committed Sep 17, 2019
1 parent b669640 commit 72c1dbc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions expression/builtin_math_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ func (b *builtinAsinSig) vectorized() bool {
return true
}

func (b *builtinAtan1ArgSig) 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.Atan(f64s[i])
}
return nil
}

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

func (b *builtinAtan2ArgsSig) vecEvalReal(input *chunk.Chunk, result *chunk.Column) error {
n := input.NumRows()
if err := b.args[0].VecEvalReal(b.ctx, input, result); err != nil {
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 @@ -34,6 +34,9 @@ var vecBuiltinMathCases = map[string][]vecExprBenchCase{
ast.Asin: {
{types.ETReal, []types.EvalType{types.ETReal}, nil},
},
ast.Atan: {
{types.ETReal, []types.EvalType{types.ETReal}, nil},
},
ast.Atan2: {
{types.ETReal, []types.EvalType{types.ETReal, types.ETReal}, nil},
},
Expand Down

0 comments on commit 72c1dbc

Please sign in to comment.