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

Method constBin

runtime/vam/expr/function/time.go:55–71  ·  view source on GitHub ↗
(tsVec vector.Any, bin nano.Duration)

Source from the content-addressed store, hash-verified

53}
54
55func (b *Bucket) constBin(tsVec vector.Any, bin nano.Duration) vector.Any {
56 if bin == 0 {
57 return cast.To(b.sctx, tsVec, b.resultType(tsVec))
58 }
59 switch tsVec := tsVec.(type) {
60 case *vector.Const:
61 typ := b.resultType(tsVec)
62 ts := vector.IntValue(tsVec, 0)
63 return vector.NewConstInt(typ, ts, tsVec.Len())
64 case *vector.View:
65 return vector.NewView(b.constBinFlat(tsVec.Any, bin), tsVec.Index)
66 case *vector.Dict:
67 return vector.NewDict(b.constBinFlat(tsVec.Any, bin), tsVec.Index, tsVec.Counts)
68 default:
69 return b.constBinFlat(tsVec, bin)
70 }
71}
72
73func (b *Bucket) constBinFlat(tsVecFlat vector.Any, bin nano.Duration) *vector.Int {
74 tsVec := tsVecFlat.(*vector.Int)

Callers 1

callMethod · 0.95

Calls 8

resultTypeMethod · 0.95
constBinFlatMethod · 0.95
ToFunction · 0.92
IntValueFunction · 0.92
NewConstIntFunction · 0.92
NewViewFunction · 0.92
NewDictFunction · 0.92
LenMethod · 0.65

Tested by

no test coverage detected