| 93 | } |
| 94 | |
| 95 | func 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 | |
| 123 | func date_time_microseconds(vec vector.Any) vector.Any { |
| 124 | switch vec := vec.(type) { |