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

Function date_time_second

runtime/vam/expr/function/datepartfuncs.go:235–261  ·  view source on GitHub ↗
(vec vector.Any)

Source from the content-addressed store, hash-verified

233}
234
235func date_time_second(vec vector.Any) vector.Any {
236 switch vec := vec.(type) {
237 case *vector.View:
238 index := vec.Index
239 inner := vec.Any.(*vector.Int)
240 out := make([]int64, len(index))
241 for i, idx := range index {
242 v := inner.Values[idx]
243 out[i] = int64(nano.Ts(v).Time().Second())
244 }
245 return vector.NewInt(super.TypeInt64, out)
246 case *vector.Const:
247 v := vector.IntValue(vec, 0)
248 return vector.NewConstInt(super.TypeInt64, int64(nano.Ts(v).Time().Second()), vec.Len())
249 case *vector.Dict:
250 out := date_time_second(vec.Any).(*vector.Int)
251 return vector.NewDict(out, vec.Index, vec.Counts)
252 case *vector.Int:
253 out := make([]int64, vec.Len())
254 for i, v := range vec.Values {
255 out[i] = int64(nano.Ts(v).Time().Second())
256 }
257 return vector.NewInt(super.TypeInt64, out)
258 default:
259 panic(vec)
260 }
261}
262
263func date_time_year(vec vector.Any) vector.Any {
264 switch vec := vec.(type) {

Callers

nothing calls this directly

Calls 7

TsTypeAlias · 0.92
NewIntFunction · 0.92
IntValueFunction · 0.92
NewConstIntFunction · 0.92
NewDictFunction · 0.92
LenMethod · 0.65
TimeMethod · 0.45

Tested by

no test coverage detected