Skip to content

Commit

Permalink
Modify the cut/coalesce example in Zed language docs
Browse files Browse the repository at this point in the history
  • Loading branch information
philrz committed Sep 21, 2023
1 parent aa06e5b commit 4448968
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/language/operators/cut.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,19 @@ echo '1 {a:1,b:2,c:3}' | zq -z 'cut a,b' -
{a:error("missing"),b:error("missing")}
{a:1,b:2}
```
_Invoke a function while cutting to set a default value for a field_

:::tip
This can be helpful to transform data into a uniform record type, such as if
the output will be exported in formats such as `csv` or `parquet` (see also:
[`fuse`](fuse.md)).
:::

```mdtest-command
echo '{a:1,b:null}{a:1,b:2}' | zq -z 'cut a,b:=coalesce(b, 0)' -
```
=>
```mdtest-output
{a:1,b:0}
{a:1,b:2}
```

0 comments on commit 4448968

Please sign in to comment.