expression: implement vectorized evaluation for builtinDurationIsNullSig (#12523)

This commit is contained in:
tangwz
2019-10-08 11:23:16 +08:00
committed by pingcap-github-bot
parent 4d9237142b
commit efd51d7e6d
2 changed files with 25 additions and 3 deletions

View File

@ -412,9 +412,29 @@ func (b *builtinIntIsTrueSig) vecEvalInt(input *chunk.Chunk, result *chunk.Colum
}
func (b *builtinDurationIsNullSig) vectorized() bool {
return false
return true
}
func (b *builtinDurationIsNullSig) vecEvalInt(input *chunk.Chunk, result *chunk.Column) error {
return errors.Errorf("not implemented")
numRows := input.NumRows()
buf, err := b.bufAllocator.get(types.ETDuration, numRows)
if err != nil {
return err
}
defer b.bufAllocator.put(buf)
if err := b.args[0].VecEvalDuration(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
}

View File

@ -42,7 +42,9 @@ var vecBuiltinOpCases = map[string][]vecExprBenchCase{
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETInt}},
},
ast.UnaryMinus: {},
ast.IsNull: {},
ast.IsNull: {
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDuration}},
},
}
// givenValsGener returns the items sequentially from the slice given at