diff --git a/expression/builtin_op_vec.go b/expression/builtin_op_vec.go index 73e0c4286d..2a08e414dd 100644 --- a/expression/builtin_op_vec.go +++ b/expression/builtin_op_vec.go @@ -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 } diff --git a/expression/builtin_op_vec_test.go b/expression/builtin_op_vec_test.go index 1f34313fba..d1c9ec0346 100644 --- a/expression/builtin_op_vec_test.go +++ b/expression/builtin_op_vec_test.go @@ -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