Skip to content

Commit

Permalink
expression: implement vectorized evaluation for builtinIntIsNullSig (
Browse files Browse the repository at this point in the history
  • Loading branch information
tangwz authored and ngaut committed Oct 8, 2019
1 parent 5e2f388 commit fd51034
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions expression/builtin_op_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,24 @@ func (b *builtinUnaryMinusDecimalSig) vecEvalDecimal(input *chunk.Chunk, result
}

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

func (b *builtinIntIsNullSig) 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
}

i64s := result.Int64s()
for i := 0; i < len(i64s); i++ {
if result.IsNull(i) {
i64s[i] = 1
result.SetNull(i, false)
} else {
i64s[i] = 0
}
}
return nil
}

func (b *builtinRealIsNullSig) vectorized() bool {
Expand Down
1 change: 1 addition & 0 deletions expression/builtin_op_vec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var vecBuiltinOpCases = map[string][]vecExprBenchCase{
},
ast.UnaryMinus: {},
ast.IsNull: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt}},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal}},
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration}},
},
Expand Down

0 comments on commit fd51034

Please sign in to comment.