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

Function date_time_hour

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

Source from the content-addressed store, hash-verified

93}
94
95func date_time_hour(vec vector.Any) vector.Any {
96 switch vec := vec.(type) {
97 case *vector.View:
98 index := vec.Index
99 inner := vec.Any.(*vector.Int)
100 out := make([]int64, len(index))
101 for i, idx := range index {
102 v := inner.Values[idx]
103 out[i] = int64(nano.Ts(v).Time().Hour())
104 }
105 return vector.NewInt(super.TypeInt64, out)
106 case *vector.Const:
107 v := vector.IntValue(vec, 0)
108 return vector.NewConstInt(super.TypeInt64, int64(nano.Ts(v).Time().Hour()), vec.Len())
109 case *vector.Dict:
110 out := date_time_hour(vec.Any).(*vector.Int)
111 return vector.NewDict(out, vec.Index, vec.Counts)
112 case *vector.Int:
113 out := make([]int64, vec.Len())
114 for i, v := range vec.Values {
115 out[i] = int64(nano.Ts(v).Time().Hour())
116 }
117 return vector.NewInt(super.TypeInt64, out)
118 default:
119 panic(vec)
120 }
121}
122
123func date_time_microseconds(vec vector.Any) vector.Any {
124 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