Skip to content

Commit

Permalink
expression: implement vectorized evaluation for 'builtinRightShiftSig' (
Browse files Browse the repository at this point in the history
  • Loading branch information
snithish authored and sre-bot committed Oct 11, 2019
1 parent 87a19f8 commit f42b3b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
22 changes: 20 additions & 2 deletions expression/builtin_op_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,29 @@ func (b *builtinLeftShiftSig) vecEvalInt(input *chunk.Chunk, result *chunk.Colum
}

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

func (b *builtinRightShiftSig) 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
}
numRows := input.NumRows()
buf, err := b.bufAllocator.get(types.ETInt, numRows)
if err != nil {
return err
}
defer b.bufAllocator.put(buf)
if err := b.args[1].VecEvalInt(b.ctx, input, buf); err != nil {
return err
}
arg0s := result.Int64s()
arg1s := buf.Int64s()
result.MergeNulls(buf)
for i := 0; i < numRows; i++ {
arg0s[i] = int64(uint64(arg0s[i]) >> uint64(arg1s[i]))
}
return nil
}

func (b *builtinRealIsTrueSig) 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 @@ -53,6 +53,9 @@ var vecBuiltinOpCases = map[string][]vecExprBenchCase{
ast.And: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt, types.ETInt}, geners: makeBinaryLogicOpDataGeners()},
},
ast.RightShift: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt, types.ETInt}},
},
ast.LeftShift: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt, types.ETInt}},
},
Expand Down

0 comments on commit f42b3b3

Please sign in to comment.