Skip to content

Commit a33df05

Browse files
committed
collect(): Do not ignore null values
Closes #5039
1 parent 4dc6236 commit a33df05

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

docs/tutorials/schools.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,8 @@ and produces
10131013
Schools: [
10141014
"Auberry Elementary",
10151015
"Balch Camp Elementary",
1016-
"Pine Ridge Elementary"
1016+
"Pine Ridge Elementary",
1017+
null (string)
10171018
]
10181019
}
10191020
{
@@ -1023,9 +1024,7 @@ and produces
10231024
"www.bigcreekschool.com"
10241025
],
10251026
Schools: [
1026-
"Big Creek Elementary"
1027-
]
1028-
}
1027+
"Big Creek Elementary",
10291028
...
10301029
```
10311030

runtime/sam/expr/agg/collect.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ type Collect struct {
1616
var _ Function = (*Collect)(nil)
1717

1818
func (c *Collect) Consume(val zed.Value) {
19-
if !val.IsNull() {
20-
c.update(val)
21-
}
19+
c.update(val)
2220
}
2321

2422
func (c *Collect) update(val zed.Value) {

runtime/sam/expr/agg/ztests/collect-untag-unions.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ input: |
44
1((int64,string))
55
"foo"((time,string))
66
0.5
7+
null(string)
78
89
output: |
9-
[1,"foo",0.5]
10+
[1,"foo",0.5,null]

0 commit comments

Comments
 (0)