expression: implement vectorized evaluation for builtinRealIsTrueSig (#12517)
This commit is contained in:
committed by
Yuanjia Zhang
parent
740b490cbd
commit
5e2f3883ae
@ -408,11 +408,31 @@ func (b *builtinRightShiftSig) vecEvalInt(input *chunk.Chunk, result *chunk.Colu
|
||||
}
|
||||
|
||||
func (b *builtinRealIsTrueSig) vectorized() bool {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
func (b *builtinRealIsTrueSig) 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)
|
||||
f64s := buf.Float64s()
|
||||
i64s := result.Int64s()
|
||||
for i := 0; i < numRows; i++ {
|
||||
if buf.IsNull(i) || f64s[i] == 0 {
|
||||
i64s[i] = 0
|
||||
} else {
|
||||
i64s[i] = 1
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *builtinDecimalIsTrueSig) vectorized() bool {
|
||||
|
||||
@ -23,6 +23,7 @@ import (
|
||||
|
||||
var vecBuiltinOpCases = map[string][]vecExprBenchCase{
|
||||
ast.IsTruth: {
|
||||
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETReal}, geners: []dataGenerator{&defaultGener{0.2, types.ETReal}}},
|
||||
{retEvalType: types.ETInt, childrenTypes: []types.EvalType{types.ETDecimal}, geners: []dataGenerator{&defaultGener{0.2, types.ETDecimal}}},
|
||||
},
|
||||
ast.IsFalsity: {
|
||||
|
||||
Reference in New Issue
Block a user