Skip to content

Commit

Permalink
Fix EOS handling in vector summarize operator
Browse files Browse the repository at this point in the history
The summarize operator doesn't reset itself upon receives EOS from its
parent, preventing it from working properly inside a scoped over
operator (i.e., "over x => (summarize ...)").  Fix that.
  • Loading branch information
nwt committed Dec 16, 2024
1 parent 3e7870e commit af5d72f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runtime/vam/op/summarize/summarize.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *Summarize) Pull(done bool) (vector.Any, error) {
for _, t := range s.tables {
s.results = append(s.results, t)
}
s.tables = nil
clear(s.tables)
return s.next(), nil
}
var keys, vals []vector.Any
Expand Down Expand Up @@ -124,6 +124,7 @@ func (s *Summarize) isCountByString(keyTypes []super.Type) bool {

func (s *Summarize) next() vector.Any {
if len(s.results) == 0 {
s.results = nil
return nil
}
t := s.results[0]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
zed: over a => (sum(this))

vector: true

input: |
{a:null([int64])}
{a:[6,5,4]}
Expand Down

0 comments on commit af5d72f

Please sign in to comment.