Skip to content

Commit

Permalink
expression: implement vectorized evaluation for builtinRealIsNullSig (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tangwz authored and qw4990 committed Oct 8, 2019
1 parent fd51034 commit 930b852
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions expression/builtin_op_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,31 @@ func (b *builtinIntIsNullSig) vecEvalInt(input *chunk.Chunk, result *chunk.Colum
}

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

func (b *builtinRealIsNullSig) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
return errors.Errorf("not implemented")
numRows := input.NumRows()
buf, err := b.bufAllocator.get(types.ETReal, numRows)
if err != nil {
return err
}
defer b.bufAllocator.put(buf)

if err := b.args[0].VecEvalReal(b.ctx, input, buf); err != nil {
return err
}

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

func (b *builtinUnaryNotRealSig) 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.ETReal}},
{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 930b852

Please sign in to comment.