Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collect(): Allow null values #5041

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/tutorials/schools.md
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,8 @@ and produces
Schools: [
"Auberry Elementary",
"Balch Camp Elementary",
"Pine Ridge Elementary"
"Pine Ridge Elementary",
null (string)
]
}
{
Expand All @@ -1023,9 +1024,7 @@ and produces
"www.bigcreekschool.com"
],
Schools: [
"Big Creek Elementary"
]
}
"Big Creek Elementary",
...
```

Expand Down
4 changes: 1 addition & 3 deletions runtime/sam/expr/agg/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ type Collect struct {
var _ Function = (*Collect)(nil)

func (c *Collect) Consume(val zed.Value) {
if !val.IsNull() {
c.update(val)
}
c.update(val)
}

func (c *Collect) update(val zed.Value) {
Expand Down
3 changes: 2 additions & 1 deletion runtime/sam/expr/agg/ztests/collect-untag-unions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ input: |
1((int64,string))
"foo"((time,string))
0.5
null(string)

output: |
[1,"foo",0.5]
[1,"foo",0.5,null]
Loading