MCPcopy Create free account
hub / github.com/brimdata/super / call

Method call

runtime/vam/expr/function/time.go:33–53  ·  view source on GitHub ↗
(args ...vector.Any)

Source from the content-addressed store, hash-verified

31}
32
33func (b *Bucket) call(args ...vector.Any) vector.Any {
34 if vec, ok := expr.CheckForNullThenError(args); ok {
35 return vec
36 }
37 tsArg, binArg := args[0], args[1]
38 if _, ok := binArg.(*vector.Const); ok {
39 bin := vector.IntValue(binArg, 0)
40 return b.constBin(tsArg, nano.Duration(bin))
41 }
42 var ints []int64
43 for i := range tsArg.Len() {
44 dur := vector.IntValue(tsArg, i)
45 bin := vector.IntValue(binArg, i)
46 if bin == 0 {
47 ints = append(ints, dur)
48 } else {
49 ints = append(ints, int64(nano.Ts(dur).Trunc(nano.Duration(bin))))
50 }
51 }
52 return vector.NewInt(b.resultType(tsArg), ints)
53}
54
55func (b *Bucket) constBin(tsVec vector.Any, bin nano.Duration) vector.Any {
56 if bin == 0 {

Callers

nothing calls this directly

Calls 9

constBinMethod · 0.95
resultTypeMethod · 0.95
CheckForNullThenErrorFunction · 0.92
IntValueFunction · 0.92
DurationTypeAlias · 0.92
TsTypeAlias · 0.92
NewIntFunction · 0.92
LenMethod · 0.65
TruncMethod · 0.45

Tested by

no test coverage detected