expression: implement vectorized evaluation for builtinBitNegSig (#13554)

This commit is contained in:
Aerys Nan
2019-11-19 16:50:11 +08:00
committed by Yuanjia Zhang
parent d902895474
commit ec2d6b7f53
2 changed files with 13 additions and 2 deletions

View File

@ -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 {

View File

@ -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}},