Skip to content

Commit

Permalink
expression: implement vectorized evaluation for builtinBitNegSig (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AerysNan authored and qw4990 committed Nov 19, 2019
1 parent d902895 commit ec2d6b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions expression/builtin_op_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,19 @@ func (b *builtinUnaryMinusRealSig) vecEvalReal(input *chunk.Chunk, result *chunk
}

func (b *builtinBitNegSig) vectorized() bool {
return false
return true
}

func (b *builtinBitNegSig) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
return errors.Errorf("not implemented")
if err := b.args[0].VecEvalInt(b.ctx, input, result); err != nil {
return err
}
n := input.NumRows()
args := result.Int64s()
for i := 0; i < n; i++ {
args[i] = ^args[i]
}
return nil
}

func (b *builtinUnaryMinusDecimalSig) vectorized() bool {
Expand Down
3 changes: 3 additions & 0 deletions expression/builtin_op_vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ var vecBuiltinOpCases = map[string][]vecExprBenchCase{
ast.Or: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt, types.ETInt}, geners: makeBinaryLogicOpDataGeners()},
},
ast.BitNeg: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt}},
},
ast.UnaryNot: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal}},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal}},
Expand Down

0 comments on commit ec2d6b7

Please sign in to comment.