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: implement vectorized evaluation for builtinNowWithArgSig #13372

Merged
merged 6 commits into from
Nov 12, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
expression: builtinNowWithArgSig, fixes after review
  • Loading branch information
ekalinin committed Nov 12, 2019
commit 3ad0772fb0a9dcb19da5f8b93799ee2f903008ae
16 changes: 10 additions & 6 deletions expression/builtin_time_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,26 +578,30 @@ func (b *builtinNowWithArgSig) vecEvalTime(input *chunk.Chunk, result *chunk.Col
}

result.ResizeTime(n, false)
result.MergeNulls(bufFsp)
times := result.Times()
fsps := bufFsp.Int64s()

for i := 0; i < n; i++ {
fsp := int8(0)
if !result.IsNull(i) {
if !bufFsp.IsNull(i) {
if fsps[i] > int64(types.MaxFsp) {
return errors.Errorf("Too-big precision %v specified for 'now'. Maximum is %v.", fsps[i], types.MaxFsp)
}
if fsps[i] < int64(types.MinFsp) {
return errors.Errorf("Invalid negative %d specified, must in [0, 6].", fsps[i])
}
fsp = int8(fsps[i])
}

t, isNull, err := evalNowWithFsp(b.ctx, fsp)
if err != nil {
return err
}
if isNull {
result.SetNull(i, true)
continue
}

if err != nil {
return err
}

times[i] = t
}
return nil
Expand Down