expression: implement vectorized evaluation for 'builtinCastJSONAsStringSig' (#12542)
This commit is contained in:
@ -456,11 +456,29 @@ func (b *builtinCastJSONAsJSONSig) vecEvalJSON(input *chunk.Chunk, result *chunk
|
||||
}
|
||||
|
||||
func (b *builtinCastJSONAsStringSig) vectorized() bool {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
func (b *builtinCastJSONAsStringSig) vecEvalString(input *chunk.Chunk, result *chunk.Column) error {
|
||||
return errors.Errorf("not implemented")
|
||||
n := input.NumRows()
|
||||
buf, err := b.bufAllocator.get(types.ETJson, n)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer b.bufAllocator.put(buf)
|
||||
if err := b.args[0].VecEvalJSON(b.ctx, input, buf); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
result.ReserveString(n)
|
||||
for i := 0; i < n; i++ {
|
||||
if buf.IsNull(i) {
|
||||
result.AppendNull()
|
||||
continue
|
||||
}
|
||||
result.AppendString(buf.GetJSON(i).String())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *builtinCastDurationAsRealSig) vectorized() bool {
|
||||
|
||||
@ -37,6 +37,7 @@ var vecBuiltinCastCases = map[string][]vecExprBenchCase{
|
||||
},
|
||||
{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETInt}},
|
||||
{retEvalType: types.ETDecimal, childrenTypes: []types.EvalType{types.ETDatetime}},
|
||||
{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETJson}},
|
||||
{retEvalType: types.ETString, childrenTypes: []types.EvalType{types.ETDecimal}},
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user