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

Method fastPath

runtime/vam/expr/function/time.go:124–145  ·  view source on GitHub ↗
(fvec vector.Any, tvec vector.Any)

Source from the content-addressed store, hash-verified

122}
123
124func (s *Strftime) fastPath(fvec vector.Any, tvec vector.Any) vector.Any {
125 format := vector.StringValue(fvec, 0)
126 f, err := strftime.New(format)
127 if err != nil {
128 return vector.NewWrappedError(s.sctx, "strftime: "+err.Error(), fvec)
129 }
130 switch tvec := tvec.(type) {
131 case *vector.Int:
132 return s.fastPathLoop(f, tvec, nil)
133 case *vector.Const:
134 t := vector.IntValue(tvec, 0)
135 s := f.FormatString(nano.Ts(t).Time())
136 return vector.NewConstString(s, tvec.Len())
137 case *vector.View:
138 return s.fastPathLoop(f, tvec.Any.(*vector.Int), tvec.Index)
139 case *vector.Dict:
140 vec := s.fastPathLoop(f, tvec.Any.(*vector.Int), nil)
141 return vector.NewDict(vec, tvec.Index, tvec.Counts)
142 default:
143 panic(tvec)
144 }
145}
146
147func (s *Strftime) fastPathLoop(f *strftime.Strftime, vec *vector.Int, index []uint32) *vector.String {
148 if index != nil {

Callers 1

CallMethod · 0.95

Calls 11

fastPathLoopMethod · 0.95
StringValueFunction · 0.92
NewWrappedErrorFunction · 0.92
IntValueFunction · 0.92
TsTypeAlias · 0.92
NewConstStringFunction · 0.92
NewDictFunction · 0.92
NewMethod · 0.80
LenMethod · 0.65
ErrorMethod · 0.45
TimeMethod · 0.45

Tested by

no test coverage detected