| 233 | } |
| 234 | |
| 235 | func 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 | |
| 263 | func date_time_year(vec vector.Any) vector.Any { |
| 264 | switch vec := vec.(type) { |