diff --git a/expression/builtin_op_vec.go b/expression/builtin_op_vec.go index 88e6f8a742..ecfcf2de57 100644 --- a/expression/builtin_op_vec.go +++ b/expression/builtin_op_vec.go @@ -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 { diff --git a/expression/builtin_op_vec_test.go b/expression/builtin_op_vec_test.go index 0da4eb8843..f0d7f3af56 100644 --- a/expression/builtin_op_vec_test.go +++ b/expression/builtin_op_vec_test.go @@ -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}},