Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression: speed up builtinRepeatSig by using MergeNulls #12674

Merged
merged 9 commits into from
Oct 23, 2019
15 changes: 10 additions & 5 deletions expression/builtin_string_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ func (b *builtinRepeatSig) vecEvalString(input *chunk.Chunk, result *chunk.Colum

result.ReserveString(n)
nums := buf2.Int64s()
buf.MergeNulls(buf2)
for i := 0; i < n; i++ {
// TODO: introduce vectorized null-bitmap to speed it up.
if buf.IsNull(i) || buf2.IsNull(i) {
if buf.IsNull(i) {
result.AppendNull()
continue
}
Expand Down Expand Up @@ -193,8 +194,9 @@ func (b *builtinLeftSig) vecEvalString(input *chunk.Chunk, result *chunk.Column)

result.ReserveString(n)
nums := buf2.Int64s()
buf.MergeNulls(buf2)
for i := 0; i < n; i++ {
if buf.IsNull(i) || buf2.IsNull(i) {
if buf.IsNull(i) {
result.AppendNull()
continue
}
Expand Down Expand Up @@ -238,8 +240,9 @@ func (b *builtinRightSig) vecEvalString(input *chunk.Chunk, result *chunk.Column

result.ReserveString(n)
nums := buf2.Int64s()
buf.MergeNulls(buf2)
for i := 0; i < n; i++ {
if buf.IsNull(i) || buf2.IsNull(i) {
if buf.IsNull(i) {
result.AppendNull()
continue
}
Expand Down Expand Up @@ -652,8 +655,9 @@ func (b *builtinInsertSig) vecEvalString(input *chunk.Chunk, result *chunk.Colum
result.ReserveString(n)
i64s1 := buf1.Int64s()
i64s2 := buf2.Int64s()
buf.MergeNulls(buf1, buf2, buf3)
for i := 0; i < n; i++ {
if buf.IsNull(i) || buf1.IsNull(i) || buf2.IsNull(i) || buf3.IsNull(i) {
if buf.IsNull(i) {
result.AppendNull()
continue
}
Expand Down Expand Up @@ -834,8 +838,9 @@ func (b *builtinReplaceSig) vecEvalString(input *chunk.Chunk, result *chunk.Colu
}

result.ReserveString(n)
buf.MergeNulls(buf1, buf2)
for i := 0; i < n; i++ {
if buf.IsNull(i) || buf1.IsNull(i) || buf2.IsNull(i) {
if buf.IsNull(i) {
result.AppendNull()
continue
}
Expand Down