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

Function date_time_microseconds

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

Source from the content-addressed store, hash-verified

121}
122
123func date_time_microseconds(vec vector.Any) vector.Any {
124 switch vec := vec.(type) {
125 case *vector.View:
126 index := vec.Index
127 inner := vec.Any.(*vector.Int)
128 out := make([]int64, len(index))
129 for i, idx := range index {
130 v := inner.Values[idx]
131 out[i] = int64(nano.Ts(v).Time().Second()*1e6 + nano.Ts(v).Time().Nanosecond()/1e3)
132 }
133 return vector.NewInt(super.TypeInt64, out)
134 case *vector.Const:
135 v := vector.IntValue(vec, 0)
136 return vector.NewConstInt(super.TypeInt64, int64(nano.Ts(v).Time().Second()*1e6+nano.Ts(v).Time().Nanosecond()/1e3), vec.Len())
137 case *vector.Dict:
138 out := date_time_microseconds(vec.Any).(*vector.Int)
139 return vector.NewDict(out, vec.Index, vec.Counts)
140 case *vector.Int:
141 out := make([]int64, vec.Len())
142 for i, v := range vec.Values {
143 out[i] = int64(nano.Ts(v).Time().Second()*1e6 + nano.Ts(v).Time().Nanosecond()/1e3)
144 }
145 return vector.NewInt(super.TypeInt64, out)
146 default:
147 panic(vec)
148 }
149}
150
151func date_time_milliseconds(vec vector.Any) vector.Any {
152 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