Skip to content

Commit f9c37a0

Browse files
committed
Fix strftime on views
Closes #5473
1 parent cbb40f5 commit f9c37a0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

runtime/vam/expr/function/time.go

+9-5
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,17 @@ func (s *Strftime) fastPath(fvec *vector.Const, tvec vector.Any) vector.Any {
136136
}
137137

138138
func (s *Strftime) fastPathLoop(f *strftime.Strftime, vec *vector.Int, index []uint32) *vector.String {
139+
if index != nil {
140+
out := vector.NewStringEmpty(uint32(len(index)), vector.NewBoolView(vec.Nulls, index))
141+
for _, i := range index {
142+
s := f.FormatString(nano.Ts(vec.Values[i]).Time())
143+
out.Append(s)
144+
}
145+
return out
146+
}
139147
out := vector.NewStringEmpty(vec.Len(), vec.Nulls)
140148
for i := range vec.Len() {
141-
idx := i
142-
if index != nil {
143-
idx = index[i]
144-
}
145-
s := f.FormatString(nano.Ts(vec.Values[idx]).Time())
149+
s := f.FormatString(nano.Ts(vec.Values[i]).Time())
146150
out.Append(s)
147151
}
148152
return out

0 commit comments

Comments
 (0)