Skip to content

Commit

Permalink
docs: cut with default value (#4773)
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly authored Sep 21, 2023
1 parent aa06e5b commit 7b67ce1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/language/operators/cut.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,13 @@ echo '1 {a:1,b:2,c:3}' | zq -z 'cut a,b' -
{a:error("missing"),b:error("missing")}
{a:1,b:2}
```
_Set default values for fields with null values_
This can be helpful when using the `csv` export format, which expects a uniform record structure (which includes field types).
```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 7b67ce1

Please sign in to comment.