diff --git a/runtime/expr/agg/collect.go b/runtime/expr/agg/collect.go index 060148e7ac..6bb88ce316 100644 --- a/runtime/expr/agg/collect.go +++ b/runtime/expr/agg/collect.go @@ -22,7 +22,7 @@ func (c *Collect) Consume(val *zed.Value) { } func (c *Collect) update(val *zed.Value) { - c.values = append(c.values, *val.Copy()) + c.values = append(c.values, *val.Under(&zed.Value{}).Copy()) c.size += len(val.Bytes()) for c.size > MaxValueSize { // XXX See issue #1813. For now we silently discard entries diff --git a/runtime/expr/agg/ztests/collect-untag-unions.yaml b/runtime/expr/agg/ztests/collect-untag-unions.yaml new file mode 100644 index 0000000000..b94ea627fe --- /dev/null +++ b/runtime/expr/agg/ztests/collect-untag-unions.yaml @@ -0,0 +1,9 @@ +zed: collect(this) + +input: | + 1((int64,string)) + "foo"((time,string)) + 0.5 + +output: | + [1,"foo",0.5]